Changeset 747 for trunk/Common/Setup/Updates.php
- Timestamp:
- Sep 21, 2015, 12:12:26 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Setup/Updates.php
r743 r747 1489 1489 } 1490 1490 1491 function UpdateTo748($Manager) 1492 { 1493 $Manager->Execute('ALTER TABLE `FinanceOperation` ADD `ValueUser` FLOAT NOT NULL AFTER `Value`;'); 1494 $Manager->Execute('UPDATE `FinanceOperation` SET `ValueUser`=`Value`'); 1495 $Manager->Execute('UPDATE `FinanceOperation` SET `Value`=`ValueUser`*`ValueSign`'); 1496 $Manager->Execute('UPDATE `FinanceOperation` SET `Group`=1 WHERE (`ValueSign`=1) AND (`Cash`=1)'); 1497 $Manager->Execute('UPDATE `FinanceOperation` SET `Group`=2 WHERE (`ValueSign`=-1) AND (`Cash`=1)'); 1498 $Manager->Execute('UPDATE `FinanceOperation` SET `Group`=3 WHERE (`ValueSign`=1) AND (`Cash`=0)'); 1499 $Manager->Execute('UPDATE `FinanceOperation` SET `Group`=4 WHERE (`ValueSign`=-1) AND (`Cash`=0)'); 1500 $Manager->Execute('ALTER TABLE `FinanceOperation` DROP `Direction`, DROP `ValueSign`;'); 1501 1502 // SELECT FinanceInvoice.* FROM `FinanceInvoice` LEFT JOIN FinanceInvoiceGroup ON FinanceInvoiceGroup.Id=FinanceInvoice.Group WHERE FinanceInvoice.ValueSign != FinanceInvoiceGroup.ValueSign 1503 $Manager->Execute('UPDATE `FinanceInvoice` SET `Group`=1 WHERE (`ValueSign`=-1)'); 1504 $Manager->Execute('UPDATE `FinanceInvoice` SET `Group`=2 WHERE (`ValueSign`=1)'); 1505 $Manager->Execute('UPDATE `FinanceInvoice` SET `Value`=`Value`*`ValueSign`'); 1506 $Manager->Execute('ALTER TABLE `FinanceInvoice` DROP `Direction`, DROP `ValueSign`;'); 1507 // Check manual vs. calculated value from items 1508 // SELECT * FROM (SELECT `FinanceInvoice`.`Id`, ((SELECT SUM(`Price` * `Quantity`) FROM `FinanceInvoiceItem` WHERE `FinanceInvoiceItem`.`FinanceInvoice`=`FinanceInvoice`.`Id`) * `FinanceInvoiceGroup`.`ValueSign`) AS `Sum`,`FinanceInvoice`.`Value` FROM `FinanceInvoice` LEFT JOIN `FinanceInvoiceGroup` ON `FinanceInvoiceGroup`.`Id`=`FinanceInvoice`.`Group`) AS `T` WHERE `Sum` != `Value` 1509 } 1491 1510 1492 1511 class Updates … … 1557 1576 735 => array('Revision' => 736, 'Function' => 'UpdateTo736'), 1558 1577 736 => array('Revision' => 739, 'Function' => 'UpdateTo739'), 1559 1578 739 => array('Revision' => 740, 'Function' => 'UpdateTo740'), 1560 1579 740 => array('Revision' => 741, 'Function' => 'UpdateTo741'), 1561 1580 741 => array('Revision' => 742, 'Function' => 'UpdateTo742'), 1581 742 => array('Revision' => 748, 'Function' => 'UpdateTo748'), 1562 1582 )); 1563 1583 }
Note:
See TracChangeset
for help on using the changeset viewer.