This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 2011-07-02 08:02:07
|
Revision: 4612 http://web-erp.svn.sourceforge.net/web-erp/?rev=4612&view=rev Author: daintree Date: 2011-07-02 08:02:01 +0000 (Sat, 02 Jul 2011) Log Message: ----------- use mb_strlen for multibyte string length tests as now using UTF-8 throughout Modified Paths: -------------- trunk/includes/LanguageSetup.php Modified: trunk/includes/LanguageSetup.php =================================================================== --- trunk/includes/LanguageSetup.php 2011-07-02 01:35:11 UTC (rev 4611) +++ trunk/includes/LanguageSetup.php 2011-07-02 08:02:01 UTC (rev 4612) @@ -2,6 +2,9 @@ /* $Id$ */ +/* Set internal character encoding to UTF-8 */ +mb_internal_encoding('UTF-8'); + /* This file is included in session.inc or PDFStarter.php or a report script that does not use PDFStarter.php to check for the existance of gettext function and setup the necessary enviroment to allow for automatic translation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-07-02 01:35:17
|
Revision: 4611 http://web-erp.svn.sourceforge.net/web-erp/?rev=4611&view=rev Author: daintree Date: 2011-07-02 01:35:11 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Modified Paths: -------------- trunk/sql/mysql/upgrade3.11-3.11.1.sql Modified: trunk/sql/mysql/upgrade3.11-3.11.1.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:34:04 UTC (rev 4610) +++ trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:35:11 UTC (rev 4611) @@ -1,4 +1,3 @@ -USE saveurpacific; SET FOREIGN_KEY_CHECKS=0; ALTER TABLE accountgroups ADD CONSTRAINT `accountgroups_ibfk_1` FOREIGN KEY (`sectioninaccounts`) REFERENCES `accountsection` (`sectionid`); ALTER TABLE audittrail ADD CONSTRAINT `audittrail_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `www_users` (`userid`); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-07-02 01:35:17
|
Revision: 4611 http://web-erp.svn.sourceforge.net/web-erp/?rev=4611&view=rev Author: daintree Date: 2011-07-02 01:35:11 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Modified Paths: -------------- trunk/sql/mysql/upgrade3.11-3.11.1.sql Modified: trunk/sql/mysql/upgrade3.11-3.11.1.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:34:04 UTC (rev 4610) +++ trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:35:11 UTC (rev 4611) @@ -1,4 +1,3 @@ -USE saveurpacific; SET FOREIGN_KEY_CHECKS=0; ALTER TABLE accountgroups ADD CONSTRAINT `accountgroups_ibfk_1` FOREIGN KEY (`sectioninaccounts`) REFERENCES `accountsection` (`sectionid`); ALTER TABLE audittrail ADD CONSTRAINT `audittrail_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `www_users` (`userid`); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-07-02 01:34:11
|
Revision: 4610 http://web-erp.svn.sourceforge.net/web-erp/?rev=4610&view=rev Author: daintree Date: 2011-07-02 01:34:04 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Modified Paths: -------------- trunk/BankAccounts.php trunk/MRP.php trunk/PrintCustTrans.php trunk/doc/Change.log trunk/sql/mysql/upgrade3.11-3.11.1.sql Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/BankAccounts.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -9,7 +9,7 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Bank') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br />'; +echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "Currency Default" of "Fallback Default" to print Account details on Invoices (only one account should be set to "Fall Back Default").') . '.</div><br />'; if (isset($_GET['SelectedBankAccount'])) { $SelectedBankAccount=$_GET['SelectedBankAccount']; @@ -133,6 +133,7 @@ echo '<br />'; unset($_POST['AccountCode']); unset($_POST['BankAccountName']); + unset($_POST['BankAccountCode']); unset($_POST['BankAccountNumber']); unset($_POST['BankAddress']); unset($_POST['CurrCode']); @@ -207,8 +208,10 @@ } if ($myrow['invoice']==0) { $DefaultBankAccount=_('No'); - } else { - $DefaultBankAccount=_('Yes'); + } elseif ($myrow['invoice']==1) { + $DefaultBankAccount=_('Fall Back Default'); + } elseif ($myrow['invoice']==2) { + $DefaultBankAccount=_('Currency Default'); } printf('<td>%s<br /><font size=2>%s</font></td> <td>%s</td> @@ -363,15 +366,22 @@ $db); while ($myrow = DB_fetch_array($result)) { if ($myrow['invoice']== 1) { - echo '<option selected value="1">'._('Yes').'</option> + echo '<option selected value="1">'._('Fall Back Default').'</option> + <option value="2">'._('Currency Default') . '</option> <option value="0">'._('No').'</option>'; + } elseif ($myrow['invoice']== 2) { + echo '<option value="0">'._('No').'</option> + <option selected value="2">'._('Currency Default') . '</option> + <option value="1">'._('Fall Back Default').'</option>'; } else { echo '<option selected value="0">'._('No').'</option> - <option value="1">'._('Yes').'</option>'; + <option value="2">'._('Currency Default') . '</option> + <option value="1">'._('Fall Back Default').'</option>'; } }//end while loop } else { - echo '<option value="1">'._('Yes').'</option> + echo '<option value="1">'._('Fall Back Default').'</option> + <option value="2">'._('Currency Default') . '</option> <option value="0">'._('No').'</option>'; } Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/MRP.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -45,7 +45,8 @@ $sql = "INSERT INTO passbom (part, sortpart) SELECT bom.component AS part, CONCAT(bom.parent,'%',bom.component) AS sortpart - FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component + FROM bom LEFT JOIN bom as bom2 + ON bom.parent = bom2.component WHERE bom2.component IS NULL"; $result = DB_query($sql,$db); @@ -116,11 +117,11 @@ $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)) { $parts = explode('%',$myrow['sortpart']); - $level = $myrow['level']; + $Level = $myrow['level']; $ctr = 0; foreach ($parts as $part) { $ctr++; - $newlevel = $level - $ctr; + $newlevel = $Level - $ctr; $sql = "INSERT INTO bomlevels (part, level) VALUES('" . $part . "','" . $newlevel . "')"; $result2 = DB_query($sql,$db); } // End of foreach @@ -223,7 +224,9 @@ mrpdemandtype varchar(6), orderno int(11), directdemand smallint, - whererequired char(20)) DEFAULT CHARSET=utf8"; + whererequired char(20), + KEY part (part) + ) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrprequirements failed because')); prnMsg(_('Loading requirements from sales orders'),'info'); @@ -314,7 +317,6 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock @@ -398,7 +400,7 @@ FROM locstock WHERE quantity > 0 " . $WhereLocation . - 'GROUP BY stockid'; + "GROUP BY stockid"; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from work orders'),'info'); @@ -434,14 +436,14 @@ flush(); $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, - part char(20), - duedate date, - supplyquantity double, - ordertype varchar(6), - orderno int(11), - mrpdate date, - updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; + part char(20), + duedate date, + supplyquantity double, + ordertype varchar(6), + orderno int(11), + mrpdate date, + updateflag smallint(6), + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number @@ -449,8 +451,8 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - $maxlevel = $myrow[0]; - $minlevel = $myrow[1]; + $MaxLevel = $myrow[0]; + $MinLevel = $myrow[1]; // At this point, have all requirements in mrprequirements and all supplies to satisfy // those requirements in mrpsupplies. Starting at the top level, will read all parts one @@ -458,17 +460,17 @@ // planned orders to satisfy requirements. If there is a net requirement from a higher level // part, that serves as a gross requirement for a lower level part, so will read down through // the Bill of Materials to generate those requirements in function LevelNetting(). - for ($level = $maxlevel; $level >= $minlevel; $level--) { - $sql = "SELECT * FROM levels WHERE level = '" . $level ."' LIMIT 50000"; //should cover most eventualities!! ... yes indeed :-) + for ($Level = $MaxLevel; $Level >= $MinLevel; $Level--) { + $sql = "SELECT * FROM levels WHERE level = '" . $Level ."' LIMIT 50000"; //should cover most eventualities!! ... yes indeed :-) - prnMsg('</br>------ ' . _('Processing level') .' ' . $level . ' ------','info'); + prnMsg('------ ' . _('Processing level') .' ' . $Level . ' ------','info'); flush(); $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)) { LevelNetting($db,$myrow['part'],$myrow['eoq'],$myrow['pansize'],$myrow['shrinkfactor']); } //end of while loop } // end of for - echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; + echo '<br />' . _('End time') . ': ' . date('h:i:s') . '<br />'; // Create mrpparameters table $sql = "DROP TABLE IF EXISTS mrpparameters"; Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/PrintCustTrans.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -80,121 +80,121 @@ if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, - debtortrans.ovamount, - debtortrans.ovdiscount, - debtortrans.ovfreight, - debtortrans.ovgst, - debtortrans.rate, - debtortrans.invtext, - debtortrans.consignment, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.currcode, - debtorsmaster.invaddrbranch, - debtorsmaster.taxref, - paymentterms.terms, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.customerref, - salesorders.orderno, - salesorders.orddate, - locations.locationname, - shippers.shippername, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.brpostaddr1, - custbranch.brpostaddr2, - custbranch.brpostaddr3, - custbranch.brpostaddr4, - custbranch.brpostaddr5, - custbranch.brpostaddr6, - salesman.salesmanname, - debtortrans.debtorno, - debtortrans.branchcode - FROM debtortrans, - debtorsmaster, - custbranch, - salesorders, - shippers, - salesman, - locations, - paymentterms - WHERE debtortrans.order_ = salesorders.orderno - AND debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "' - AND debtortrans.shipvia=shippers.shipper_id - AND debtortrans.debtorno=debtorsmaster.debtorno - AND debtorsmaster.paymentterms=paymentterms.termsindicator - AND debtortrans.debtorno=custbranch.debtorno - AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode - AND salesorders.fromstkloc=locations.loccode"; + debtortrans.ovamount, + debtortrans.ovdiscount, + debtortrans.ovfreight, + debtortrans.ovgst, + debtortrans.rate, + debtortrans.invtext, + debtortrans.consignment, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.currcode, + debtorsmaster.invaddrbranch, + debtorsmaster.taxref, + paymentterms.terms, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.customerref, + salesorders.orderno, + salesorders.orddate, + locations.locationname, + shippers.shippername, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.brpostaddr1, + custbranch.brpostaddr2, + custbranch.brpostaddr3, + custbranch.brpostaddr4, + custbranch.brpostaddr5, + custbranch.brpostaddr6, + salesman.salesmanname, + debtortrans.debtorno, + debtortrans.branchcode + FROM debtortrans, + debtorsmaster, + custbranch, + salesorders, + shippers, + salesman, + locations, + paymentterms + WHERE debtortrans.order_ = salesorders.orderno + AND debtortrans.type=10 + AND debtortrans.transno='" . $FromTransNo . "' + AND debtortrans.shipvia=shippers.shipper_id + AND debtortrans.debtorno=debtorsmaster.debtorno + AND debtorsmaster.paymentterms=paymentterms.termsindicator + AND debtortrans.debtorno=custbranch.debtorno + AND debtortrans.branchcode=custbranch.branchcode + AND custbranch.salesman=salesman.salesmancode + AND salesorders.fromstkloc=locations.loccode"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { $sql = "SELECT debtortrans.trandate, - debtortrans.ovamount, - debtortrans.ovdiscount, - debtortrans.ovfreight, - debtortrans.ovgst, - debtortrans.rate, - debtortrans.invtext, - debtorsmaster.invaddrbranch, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.currcode, - debtorsmaster.taxref, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.brpostaddr1, - custbranch.brpostaddr2, - custbranch.brpostaddr3, - custbranch.brpostaddr4, - custbranch.brpostaddr5, - custbranch.brpostaddr6, - salesman.salesmanname, - debtortrans.debtorno, - debtortrans.branchcode, - paymentterms.terms - FROM debtortrans, - debtorsmaster, - custbranch, - salesman, - paymentterms - WHERE debtortrans.type=11 - AND debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtortrans.transno='" . $FromTransNo . "' - AND debtortrans.debtorno=debtorsmaster.debtorno - AND debtortrans.debtorno=custbranch.debtorno - AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode"; + debtortrans.ovamount, + debtortrans.ovdiscount, + debtortrans.ovfreight, + debtortrans.ovgst, + debtortrans.rate, + debtortrans.invtext, + debtorsmaster.invaddrbranch, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.currcode, + debtorsmaster.taxref, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.brpostaddr1, + custbranch.brpostaddr2, + custbranch.brpostaddr3, + custbranch.brpostaddr4, + custbranch.brpostaddr5, + custbranch.brpostaddr6, + salesman.salesmanname, + debtortrans.debtorno, + debtortrans.branchcode, + paymentterms.terms + FROM debtortrans, + debtorsmaster, + custbranch, + salesman, + paymentterms + WHERE debtortrans.type=11 + AND debtorsmaster.paymentterms = paymentterms.termsindicator + AND debtortrans.transno='" . $FromTransNo . "' + AND debtortrans.debtorno=debtorsmaster.debtorno + AND debtortrans.debtorno=custbranch.debtorno + AND debtortrans.branchcode=custbranch.branchcode + AND custbranch.salesman=salesman.salesmancode"; if ($_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; @@ -219,35 +219,35 @@ if ($InvOrCredit=='Invoice') { $sql = "SELECT stockmoves.stockid, - stockmaster.description, - -stockmoves.qty as quantity, - stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, - stockmoves.narrative, - stockmaster.units - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=10 - AND stockmoves.transno=" . $FromTransNo . " - AND stockmoves.show_on_inv_crds=1"; + stockmaster.description, + -stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=10 + AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, - stockmaster.description, - stockmoves.qty as quantity, - stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, - stockmoves.narrative, - stockmaster.units - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=11 - AND stockmoves.transno=" . $FromTransNo . " - AND stockmoves.show_on_inv_crds=1"; + stockmaster.description, + stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=11 + AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.show_on_inv_crds=1"; } // end else $result=DB_query($sql,$db); @@ -407,6 +407,36 @@ $YPos-=12; $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); } + /*print out bank details */ + /*Get currency default for the currency of the invocie */ + $PrintBankDetails = true; //assume we print bank details by default + $BankResult = DB_query("SELECT bankaddress, + bankaccountnumber, + bankaccountcode + FROM bankaccounts + WHERE invoice=2 + AND currcode='" . $myrow['currcode'] . "'", + $db); + if (DB_num_rows($BankResult)==0){ + /* If no currency default check the fall back default */ + $BankResult = DB_query("SELECT bankaddress, + bankaccountnumber, + bankaccountcode + FROM bankaccounts + WHERE invoice=1", + $db); + if (DB_num_rows($BankResult)==0){ + $PrintBankDetails = false; + } + } + if ($PrintBankDetails){ + $BankDetailsRow = DB_fetch_array($BankResult); + $YPos-=4; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaddress']); + $YPos-=12; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaccountcode'] . ' ' . _('Account No:') . ' ' . $BankDetailsRow['bankaccountnumber']); + } + /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/doc/Change.log 2011-07-02 01:34:04 UTC (rev 4610) @@ -1,5 +1,6 @@ webERP Change Log +29/6/11 Phil: Bank account to allow default for invoice in currency and also a fall back default to show on invoice where no default for the currency. Modified BankAccounts.php and PrintCustTrans.php (Landscape only) to show the pertinent bank account given the currency of the invoice 28/6/11 Phil: Make assembly items explode into components on packing slips PrintCustOrder_generic.php 28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing 27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture Modified: trunk/sql/mysql/upgrade3.11-3.11.1.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:34:04 UTC (rev 4610) @@ -1,3 +1,4 @@ +USE saveurpacific; SET FOREIGN_KEY_CHECKS=0; ALTER TABLE accountgroups ADD CONSTRAINT `accountgroups_ibfk_1` FOREIGN KEY (`sectioninaccounts`) REFERENCES `accountsection` (`sectionid`); ALTER TABLE audittrail ADD CONSTRAINT `audittrail_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `www_users` (`userid`); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-07-02 01:34:10
|
Revision: 4610 http://web-erp.svn.sourceforge.net/web-erp/?rev=4610&view=rev Author: daintree Date: 2011-07-02 01:34:04 +0000 (Sat, 02 Jul 2011) Log Message: ----------- Modified Paths: -------------- trunk/BankAccounts.php trunk/MRP.php trunk/PrintCustTrans.php trunk/doc/Change.log trunk/sql/mysql/upgrade3.11-3.11.1.sql Modified: trunk/BankAccounts.php =================================================================== --- trunk/BankAccounts.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/BankAccounts.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -9,7 +9,7 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Bank') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "yes" to print Account details on Invoices (only one account can be set to "yes").') . '.</div><br />'; +echo '<div class="page_help_text">' . _('Update Bank Account details. Account Code is for SWIFT or BSB type Bank Codes. Set Default for Invoices to "Currency Default" of "Fallback Default" to print Account details on Invoices (only one account should be set to "Fall Back Default").') . '.</div><br />'; if (isset($_GET['SelectedBankAccount'])) { $SelectedBankAccount=$_GET['SelectedBankAccount']; @@ -133,6 +133,7 @@ echo '<br />'; unset($_POST['AccountCode']); unset($_POST['BankAccountName']); + unset($_POST['BankAccountCode']); unset($_POST['BankAccountNumber']); unset($_POST['BankAddress']); unset($_POST['CurrCode']); @@ -207,8 +208,10 @@ } if ($myrow['invoice']==0) { $DefaultBankAccount=_('No'); - } else { - $DefaultBankAccount=_('Yes'); + } elseif ($myrow['invoice']==1) { + $DefaultBankAccount=_('Fall Back Default'); + } elseif ($myrow['invoice']==2) { + $DefaultBankAccount=_('Currency Default'); } printf('<td>%s<br /><font size=2>%s</font></td> <td>%s</td> @@ -363,15 +366,22 @@ $db); while ($myrow = DB_fetch_array($result)) { if ($myrow['invoice']== 1) { - echo '<option selected value="1">'._('Yes').'</option> + echo '<option selected value="1">'._('Fall Back Default').'</option> + <option value="2">'._('Currency Default') . '</option> <option value="0">'._('No').'</option>'; + } elseif ($myrow['invoice']== 2) { + echo '<option value="0">'._('No').'</option> + <option selected value="2">'._('Currency Default') . '</option> + <option value="1">'._('Fall Back Default').'</option>'; } else { echo '<option selected value="0">'._('No').'</option> - <option value="1">'._('Yes').'</option>'; + <option value="2">'._('Currency Default') . '</option> + <option value="1">'._('Fall Back Default').'</option>'; } }//end while loop } else { - echo '<option value="1">'._('Yes').'</option> + echo '<option value="1">'._('Fall Back Default').'</option> + <option value="2">'._('Currency Default') . '</option> <option value="0">'._('No').'</option>'; } Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/MRP.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -45,7 +45,8 @@ $sql = "INSERT INTO passbom (part, sortpart) SELECT bom.component AS part, CONCAT(bom.parent,'%',bom.component) AS sortpart - FROM bom LEFT JOIN bom as bom2 ON bom.parent = bom2.component + FROM bom LEFT JOIN bom as bom2 + ON bom.parent = bom2.component WHERE bom2.component IS NULL"; $result = DB_query($sql,$db); @@ -116,11 +117,11 @@ $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)) { $parts = explode('%',$myrow['sortpart']); - $level = $myrow['level']; + $Level = $myrow['level']; $ctr = 0; foreach ($parts as $part) { $ctr++; - $newlevel = $level - $ctr; + $newlevel = $Level - $ctr; $sql = "INSERT INTO bomlevels (part, level) VALUES('" . $part . "','" . $newlevel . "')"; $result2 = DB_query($sql,$db); } // End of foreach @@ -223,7 +224,9 @@ mrpdemandtype varchar(6), orderno int(11), directdemand smallint, - whererequired char(20)) DEFAULT CHARSET=utf8"; + whererequired char(20), + KEY part (part) + ) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrprequirements failed because')); prnMsg(_('Loading requirements from sales orders'),'info'); @@ -314,7 +317,6 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock @@ -398,7 +400,7 @@ FROM locstock WHERE quantity > 0 " . $WhereLocation . - 'GROUP BY stockid'; + "GROUP BY stockid"; $result = DB_query($sql,$db); prnMsg(_('Loading supplies from work orders'),'info'); @@ -434,14 +436,14 @@ flush(); $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, - part char(20), - duedate date, - supplyquantity double, - ordertype varchar(6), - orderno int(11), - mrpdate date, - updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; + part char(20), + duedate date, + supplyquantity double, + ordertype varchar(6), + orderno int(11), + mrpdate date, + updateflag smallint(6), + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number @@ -449,8 +451,8 @@ $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - $maxlevel = $myrow[0]; - $minlevel = $myrow[1]; + $MaxLevel = $myrow[0]; + $MinLevel = $myrow[1]; // At this point, have all requirements in mrprequirements and all supplies to satisfy // those requirements in mrpsupplies. Starting at the top level, will read all parts one @@ -458,17 +460,17 @@ // planned orders to satisfy requirements. If there is a net requirement from a higher level // part, that serves as a gross requirement for a lower level part, so will read down through // the Bill of Materials to generate those requirements in function LevelNetting(). - for ($level = $maxlevel; $level >= $minlevel; $level--) { - $sql = "SELECT * FROM levels WHERE level = '" . $level ."' LIMIT 50000"; //should cover most eventualities!! ... yes indeed :-) + for ($Level = $MaxLevel; $Level >= $MinLevel; $Level--) { + $sql = "SELECT * FROM levels WHERE level = '" . $Level ."' LIMIT 50000"; //should cover most eventualities!! ... yes indeed :-) - prnMsg('</br>------ ' . _('Processing level') .' ' . $level . ' ------','info'); + prnMsg('------ ' . _('Processing level') .' ' . $Level . ' ------','info'); flush(); $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)) { LevelNetting($db,$myrow['part'],$myrow['eoq'],$myrow['pansize'],$myrow['shrinkfactor']); } //end of while loop } // end of for - echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; + echo '<br />' . _('End time') . ': ' . date('h:i:s') . '<br />'; // Create mrpparameters table $sql = "DROP TABLE IF EXISTS mrpparameters"; Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/PrintCustTrans.php 2011-07-02 01:34:04 UTC (rev 4610) @@ -80,121 +80,121 @@ if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, - debtortrans.ovamount, - debtortrans.ovdiscount, - debtortrans.ovfreight, - debtortrans.ovgst, - debtortrans.rate, - debtortrans.invtext, - debtortrans.consignment, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.currcode, - debtorsmaster.invaddrbranch, - debtorsmaster.taxref, - paymentterms.terms, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.customerref, - salesorders.orderno, - salesorders.orddate, - locations.locationname, - shippers.shippername, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.brpostaddr1, - custbranch.brpostaddr2, - custbranch.brpostaddr3, - custbranch.brpostaddr4, - custbranch.brpostaddr5, - custbranch.brpostaddr6, - salesman.salesmanname, - debtortrans.debtorno, - debtortrans.branchcode - FROM debtortrans, - debtorsmaster, - custbranch, - salesorders, - shippers, - salesman, - locations, - paymentterms - WHERE debtortrans.order_ = salesorders.orderno - AND debtortrans.type=10 - AND debtortrans.transno='" . $FromTransNo . "' - AND debtortrans.shipvia=shippers.shipper_id - AND debtortrans.debtorno=debtorsmaster.debtorno - AND debtorsmaster.paymentterms=paymentterms.termsindicator - AND debtortrans.debtorno=custbranch.debtorno - AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode - AND salesorders.fromstkloc=locations.loccode"; + debtortrans.ovamount, + debtortrans.ovdiscount, + debtortrans.ovfreight, + debtortrans.ovgst, + debtortrans.rate, + debtortrans.invtext, + debtortrans.consignment, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.currcode, + debtorsmaster.invaddrbranch, + debtorsmaster.taxref, + paymentterms.terms, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.customerref, + salesorders.orderno, + salesorders.orddate, + locations.locationname, + shippers.shippername, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.brpostaddr1, + custbranch.brpostaddr2, + custbranch.brpostaddr3, + custbranch.brpostaddr4, + custbranch.brpostaddr5, + custbranch.brpostaddr6, + salesman.salesmanname, + debtortrans.debtorno, + debtortrans.branchcode + FROM debtortrans, + debtorsmaster, + custbranch, + salesorders, + shippers, + salesman, + locations, + paymentterms + WHERE debtortrans.order_ = salesorders.orderno + AND debtortrans.type=10 + AND debtortrans.transno='" . $FromTransNo . "' + AND debtortrans.shipvia=shippers.shipper_id + AND debtortrans.debtorno=debtorsmaster.debtorno + AND debtorsmaster.paymentterms=paymentterms.termsindicator + AND debtortrans.debtorno=custbranch.debtorno + AND debtortrans.branchcode=custbranch.branchcode + AND custbranch.salesman=salesman.salesmancode + AND salesorders.fromstkloc=locations.loccode"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { $sql = "SELECT debtortrans.trandate, - debtortrans.ovamount, - debtortrans.ovdiscount, - debtortrans.ovfreight, - debtortrans.ovgst, - debtortrans.rate, - debtortrans.invtext, - debtorsmaster.invaddrbranch, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.currcode, - debtorsmaster.taxref, - custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.brpostaddr1, - custbranch.brpostaddr2, - custbranch.brpostaddr3, - custbranch.brpostaddr4, - custbranch.brpostaddr5, - custbranch.brpostaddr6, - salesman.salesmanname, - debtortrans.debtorno, - debtortrans.branchcode, - paymentterms.terms - FROM debtortrans, - debtorsmaster, - custbranch, - salesman, - paymentterms - WHERE debtortrans.type=11 - AND debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtortrans.transno='" . $FromTransNo . "' - AND debtortrans.debtorno=debtorsmaster.debtorno - AND debtortrans.debtorno=custbranch.debtorno - AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode"; + debtortrans.ovamount, + debtortrans.ovdiscount, + debtortrans.ovfreight, + debtortrans.ovgst, + debtortrans.rate, + debtortrans.invtext, + debtorsmaster.invaddrbranch, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.currcode, + debtorsmaster.taxref, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.brpostaddr1, + custbranch.brpostaddr2, + custbranch.brpostaddr3, + custbranch.brpostaddr4, + custbranch.brpostaddr5, + custbranch.brpostaddr6, + salesman.salesmanname, + debtortrans.debtorno, + debtortrans.branchcode, + paymentterms.terms + FROM debtortrans, + debtorsmaster, + custbranch, + salesman, + paymentterms + WHERE debtortrans.type=11 + AND debtorsmaster.paymentterms = paymentterms.termsindicator + AND debtortrans.transno='" . $FromTransNo . "' + AND debtortrans.debtorno=debtorsmaster.debtorno + AND debtortrans.debtorno=custbranch.debtorno + AND debtortrans.branchcode=custbranch.branchcode + AND custbranch.salesman=salesman.salesmancode"; if ($_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; @@ -219,35 +219,35 @@ if ($InvOrCredit=='Invoice') { $sql = "SELECT stockmoves.stockid, - stockmaster.description, - -stockmoves.qty as quantity, - stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, - stockmoves.narrative, - stockmaster.units - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=10 - AND stockmoves.transno=" . $FromTransNo . " - AND stockmoves.show_on_inv_crds=1"; + stockmaster.description, + -stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=10 + AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, - stockmaster.description, - stockmoves.qty as quantity, - stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, - stockmoves.narrative, - stockmaster.units - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=11 - AND stockmoves.transno=" . $FromTransNo . " - AND stockmoves.show_on_inv_crds=1"; + stockmaster.description, + stockmoves.qty as quantity, + stockmoves.discountpercent, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.narrative, + stockmaster.units + FROM stockmoves, + stockmaster + WHERE stockmoves.stockid = stockmaster.stockid + AND stockmoves.type=11 + AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.show_on_inv_crds=1"; } // end else $result=DB_query($sql,$db); @@ -407,6 +407,36 @@ $YPos-=12; $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); } + /*print out bank details */ + /*Get currency default for the currency of the invocie */ + $PrintBankDetails = true; //assume we print bank details by default + $BankResult = DB_query("SELECT bankaddress, + bankaccountnumber, + bankaccountcode + FROM bankaccounts + WHERE invoice=2 + AND currcode='" . $myrow['currcode'] . "'", + $db); + if (DB_num_rows($BankResult)==0){ + /* If no currency default check the fall back default */ + $BankResult = DB_query("SELECT bankaddress, + bankaccountnumber, + bankaccountcode + FROM bankaccounts + WHERE invoice=1", + $db); + if (DB_num_rows($BankResult)==0){ + $PrintBankDetails = false; + } + } + if ($PrintBankDetails){ + $BankDetailsRow = DB_fetch_array($BankResult); + $YPos-=4; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaddress']); + $YPos-=12; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaccountcode'] . ' ' . _('Account No:') . ' ' . $BankDetailsRow['bankaccountnumber']); + } + /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/doc/Change.log 2011-07-02 01:34:04 UTC (rev 4610) @@ -1,5 +1,6 @@ webERP Change Log +29/6/11 Phil: Bank account to allow default for invoice in currency and also a fall back default to show on invoice where no default for the currency. Modified BankAccounts.php and PrintCustTrans.php (Landscape only) to show the pertinent bank account given the currency of the invoice 28/6/11 Phil: Make assembly items explode into components on packing slips PrintCustOrder_generic.php 28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing 27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture Modified: trunk/sql/mysql/upgrade3.11-3.11.1.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-06-28 10:12:27 UTC (rev 4609) +++ trunk/sql/mysql/upgrade3.11-3.11.1.sql 2011-07-02 01:34:04 UTC (rev 4610) @@ -1,3 +1,4 @@ +USE saveurpacific; SET FOREIGN_KEY_CHECKS=0; ALTER TABLE accountgroups ADD CONSTRAINT `accountgroups_ibfk_1` FOREIGN KEY (`sectioninaccounts`) REFERENCES `accountsection` (`sectionid`); ALTER TABLE audittrail ADD CONSTRAINT `audittrail_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `www_users` (`userid`); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-28 10:12:34
|
Revision: 4609 http://web-erp.svn.sourceforge.net/web-erp/?rev=4609&view=rev Author: daintree Date: 2011-06-28 10:12:27 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Modified Paths: -------------- trunk/MRPDemands.php trunk/PrintCustOrder_generic.php trunk/doc/Change.log Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/MRPDemands.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -103,8 +103,9 @@ $k++; } $tabindex=$j+4; - echo "<td><input tabindex='".$tabindex."' type=submit name='StockID' value='".$myrow['stockid']."'</td> - <td>".$myrow['description']."</td></tr>"; + echo '<td><input tabindex="' . $tabindex . '" type=submit name="StockID" value="' . $myrow['stockid'] .'"</td> + <td>' . $myrow['description'] . '</td> + </tr>'; $j++; } //end of while loop @@ -212,7 +213,7 @@ $result = DB_query($sql,$db,_('The update/addition of the MRP demand record failed because')); prnMsg($msg,'success'); - echo '<br>'; + echo '<br />'; unset ($_POST['MRPDemandtype']); unset ($_POST['Quantity']); unset ($_POST['StockID']); @@ -225,7 +226,7 @@ } // End of function submit() -function delete(&$db,$DemandID,$demandtype,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### +function delete(&$db,$DemandID,$DemandType,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### // If wanted to have a Confirm routine before did actually deletion, could check if // deletion = "yes"; if it did, display link that redirects back to this page @@ -234,8 +235,8 @@ // This deletes an individual record by DemandID if called from a listall that shows // edit/delete or deletes all of a particular demand type if press Delete Demand Type button. $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($DemandID) { $where = " WHERE demandid ='" . $DemandID . "'"; @@ -246,7 +247,7 @@ if ($DemandID) { prnMsg(_('The MRP demand record for') .' '. $StockID .' '. _('has been deleted'),'succes'); } else { - prnMsg(_('All records for demand type') .' '. $demandtype .' ' . _('have been deleted'),'succes'); + prnMsg(_('All records for demand type') .' '. $DemandType .' ' . _('have been deleted'),'succes'); } unset ($DemandID); unset ($StockID); @@ -255,7 +256,7 @@ } // End of function delete() -function listall(&$db,$part,$demandtype) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### +function listall(&$db,$part,$DemandType) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### // List all mrpdemands records, with anchors to Edit or Delete records if hit List All anchor // Lists some in hit List Selection submit button, and uses part number if it is entered or @@ -264,33 +265,34 @@ echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($part) { $where = " WHERE mrpdemands.stockid ='" . $part . "'"; } // If part is entered, it overrides demandtype - $sql = 'SELECT mrpdemands.demandid, + $sql = "SELECT mrpdemands.demandid, mrpdemands.stockid, mrpdemands.mrpdemandtype, mrpdemands.quantity, mrpdemands.duedate, stockmaster.description - FROM mrpdemands - LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid' . - $where . ' ORDER BY mrpdemands.stockid, mrpdemands.duedate'; - //echo "<br/>sql is $sql<br/>"; + FROM mrpdemands + LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid" . + $where . " ORDER BY mrpdemands.stockid, mrpdemands.duedate"; + $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> - <tr bgcolor =#800000><th>" . _('Part Number') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Demand Type') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Due Date') . "</th> - </tr>"; + echo '<table class="selection"> + <tr bgcolor =#800000> + <th>' . _('Part Number') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Demand Type') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Due Date') . '</th> + </tr>'; $ctr = 0; while ($myrow = DB_fetch_row($result)) { $displaydate = ConvertSQLDate($myrow[4]); @@ -300,8 +302,8 @@ <td>' . $myrow[2] . '</td> <td>' . $myrow[3] . '</td> <td>' . $displaydate . '</td> - <td><a href="' .$_SERVER['PHP_SELF'] .'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . 'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes">' . _('Delete') .'</td> + <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> </tr>'; } @@ -378,15 +380,21 @@ $_POST['Duedate']=' '; } - echo '<tr><td>' . _('Quantity') . ":</td><td><input type='Text' name='Quantity' class=number size=6 - maxlength=6 value=" . $_POST['Quantity'] . '></td></tr><tr><td>' . _('Due Date') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='Duedate' size=12 - maxlength=12 value=" . $_POST['Duedate'] . '></td></tr>'; + echo '<tr><td>' . _('Quantity') . ':</td> + <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value=' . $_POST['Quantity'] . '></td> + </tr> + <tr> + <td>' . _('Due Date') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '"></td> + </tr>'; // Generate selections for Demand Type - echo '<tr><td>' . _('Demand Type') . "</td><td><select name='MRPDemandtype'>"; - $sql = 'SELECT mrpdemandtype, + echo '<tr> + <td>' . _('Demand Type') . '</td> + <td><select name="MRPDemandtype">'; + + $sql = "SELECT mrpdemandtype, description - FROM mrpdemandtypes'; + FROM mrpdemandtypes"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['MRPDemandtype']) and $myrow['mrpdemandtype']==$_POST['MRPDemandtype']) { @@ -399,18 +407,18 @@ echo '</select></td></tr>'; echo '</table>'; - echo '<br><div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; + echo '<br /> + <div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; echo '<input type="submit" name="listsome" value="' . _('List Selection') . '">  '; - echo '<input type="Submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; + echo '<input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; // If mrpdemand record exists, display option to delete it if ((isset($DemandID)) AND (DB_num_rows($result) > 0)) { - echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?&delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '">' . _('Or Delete Record') ; + echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Or Delete Record') ; } } echo '</form>'; } // End of function display() - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/PrintCustOrder_generic.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -2,7 +2,6 @@ /* $Id$*/ -/* $Revision: 1.20 $ */ include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -10,16 +9,27 @@ //Get Out if we have no order number to work with If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ - $title = _('Select Order To Print'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Select Order To Print'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + include('includes/footer.inc'); + exit(); } /*retrieve the order details from the database to print */ @@ -27,50 +37,62 @@ $sql = "SELECT salesorders.debtorno, salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - shippers.shippername, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - locations.locationname - FROM salesorders, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo'] . "'"; - + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.locationname + FROM salesorders, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; + $result=DB_query($sql,$db, $ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + + include('includes/footer.inc'); + exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ $myrow = DB_fetch_array($result); @@ -90,10 +112,18 @@ echo '<br /><br /><br />'; echo _('Or select another Order Number to Print'); - echo '<table class="table_index"><tr><td class="menu_group_item"> + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; @@ -102,9 +132,9 @@ /*retrieve the order details from the database to print */ -/* Then there's an order to print and its not been printed already (or its been flagged for reprinting/ge_Width=807; -) +/* Then there's an order to print and its not been printed already (or its been flagged for reprinting) LETS GO */ + $PaperSize = 'A4_Landscape'; include('includes/PDFStarter.php'); //$pdf->selectFont('./fonts/Helvetica.afm'); @@ -119,22 +149,24 @@ for ($i=1;$i<=2;$i++){ /*Print it out twice one copy for customer and one for office */ if ($i==2){ - $PageNumber = 1; + $PageNumber = 1; $pdf->newPage(); } /* Now ... Has the order got any line items still outstanding to be invoiced */ - $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . + $ErrMsg = _('There was a problem retrieving the order details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -144,26 +176,56 @@ while ($myrow2=DB_fetch_array($result)){ $ListCount ++; + + $DisplayQty = number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $DisplayQty = number_format($myrow2['quantity'],2); - $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2); - $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$myrow2['description']); $LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize,$DisplayQty,'right'); $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); $LeftOvers = $pdf->addTextWrap(602,$YPos,85,$FontSize,$DisplayPrevDel,'right'); - + if ($YPos-$line_height <= 50){ /* We reached the end of the page so finsih off the page and start a newy */ $PageNumber++; include ('includes/PDFOrderPageHeader_generic.inc'); } //end if need a new page headed up - else{ + else { /*increment a line down for the next line item */ $YPos -= ($line_height); } + if ($myrow2['mbflag']=='A'){ + /*Then its an assembly item - need to explode into it's components for packing list purposes */ + $sql = "SELECT bom.component, + bom.quantity, + stockmaster.description, + stockmaster.decimalplaces + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $myrow2['stkcode'] . "'"; + $ErrMsg = _('Could not retrieve the components of the ordered assembly item'); + $AssemblyResult = DB_query($sql,$db,$ErrMsg); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,150,$FontSize, _('Assembly Components:-')); + $YPos -= ($line_height); + /*Loop around all the components of the assembly and list the quantity supplied */ + while ($ComponentRow=DB_fetch_array($AssemblyResult)){ + $DisplayQtySupplied = number_format($ComponentRow['quantity']*($myrow2['quantity'] - $myrow2['qtyinvoiced']),$ComponentRow['decimalplaces']); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$ComponentRow['component']); + $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$ComponentRow['description']); + $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); + if ($YPos-$line_height <= 50){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include ('includes/PDFOrderPageHeader_generic.inc'); + } //end if need a new page headed up + else{ + /*increment a line down for the next line item */ + $YPos -= ($line_height); + } + } //loop around all the components of the assembly + } } //end while there are line items to print out } /*end if there are order details to show on the order*/ @@ -172,18 +234,21 @@ } /*end for loop to print the whole lot twice */ -if ($ListCount == 0) { //UldisN - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); +if ($ListCount == 0) { + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). + '</a> + <br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/doc/Change.log 2011-06-28 10:12:27 UTC (rev 4609) @@ -1,6 +1,8 @@ webERP Change Log -27/6/11 Exson: MRP>php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture +28/6/11 Phil: Make assembly items explode into components on packing slips PrintCustOrder_generic.php +28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing +27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost 26/6/11 Phil: Went back to no number_formatting on PurchData.php 26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-28 10:12:34
|
Revision: 4609 http://web-erp.svn.sourceforge.net/web-erp/?rev=4609&view=rev Author: daintree Date: 2011-06-28 10:12:27 +0000 (Tue, 28 Jun 2011) Log Message: ----------- Modified Paths: -------------- trunk/MRPDemands.php trunk/PrintCustOrder_generic.php trunk/doc/Change.log Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/MRPDemands.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -103,8 +103,9 @@ $k++; } $tabindex=$j+4; - echo "<td><input tabindex='".$tabindex."' type=submit name='StockID' value='".$myrow['stockid']."'</td> - <td>".$myrow['description']."</td></tr>"; + echo '<td><input tabindex="' . $tabindex . '" type=submit name="StockID" value="' . $myrow['stockid'] .'"</td> + <td>' . $myrow['description'] . '</td> + </tr>'; $j++; } //end of while loop @@ -212,7 +213,7 @@ $result = DB_query($sql,$db,_('The update/addition of the MRP demand record failed because')); prnMsg($msg,'success'); - echo '<br>'; + echo '<br />'; unset ($_POST['MRPDemandtype']); unset ($_POST['Quantity']); unset ($_POST['StockID']); @@ -225,7 +226,7 @@ } // End of function submit() -function delete(&$db,$DemandID,$demandtype,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### +function delete(&$db,$DemandID,$DemandType,$StockID) { //####DELETE_DELETE_DELETE_DELETE_DELETE_DELETE_#### // If wanted to have a Confirm routine before did actually deletion, could check if // deletion = "yes"; if it did, display link that redirects back to this page @@ -234,8 +235,8 @@ // This deletes an individual record by DemandID if called from a listall that shows // edit/delete or deletes all of a particular demand type if press Delete Demand Type button. $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($DemandID) { $where = " WHERE demandid ='" . $DemandID . "'"; @@ -246,7 +247,7 @@ if ($DemandID) { prnMsg(_('The MRP demand record for') .' '. $StockID .' '. _('has been deleted'),'succes'); } else { - prnMsg(_('All records for demand type') .' '. $demandtype .' ' . _('have been deleted'),'succes'); + prnMsg(_('All records for demand type') .' '. $DemandType .' ' . _('have been deleted'),'succes'); } unset ($DemandID); unset ($StockID); @@ -255,7 +256,7 @@ } // End of function delete() -function listall(&$db,$part,$demandtype) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### +function listall(&$db,$part,$DemandType) {//####LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_LISTALL_#### // List all mrpdemands records, with anchors to Edit or Delete records if hit List All anchor // Lists some in hit List Selection submit button, and uses part number if it is entered or @@ -264,33 +265,34 @@ echo '<form action="' . $_SERVER['PHP_SELF'] .'" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; $where = " "; - if ($demandtype) { - $where = " WHERE mrpdemandtype ='" . $demandtype . "'"; + if ($DemandType) { + $where = " WHERE mrpdemandtype ='" . $DemandType . "'"; } if ($part) { $where = " WHERE mrpdemands.stockid ='" . $part . "'"; } // If part is entered, it overrides demandtype - $sql = 'SELECT mrpdemands.demandid, + $sql = "SELECT mrpdemands.demandid, mrpdemands.stockid, mrpdemands.mrpdemandtype, mrpdemands.quantity, mrpdemands.duedate, stockmaster.description - FROM mrpdemands - LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid' . - $where . ' ORDER BY mrpdemands.stockid, mrpdemands.duedate'; - //echo "<br/>sql is $sql<br/>"; + FROM mrpdemands + LEFT JOIN stockmaster on mrpdemands.stockid = stockmaster.stockid" . + $where . " ORDER BY mrpdemands.stockid, mrpdemands.duedate"; + $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> - <tr bgcolor =#800000><th>" . _('Part Number') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Demand Type') . "</th> - <th>" . _('Quantity') . "</th> - <th>" . _('Due Date') . "</th> - </tr>"; + echo '<table class="selection"> + <tr bgcolor =#800000> + <th>' . _('Part Number') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Demand Type') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Due Date') . '</th> + </tr>'; $ctr = 0; while ($myrow = DB_fetch_row($result)) { $displaydate = ConvertSQLDate($myrow[4]); @@ -300,8 +302,8 @@ <td>' . $myrow[2] . '</td> <td>' . $myrow[3] . '</td> <td>' . $displaydate . '</td> - <td><a href="' .$_SERVER['PHP_SELF'] .'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . 'DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes">' . _('Delete') .'</td> + <td><a href="' .$_SERVER['PHP_SELF'] .'?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1] . '">' . _('Edit') . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?DemandID=' . $myrow[0] . '&StockID=' . $myrow[1].'&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Delete') .'</td> </tr>'; } @@ -378,15 +380,21 @@ $_POST['Duedate']=' '; } - echo '<tr><td>' . _('Quantity') . ":</td><td><input type='Text' name='Quantity' class=number size=6 - maxlength=6 value=" . $_POST['Quantity'] . '></td></tr><tr><td>' . _('Due Date') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='Duedate' size=12 - maxlength=12 value=" . $_POST['Duedate'] . '></td></tr>'; + echo '<tr><td>' . _('Quantity') . ':</td> + <td><input type="text" name="Quantity" class="number" size="6" maxlength="6" value=' . $_POST['Quantity'] . '></td> + </tr> + <tr> + <td>' . _('Due Date') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Duedate" size="12" maxlength="12" value="' . $_POST['Duedate'] . '"></td> + </tr>'; // Generate selections for Demand Type - echo '<tr><td>' . _('Demand Type') . "</td><td><select name='MRPDemandtype'>"; - $sql = 'SELECT mrpdemandtype, + echo '<tr> + <td>' . _('Demand Type') . '</td> + <td><select name="MRPDemandtype">'; + + $sql = "SELECT mrpdemandtype, description - FROM mrpdemandtypes'; + FROM mrpdemandtypes"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['MRPDemandtype']) and $myrow['mrpdemandtype']==$_POST['MRPDemandtype']) { @@ -399,18 +407,18 @@ echo '</select></td></tr>'; echo '</table>'; - echo '<br><div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; + echo '<br /> + <div class=centre><input type="submit" name="submit" value="' . _('Enter Information') . '">  '; echo '<input type="submit" name="listsome" value="' . _('List Selection') . '">  '; - echo '<input type="Submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; + echo '<input type="submit" name="deletesome" value="' . _('Delete Demand Type') . '">'; // If mrpdemand record exists, display option to delete it if ((isset($DemandID)) AND (DB_num_rows($result) > 0)) { - echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?&delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '">' . _('Or Delete Record') ; + echo '<br/><br/><a href=" ' . $_SERVER['PHP_SELF'] . '?delete=yes&StockID='.$StockID.'&DemandID=' . $DemandID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this demand?') . '\');">' . _('Or Delete Record') ; } } echo '</form>'; } // End of function display() - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/PrintCustOrder_generic.php 2011-06-28 10:12:27 UTC (rev 4609) @@ -2,7 +2,6 @@ /* $Id$*/ -/* $Revision: 1.20 $ */ include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -10,16 +9,27 @@ //Get Out if we have no order number to work with If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ - $title = _('Select Order To Print'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Select Order To Print'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + include('includes/footer.inc'); + exit(); } /*retrieve the order details from the database to print */ @@ -27,50 +37,62 @@ $sql = "SELECT salesorders.debtorno, salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.deliverblind, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - shippers.shippername, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - locations.locationname - FROM salesorders, - debtorsmaster, - shippers, - locations - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.shipvia=shippers.shipper_id - AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno='" . $_GET['TransNo'] . "'"; - + salesorders.comments, + salesorders.orddate, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.deliverblind, + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + shippers.shippername, + salesorders.printedpackingslip, + salesorders.datepackingslipprinted, + locations.locationname + FROM salesorders, + debtorsmaster, + shippers, + locations + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.shipvia=shippers.shipper_id + AND salesorders.fromstkloc=locations.loccode + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; + $result=DB_query($sql,$db, $ErrMsg); //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<div class=centre><br /><br /><br />'; - prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit(); + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<div class=centre><br /><br /><br />'; + prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; + + include('includes/footer.inc'); + exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ $myrow = DB_fetch_array($result); @@ -90,10 +112,18 @@ echo '<br /><br /><br />'; echo _('Or select another Order Number to Print'); - echo '<table class="table_index"><tr><td class="menu_group_item"> + echo '<table class="table_index"> + <tr> + <td class="menu_group_item"> <li><a href="'. $rootpath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> <li><a href="'. $rootpath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.inc'); exit; @@ -102,9 +132,9 @@ /*retrieve the order details from the database to print */ -/* Then there's an order to print and its not been printed already (or its been flagged for reprinting/ge_Width=807; -) +/* Then there's an order to print and its not been printed already (or its been flagged for reprinting) LETS GO */ + $PaperSize = 'A4_Landscape'; include('includes/PDFStarter.php'); //$pdf->selectFont('./fonts/Helvetica.afm'); @@ -119,22 +149,24 @@ for ($i=1;$i<=2;$i++){ /*Print it out twice one copy for customer and one for office */ if ($i==2){ - $PageNumber = 1; + $PageNumber = 1; $pdf->newPage(); } /* Now ... Has the order got any line items still outstanding to be invoiced */ - $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . + $ErrMsg = _('There was a problem retrieving the order details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, - salesorderdetails.unitprice, - salesorderdetails.narrative - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, + salesorderdetails.unitprice, + salesorderdetails.narrative, + stockmaster.mbflag, + stockmaster.decimalplaces + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -144,26 +176,56 @@ while ($myrow2=DB_fetch_array($result)){ $ListCount ++; + + $DisplayQty = number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $DisplayQty = number_format($myrow2['quantity'],2); - $DisplayPrevDel = number_format($myrow2['qtyinvoiced'],2); - $DisplayQtySupplied = number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],2); - $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode']); $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$myrow2['description']); $LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize,$DisplayQty,'right'); $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); $LeftOvers = $pdf->addTextWrap(602,$YPos,85,$FontSize,$DisplayPrevDel,'right'); - + if ($YPos-$line_height <= 50){ /* We reached the end of the page so finsih off the page and start a newy */ $PageNumber++; include ('includes/PDFOrderPageHeader_generic.inc'); } //end if need a new page headed up - else{ + else { /*increment a line down for the next line item */ $YPos -= ($line_height); } + if ($myrow2['mbflag']=='A'){ + /*Then its an assembly item - need to explode into it's components for packing list purposes */ + $sql = "SELECT bom.component, + bom.quantity, + stockmaster.description, + stockmaster.decimalplaces + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $myrow2['stkcode'] . "'"; + $ErrMsg = _('Could not retrieve the components of the ordered assembly item'); + $AssemblyResult = DB_query($sql,$db,$ErrMsg); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,150,$FontSize, _('Assembly Components:-')); + $YPos -= ($line_height); + /*Loop around all the components of the assembly and list the quantity supplied */ + while ($ComponentRow=DB_fetch_array($AssemblyResult)){ + $DisplayQtySupplied = number_format($ComponentRow['quantity']*($myrow2['quantity'] - $myrow2['qtyinvoiced']),$ComponentRow['decimalplaces']); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$ComponentRow['component']); + $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$ComponentRow['description']); + $LeftOvers = $pdf->addTextWrap(503,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); + if ($YPos-$line_height <= 50){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include ('includes/PDFOrderPageHeader_generic.inc'); + } //end if need a new page headed up + else{ + /*increment a line down for the next line item */ + $YPos -= ($line_height); + } + } //loop around all the components of the assembly + } } //end while there are line items to print out } /*end if there are order details to show on the order*/ @@ -172,18 +234,21 @@ } /*end for loop to print the whole lot twice */ -if ($ListCount == 0) { //UldisN - $title = _('Print Packing Slip Error'); - include('includes/header.inc'); - echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); +if ($ListCount == 0) { + $title = _('Print Packing Slip Error'); + include('includes/header.inc'); + echo '<p>'. _('There were no outstanding items on the order to deliver') . '. ' . _('A packing slip cannot be printed'). + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php">'. _('Print Another Packing Slip/Order'). + '</a> + <br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; + $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + $sql = "UPDATE salesorders SET printedpackingslip=1, + datepackingslipprinted='" . Date('Y-m-d') . "' + WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-27 10:30:19 UTC (rev 4608) +++ trunk/doc/Change.log 2011-06-28 10:12:27 UTC (rev 4609) @@ -1,6 +1,8 @@ webERP Change Log -27/6/11 Exson: MRP>php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture +28/6/11 Phil: Make assembly items explode into components on packing slips PrintCustOrder_generic.php +28/6/11 Exson: MRPDemands.php links missing ? now fixed - script fixed for quoting variable name CamelCasing +27/6/11 Exson: MRP.php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost 26/6/11 Phil: Went back to no number_formatting on PurchData.php 26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-27 10:30:27
|
Revision: 4608 http://web-erp.svn.sourceforge.net/web-erp/?rev=4608&view=rev Author: daintree Date: 2011-06-27 10:30:19 +0000 (Mon, 27 Jun 2011) Log Message: ----------- MRP fix per Exson Modified Paths: -------------- trunk/MRP.php trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-06-26 01:21:26 UTC (rev 4607) +++ trunk/MRP.php 2011-06-27 10:30:19 UTC (rev 4608) @@ -588,7 +588,7 @@ -function LevelNetting(&$db,$part,$eoq,$pansize,$shrinkfactor) { +function LevelNetting(&$db,$part,$eoq,$PanSize,$ShrinkFactor) { // Create an array of mrprequirements and an array of mrpsupplies, then read through // them seeing if all requirements are covered by supplies. Create a planned order // for any unmet requirements. Change dates if necessary for the supplies. @@ -600,13 +600,13 @@ $myrow=DB_fetch_row($result); $DecimalPlaces = $myrow[0]; - // Load mrprequirements into $requirements array + // Load mrprequirements into $Requirements array $sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired"; $result = DB_query($sql,$db); - $requirements = array(); + $Requirements = array(); $i = 0; while ($myrow=DB_fetch_array($result)) { - array_push($requirements,$myrow); + array_push($Requirements,$myrow); $i++; } //end of while loop @@ -621,32 +621,32 @@ } //end of while loop // Go through all requirements and check if have supplies to cover them - $requirementcount = count($requirements); + $Requirementcount = count($Requirements); $supplycount = count($supplies); $reqi = 0; //Index for requirements $supi = 0; // index for supplies $totalrequirement = 0; $totalsupply = 0; - if ($requirementcount > 0 && $supplycount > 0) { - $totalrequirement += $requirements[$reqi]['quantity']; + if ($Requirementcount > 0 && $supplycount > 0) { + $totalrequirement += $Requirements[$reqi]['quantity']; $totalsupply += $supplies[$supi]['supplyquantity']; while ($totalrequirement > 0 && $totalsupply > 0) { $supplies[$supi]['updateflag'] = 1; // ******** Put leeway calculation in here ******** $duedate = ConvertSQLDate($supplies[$supi]['duedate']); - $reqdate = ConvertSQLDate($requirements[$reqi]['daterequired']); + $reqdate = ConvertSQLDate($Requirements[$reqi]['daterequired']); $datediff = DateDiff($duedate,$reqdate,'d'); - //if ($supplies[$supi]['duedate'] > $requirements[$reqi]['daterequired']) { + //if ($supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) { if ($datediff > abs($_POST['Leeway'])) { - $sql = "UPDATE mrpsupplies SET mrpdate = '" . $requirements[$reqi]['daterequired'] . + $sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $supplies[$supi]['id'] . "' AND duedate = mrpdate"; $result = DB_query($sql,$db); } if ($totalrequirement > $totalsupply) { $totalrequirement -= $totalsupply; - $requirements[$reqi]['quantity'] -= $totalsupply; + $Requirements[$reqi]['quantity'] -= $totalsupply; $totalsupply = 0; $supplies[$supi]['supplyquantity'] = 0; $supi++; @@ -657,10 +657,10 @@ $totalsupply -= $totalrequirement; $supplies[$supi]['supplyquantity'] -= $totalrequirement; $totalrequirement = 0; - $requirements[$reqi]['quantity'] = 0; + $Requirements[$reqi]['quantity'] = 0; $reqi++; - if ($requirementcount > $reqi) { - $totalrequirement += $requirements[$reqi]['quantity']; + if ($Requirementcount > $reqi) { + $totalrequirement += $Requirements[$reqi]['quantity']; } } // End of if $totalrequirement > $totalsupply } // End of while @@ -676,39 +676,39 @@ // would be an excess of 3; if there was another requirement for 3 or less, the excess // would cover it, so no planned order would have to be created for the second requirement. $excessqty = 0; - foreach ($requirements as $key => $row) { - $daterequired[$key] = $row['daterequired']; + foreach ($Requirements as $key => $row) { + $DateRequired[$key] = $row['daterequired']; } - if (count($requirements)) { - array_multisort($daterequired, SORT_ASC, $requirements); + if (count($Requirements)) { + array_multisort($DateRequired, SORT_ASC, $Requirements); } - foreach($requirements as $requirement) { + foreach($Requirements as $Requirement) { // First, inflate requirement if there is a shrinkage factor // Should the quantity be rounded? - if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) { - $requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor); - $requirement['quantity'] = round($requirement['quantity'],$DecimalPlaces); + if ($_POST['shrinkageflag'] == 'y' AND $ShrinkFactor > 0) { + $Requirement['quantity'] = ($Requirement['quantity'] * 100) / (100 - $ShrinkFactor); + $Requirement['quantity'] = round($Requirement['quantity'],$DecimalPlaces); } - if ($excessqty >= $requirement['quantity']) { - $plannedqty = 0; - $excessqty -= $requirement['quantity']; + if ($excessqty >= $Requirement['quantity']) { + $PlannedQty = 0; + $excessqty -= $Requirement['quantity']; } else { - $plannedqty = $requirement['quantity'] - $excessqty; + $PlannedQty = $Requirement['quantity'] - $excessqty; $excessqty = 0; } - if ($plannedqty > 0) { - if ($_POST['eoqflag'] == 'y' and $eoq > $plannedqty) { - $excessqty = $eoq - $plannedqty; - $plannedqty = $eoq; + if ($PlannedQty > 0) { + if ($_POST['eoqflag'] == 'y' AND $eoq > $PlannedQty) { + $excessqty = $eoq - $PlannedQty; + $PlannedQty = $eoq; } // Pansize calculation here - // if $plannedqty not evenly divisible by $pansize, calculate as $plannedqty - // divided by $pansize and rounded up to the next highest integer and then + // if $PlannedQty not evenly divisible by $PanSize, calculate as $PlannedQty + // divided by $PanSize and rounded up to the next highest integer and then // multiplied by the pansize. For instance, with a planned qty of 17 with a pansize // of 5, divide 17 by 5 to get 3 with a remainder of 2, which is rounded up to 4 // and then multiplied by 5 - the pansize - to get 20 - if ($_POST['pansizeflag'] == 'y' and $pansize != 0 and $plannedqty % $pansize != 0) { - $plannedqty = ceil($plannedqty / $pansize) * $pansize; + if ($_POST['pansizeflag'] == 'y' AND $PanSize != 0 AND $PlannedQty != 0) { + $PlannedQty = ceil($PlannedQty / $PanSize) * $PanSize; } $sql = "INSERT INTO mrpplannedorders (id, part, @@ -719,27 +719,27 @@ mrpdate, updateflag) VALUES (NULL, - '" . $requirement['part'] . "', - '" . $requirement['daterequired'] . "', - '" . $plannedqty . "', - '" . $requirement['mrpdemandtype'] . "', - '" . $requirement['orderno'] . "', - '" . $requirement['daterequired'] . "', + '" . $Requirement['part'] . "', + '" . $Requirement['daterequired'] . "', + '" . $PlannedQty . "', + '" . $Requirement['mrpdemandtype'] . "', + '" . $Requirement['orderno'] . "', + '" . $Requirement['daterequired'] . "', '0')"; $result = DB_query($sql,$db); // If part has lower level components, create requirements for them $sql = "SELECT COUNT(*) FROM bom - WHERE parent ='" . $requirement['part'] . "' + WHERE parent ='" . $Requirement['part'] . "' GROUP BY parent"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0) { - CreateLowerLevelRequirement($db,$requirement['part'],$requirement['daterequired'], - $plannedqty,$requirement['mrpdemandtype'],$requirement['orderno'], - $requirement['whererequired']); + CreateLowerLevelRequirement($db,$Requirement['part'],$Requirement['daterequired'], + $PlannedQty,$Requirement['mrpdemandtype'],$Requirement['orderno'], + $Requirement['whererequired']); } - } // End of if $plannedqty > 0 - } // End of foreach $requirements + } // End of if $PlannedQty > 0 + } // End of foreach $Requirements // If there are any supplies not used and updateflag is zero, those supplies are not // necessary, so change date @@ -756,12 +756,12 @@ } // End of LevelNetting ------------------------------------------------------- function CreateLowerLevelRequirement(&$db, - $toppart, - $topdate, + $TopPart, + $TopDate, $topquantity, - $topmrpdemandtype, - $toporderno, - $whererequired) { + $TopMRPDemandType, + $TopOrderNo, + $WhereRequired) { // Creates an mrprequirement based on the net requirement from the part above it in the bom $sql = "SELECT bom.component, bom.quantity, @@ -770,43 +770,43 @@ FROM bom LEFT JOIN levels ON bom.component = levels.part - WHERE bom.parent = '".$toppart."' + WHERE bom.parent = '".$TopPart."' AND effectiveafter <= now() AND effectiveto >= now()"; - $resultbom = DB_query($sql,$db); - while ($myrow=DB_fetch_array($resultbom)) { + $ResultBOM = DB_query($sql,$db); + while ($myrow=DB_fetch_array($ResultBOM)) { // Calculate required date by subtracting leadtime from top part's required date - $leadtime = $myrow['leadtime']; + $LeadTime = $myrow['leadtime']; // Following sql finds daynumber for the top part's required date, subtracts leadtime, and finds // a valid manufacturing date for the daynumber. There is only one valid manufacturing date // for each daynumber, but there could be several non-manufacturing dates for the // same daynumber. MRPCalendar.php maintains the manufacturing calendar. - $calendarsql = "SELECT COUNT(*),cal2.calendardate + $CalendarSQL = "SELECT COUNT(*),cal2.calendardate FROM mrpcalendar LEFT JOIN mrpcalendar as cal2 - ON (mrpcalendar.daynumber - '".$leadtime."') = cal2.daynumber - WHERE mrpcalendar.calendardate = '".$topdate."' + ON (mrpcalendar.daynumber - '".$LeadTime."') = cal2.daynumber + WHERE mrpcalendar.calendardate = '".$TopDate."' AND cal2.manufacturingflag='1' GROUP BY cal2.calendardate"; - $resultdate = DB_query($calendarsql,$db); - $myrowdate=DB_fetch_array($resultdate); - $newdate = $myrowdate[1]; - // If can't find date based on manufacturing calendar, use $topdate + $ResultDate = DB_query($CalendarSQL,$db); + $myrowdate=DB_fetch_array($ResultDate); + $NewDate = $myrowdate[1]; + // If can't find date based on manufacturing calendar, use $TopDate if ($myrowdate[0] == 0){ - // Convert $topdate from mysql format to system date format, use that to subtract leadtime + // Convert $TopDate from mysql format to system date format, use that to subtract leadtime // from it using DateAdd, convert that date back to mysql format - $convertdate = ConvertSQLDate($topdate); - $dateadd = DateAdd($convertdate,"d",($leadtime * -1)); - $newdate = FormatDateForSQL($dateadd); + $ConvertDate = ConvertSQLDate($TopDate); + $DateAdd = DateAdd($ConvertDate,'d',($LeadTime * -1)); + $NewDate = FormatDateForSQL($DateAdd); } - $component = $myrow['component']; - $extendedquantity = $myrow['quantity'] * $topquantity; + $Component = $myrow['component']; + $ExtendedQuantity = $myrow['quantity'] * $topquantity; // Commented out the following lines 8/15/09 because the eoq should be considered in the // LevelNetting() function where $excessqty is calculated -// if ($myrow['eoq'] > $extendedquantity) { -// $extendedquantity = $myrow['eoq']; +// if ($myrow['eoq'] > $ExtendedQuantity) { +// $ExtendedQuantity = $myrow['eoq']; // } $sql = "INSERT INTO mrprequirements (part, @@ -816,13 +816,13 @@ orderno, directdemand, whererequired) - VALUES ('".$component."', - '".$newdate."', - '".$extendedquantity."', - '".$topmrpdemandtype."', - '".$toporderno."', + VALUES ('".$Component."', + '".$NewDate."', + '".$ExtendedQuantity."', + '".$TopMRPDemandType."', + '".$TopOrderNo."', '0', - '".$whererequired."')"; + '".$WhereRequired."')"; $result = DB_query($sql,$db); } //end of while loop Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-26 01:21:26 UTC (rev 4607) +++ trunk/doc/Change.log 2011-06-27 10:30:19 UTC (rev 4608) @@ -1,5 +1,6 @@ webERP Change Log +27/6/11 Exson: MRP>php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost 26/6/11 Phil: Went back to no number_formatting on PurchData.php 26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-27 10:30:26
|
Revision: 4608 http://web-erp.svn.sourceforge.net/web-erp/?rev=4608&view=rev Author: daintree Date: 2011-06-27 10:30:19 +0000 (Mon, 27 Jun 2011) Log Message: ----------- MRP fix per Exson Modified Paths: -------------- trunk/MRP.php trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-06-26 01:21:26 UTC (rev 4607) +++ trunk/MRP.php 2011-06-27 10:30:19 UTC (rev 4608) @@ -588,7 +588,7 @@ -function LevelNetting(&$db,$part,$eoq,$pansize,$shrinkfactor) { +function LevelNetting(&$db,$part,$eoq,$PanSize,$ShrinkFactor) { // Create an array of mrprequirements and an array of mrpsupplies, then read through // them seeing if all requirements are covered by supplies. Create a planned order // for any unmet requirements. Change dates if necessary for the supplies. @@ -600,13 +600,13 @@ $myrow=DB_fetch_row($result); $DecimalPlaces = $myrow[0]; - // Load mrprequirements into $requirements array + // Load mrprequirements into $Requirements array $sql = "SELECT * FROM mrprequirements WHERE part = '" .$part. "' ORDER BY daterequired"; $result = DB_query($sql,$db); - $requirements = array(); + $Requirements = array(); $i = 0; while ($myrow=DB_fetch_array($result)) { - array_push($requirements,$myrow); + array_push($Requirements,$myrow); $i++; } //end of while loop @@ -621,32 +621,32 @@ } //end of while loop // Go through all requirements and check if have supplies to cover them - $requirementcount = count($requirements); + $Requirementcount = count($Requirements); $supplycount = count($supplies); $reqi = 0; //Index for requirements $supi = 0; // index for supplies $totalrequirement = 0; $totalsupply = 0; - if ($requirementcount > 0 && $supplycount > 0) { - $totalrequirement += $requirements[$reqi]['quantity']; + if ($Requirementcount > 0 && $supplycount > 0) { + $totalrequirement += $Requirements[$reqi]['quantity']; $totalsupply += $supplies[$supi]['supplyquantity']; while ($totalrequirement > 0 && $totalsupply > 0) { $supplies[$supi]['updateflag'] = 1; // ******** Put leeway calculation in here ******** $duedate = ConvertSQLDate($supplies[$supi]['duedate']); - $reqdate = ConvertSQLDate($requirements[$reqi]['daterequired']); + $reqdate = ConvertSQLDate($Requirements[$reqi]['daterequired']); $datediff = DateDiff($duedate,$reqdate,'d'); - //if ($supplies[$supi]['duedate'] > $requirements[$reqi]['daterequired']) { + //if ($supplies[$supi]['duedate'] > $Requirements[$reqi]['daterequired']) { if ($datediff > abs($_POST['Leeway'])) { - $sql = "UPDATE mrpsupplies SET mrpdate = '" . $requirements[$reqi]['daterequired'] . + $sql = "UPDATE mrpsupplies SET mrpdate = '" . $Requirements[$reqi]['daterequired'] . "' WHERE id = '" . $supplies[$supi]['id'] . "' AND duedate = mrpdate"; $result = DB_query($sql,$db); } if ($totalrequirement > $totalsupply) { $totalrequirement -= $totalsupply; - $requirements[$reqi]['quantity'] -= $totalsupply; + $Requirements[$reqi]['quantity'] -= $totalsupply; $totalsupply = 0; $supplies[$supi]['supplyquantity'] = 0; $supi++; @@ -657,10 +657,10 @@ $totalsupply -= $totalrequirement; $supplies[$supi]['supplyquantity'] -= $totalrequirement; $totalrequirement = 0; - $requirements[$reqi]['quantity'] = 0; + $Requirements[$reqi]['quantity'] = 0; $reqi++; - if ($requirementcount > $reqi) { - $totalrequirement += $requirements[$reqi]['quantity']; + if ($Requirementcount > $reqi) { + $totalrequirement += $Requirements[$reqi]['quantity']; } } // End of if $totalrequirement > $totalsupply } // End of while @@ -676,39 +676,39 @@ // would be an excess of 3; if there was another requirement for 3 or less, the excess // would cover it, so no planned order would have to be created for the second requirement. $excessqty = 0; - foreach ($requirements as $key => $row) { - $daterequired[$key] = $row['daterequired']; + foreach ($Requirements as $key => $row) { + $DateRequired[$key] = $row['daterequired']; } - if (count($requirements)) { - array_multisort($daterequired, SORT_ASC, $requirements); + if (count($Requirements)) { + array_multisort($DateRequired, SORT_ASC, $Requirements); } - foreach($requirements as $requirement) { + foreach($Requirements as $Requirement) { // First, inflate requirement if there is a shrinkage factor // Should the quantity be rounded? - if ($_POST['shrinkageflag'] == 'y' and $shrinkfactor > 0) { - $requirement['quantity'] = ($requirement['quantity'] * 100) / (100 - $shrinkfactor); - $requirement['quantity'] = round($requirement['quantity'],$DecimalPlaces); + if ($_POST['shrinkageflag'] == 'y' AND $ShrinkFactor > 0) { + $Requirement['quantity'] = ($Requirement['quantity'] * 100) / (100 - $ShrinkFactor); + $Requirement['quantity'] = round($Requirement['quantity'],$DecimalPlaces); } - if ($excessqty >= $requirement['quantity']) { - $plannedqty = 0; - $excessqty -= $requirement['quantity']; + if ($excessqty >= $Requirement['quantity']) { + $PlannedQty = 0; + $excessqty -= $Requirement['quantity']; } else { - $plannedqty = $requirement['quantity'] - $excessqty; + $PlannedQty = $Requirement['quantity'] - $excessqty; $excessqty = 0; } - if ($plannedqty > 0) { - if ($_POST['eoqflag'] == 'y' and $eoq > $plannedqty) { - $excessqty = $eoq - $plannedqty; - $plannedqty = $eoq; + if ($PlannedQty > 0) { + if ($_POST['eoqflag'] == 'y' AND $eoq > $PlannedQty) { + $excessqty = $eoq - $PlannedQty; + $PlannedQty = $eoq; } // Pansize calculation here - // if $plannedqty not evenly divisible by $pansize, calculate as $plannedqty - // divided by $pansize and rounded up to the next highest integer and then + // if $PlannedQty not evenly divisible by $PanSize, calculate as $PlannedQty + // divided by $PanSize and rounded up to the next highest integer and then // multiplied by the pansize. For instance, with a planned qty of 17 with a pansize // of 5, divide 17 by 5 to get 3 with a remainder of 2, which is rounded up to 4 // and then multiplied by 5 - the pansize - to get 20 - if ($_POST['pansizeflag'] == 'y' and $pansize != 0 and $plannedqty % $pansize != 0) { - $plannedqty = ceil($plannedqty / $pansize) * $pansize; + if ($_POST['pansizeflag'] == 'y' AND $PanSize != 0 AND $PlannedQty != 0) { + $PlannedQty = ceil($PlannedQty / $PanSize) * $PanSize; } $sql = "INSERT INTO mrpplannedorders (id, part, @@ -719,27 +719,27 @@ mrpdate, updateflag) VALUES (NULL, - '" . $requirement['part'] . "', - '" . $requirement['daterequired'] . "', - '" . $plannedqty . "', - '" . $requirement['mrpdemandtype'] . "', - '" . $requirement['orderno'] . "', - '" . $requirement['daterequired'] . "', + '" . $Requirement['part'] . "', + '" . $Requirement['daterequired'] . "', + '" . $PlannedQty . "', + '" . $Requirement['mrpdemandtype'] . "', + '" . $Requirement['orderno'] . "', + '" . $Requirement['daterequired'] . "', '0')"; $result = DB_query($sql,$db); // If part has lower level components, create requirements for them $sql = "SELECT COUNT(*) FROM bom - WHERE parent ='" . $requirement['part'] . "' + WHERE parent ='" . $Requirement['part'] . "' GROUP BY parent"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0] > 0) { - CreateLowerLevelRequirement($db,$requirement['part'],$requirement['daterequired'], - $plannedqty,$requirement['mrpdemandtype'],$requirement['orderno'], - $requirement['whererequired']); + CreateLowerLevelRequirement($db,$Requirement['part'],$Requirement['daterequired'], + $PlannedQty,$Requirement['mrpdemandtype'],$Requirement['orderno'], + $Requirement['whererequired']); } - } // End of if $plannedqty > 0 - } // End of foreach $requirements + } // End of if $PlannedQty > 0 + } // End of foreach $Requirements // If there are any supplies not used and updateflag is zero, those supplies are not // necessary, so change date @@ -756,12 +756,12 @@ } // End of LevelNetting ------------------------------------------------------- function CreateLowerLevelRequirement(&$db, - $toppart, - $topdate, + $TopPart, + $TopDate, $topquantity, - $topmrpdemandtype, - $toporderno, - $whererequired) { + $TopMRPDemandType, + $TopOrderNo, + $WhereRequired) { // Creates an mrprequirement based on the net requirement from the part above it in the bom $sql = "SELECT bom.component, bom.quantity, @@ -770,43 +770,43 @@ FROM bom LEFT JOIN levels ON bom.component = levels.part - WHERE bom.parent = '".$toppart."' + WHERE bom.parent = '".$TopPart."' AND effectiveafter <= now() AND effectiveto >= now()"; - $resultbom = DB_query($sql,$db); - while ($myrow=DB_fetch_array($resultbom)) { + $ResultBOM = DB_query($sql,$db); + while ($myrow=DB_fetch_array($ResultBOM)) { // Calculate required date by subtracting leadtime from top part's required date - $leadtime = $myrow['leadtime']; + $LeadTime = $myrow['leadtime']; // Following sql finds daynumber for the top part's required date, subtracts leadtime, and finds // a valid manufacturing date for the daynumber. There is only one valid manufacturing date // for each daynumber, but there could be several non-manufacturing dates for the // same daynumber. MRPCalendar.php maintains the manufacturing calendar. - $calendarsql = "SELECT COUNT(*),cal2.calendardate + $CalendarSQL = "SELECT COUNT(*),cal2.calendardate FROM mrpcalendar LEFT JOIN mrpcalendar as cal2 - ON (mrpcalendar.daynumber - '".$leadtime."') = cal2.daynumber - WHERE mrpcalendar.calendardate = '".$topdate."' + ON (mrpcalendar.daynumber - '".$LeadTime."') = cal2.daynumber + WHERE mrpcalendar.calendardate = '".$TopDate."' AND cal2.manufacturingflag='1' GROUP BY cal2.calendardate"; - $resultdate = DB_query($calendarsql,$db); - $myrowdate=DB_fetch_array($resultdate); - $newdate = $myrowdate[1]; - // If can't find date based on manufacturing calendar, use $topdate + $ResultDate = DB_query($CalendarSQL,$db); + $myrowdate=DB_fetch_array($ResultDate); + $NewDate = $myrowdate[1]; + // If can't find date based on manufacturing calendar, use $TopDate if ($myrowdate[0] == 0){ - // Convert $topdate from mysql format to system date format, use that to subtract leadtime + // Convert $TopDate from mysql format to system date format, use that to subtract leadtime // from it using DateAdd, convert that date back to mysql format - $convertdate = ConvertSQLDate($topdate); - $dateadd = DateAdd($convertdate,"d",($leadtime * -1)); - $newdate = FormatDateForSQL($dateadd); + $ConvertDate = ConvertSQLDate($TopDate); + $DateAdd = DateAdd($ConvertDate,'d',($LeadTime * -1)); + $NewDate = FormatDateForSQL($DateAdd); } - $component = $myrow['component']; - $extendedquantity = $myrow['quantity'] * $topquantity; + $Component = $myrow['component']; + $ExtendedQuantity = $myrow['quantity'] * $topquantity; // Commented out the following lines 8/15/09 because the eoq should be considered in the // LevelNetting() function where $excessqty is calculated -// if ($myrow['eoq'] > $extendedquantity) { -// $extendedquantity = $myrow['eoq']; +// if ($myrow['eoq'] > $ExtendedQuantity) { +// $ExtendedQuantity = $myrow['eoq']; // } $sql = "INSERT INTO mrprequirements (part, @@ -816,13 +816,13 @@ orderno, directdemand, whererequired) - VALUES ('".$component."', - '".$newdate."', - '".$extendedquantity."', - '".$topmrpdemandtype."', - '".$toporderno."', + VALUES ('".$Component."', + '".$NewDate."', + '".$ExtendedQuantity."', + '".$TopMRPDemandType."', + '".$TopOrderNo."', '0', - '".$whererequired."')"; + '".$WhereRequired."')"; $result = DB_query($sql,$db); } //end of while loop Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-26 01:21:26 UTC (rev 4607) +++ trunk/doc/Change.log 2011-06-27 10:30:19 UTC (rev 4608) @@ -1,5 +1,6 @@ webERP Change Log +27/6/11 Exson: MRP>php fixed modulus arithmetic that prevented suggesting production quantities where the quantity was less than 1 - the calculation using PanSize should round up to the nearest whole unit to manufacture 26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost 26/6/11 Phil: Went back to no number_formatting on PurchData.php 26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-26 01:21:34
|
Revision: 4607 http://web-erp.svn.sourceforge.net/web-erp/?rev=4607&view=rev Author: daintree Date: 2011-06-26 01:21:26 +0000 (Sun, 26 Jun 2011) Log Message: ----------- PurchData no number_format on price - fix cost update in WorkOrderCosting.php Modified Paths: -------------- trunk/PurchData.php trunk/WorkOrderCosting.php trunk/doc/Change.log Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/PurchData.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -37,36 +37,28 @@ $InputError = 1; prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])))) { + if (!is_numeric($_POST['Price'])) { $InputError = 1; unset($_POST['Price']); prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error'); - } else { - $_POST['Price'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])); } if ($_POST['Price'] == 0) { prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])))) { + if (!is_numeric($_POST['LeadTime'])) { $InputError = 1; unset($_POST['LeadTime']); prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error'); - } else { - $_POST['LeadTime'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])))) { + if (!is_numeric($_POST['MinOrderQty'])) { $InputError = 1; unset($_POST['MinOrderQty']); prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error'); - } else { - $_POST['MinOrderQty'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])); - } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])))) { + } + if (!is_numeric($_POST['ConversionFactor'])) { $InputError = 1; unset($_POST['ConversionFactor']); prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error'); - } else { - $_POST['ConversionFactor'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])); } if ($InputError == 0 AND isset($_POST['AddRecord'])) { $sql = "INSERT INTO purchdata (supplierno, @@ -198,36 +190,36 @@ $DisplayPreferred = _('No'); } printf("<td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s " . _('days') . "</td> - <td>%s</td> - <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> - <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> - </tr>", - $myrow['suppname'], - number_format($myrow['price'], 3), - $myrow['suppliersuom'], - $myrow['conversionfactor'], - number_format($myrow['price']/$myrow['conversionfactor'],2), - $myrow['currcode'], - ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], - $DisplayPreferred, - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom'], - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom']); + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s " . _('days') . "</td> + <td>%s</td> + <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> + <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> + </tr>", + $myrow['suppname'], + number_format($myrow['price'], 3), + $myrow['suppliersuom'], + $myrow['conversionfactor'], + number_format($myrow['price']/$myrow['conversionfactor'],2), + $myrow['currcode'], + ConvertSQLDate($myrow['effectivefrom']), + $myrow['minorderqty'], + $myrow['leadtime'], + $DisplayPreferred, + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom'], + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom']); } //end of while loop echo '</table><br/>'; if ($CountPreferreds > 1) { @@ -465,7 +457,7 @@ echo '<tr><td>' . _('Currency') . ':</td> <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . number_format($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/WorkOrderCosting.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -27,16 +27,15 @@ } - $ErrMsg = _('Could not retrieve the details of the selected work order'); $WOResult = DB_query("SELECT workorders.loccode, locations.locationname, workorders.requiredby, workorders.startdate, workorders.closed - FROM workorders INNER JOIN locations - ON workorders.loccode=locations.loccode - WHERE workorders.wo='" . $_POST['WO'] . "'", + FROM workorders INNER JOIN locations + ON workorders.loccode=locations.loccode + WHERE workorders.wo='" . $_POST['WO'] . "'", $db, $ErrMsg); @@ -153,13 +152,15 @@ echo '<td>' . $RequirementsRow['stockid'] . '</td> <td>' . $RequirementsRow['description'] . '</td>'; - $IssuesResult = DB_query("SELECT trandate, - qty, - standardcost - FROM stockmoves + $IssuesResult = DB_query("SELECT stockmoves.trandate, + stockmoves.qty, + stockmoves.standardcost, + stockmaster.decimalplaces, + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockid = '" . $RequirementsRow['stockid'] . "'", + AND stockmoves.reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid = '" . $RequirementsRow['stockid'] . "'", $db, _('Could not retrieve the issues of the item because:')); $IssueQty =0; @@ -174,7 +175,7 @@ } echo '<td colspan=4></td><td>' . ConvertSQLDate($IssuesRow['trandate']) . '</td> <td class=number>' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),2) . '</td></tr>'; + <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; $IssueQty -= $IssuesRow['qty'];// because qty for the stock movement will be negative $IssueCost -= ($IssuesRow['qty']*$IssuesRow['standardcost']); @@ -392,7 +393,7 @@ labourcost=0, overheadcost=0, lastcost='" . $WORow['currcost'] . "' - WHERE stockid='" . $_POST['StockID'] . "'"; + WHERE stockid='" . $WORow['stockid'] . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); $DbgMsg = _('The SQL that failed was'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/doc/Change.log 2011-06-26 01:21:26 UTC (rev 4607) @@ -1,6 +1,9 @@ webERP Change Log -26/6/11 Phil: Went back to no numberformating on PO_Items.php price and quantity - Brian May still reporting issues +26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost +26/6/11 Phil: Went back to no number_formatting on PurchData.php +26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues +25/6/11 Phil: Made PO_PDFPurchOrder.php have the description of the order item run over several lines where it exceeds the width of the space allowed for it 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-26 01:21:34
|
Revision: 4607 http://web-erp.svn.sourceforge.net/web-erp/?rev=4607&view=rev Author: daintree Date: 2011-06-26 01:21:26 +0000 (Sun, 26 Jun 2011) Log Message: ----------- PurchData no number_format on price - fix cost update in WorkOrderCosting.php Modified Paths: -------------- trunk/PurchData.php trunk/WorkOrderCosting.php trunk/doc/Change.log Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/PurchData.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -37,36 +37,28 @@ $InputError = 1; prnMsg(_('There is no stock item set up enter the stock code or select a stock item using the search page'), 'error'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])))) { + if (!is_numeric($_POST['Price'])) { $InputError = 1; unset($_POST['Price']); prnMsg(_('The price entered was not numeric and a number is expected. No changes have been made to the database'), 'error'); - } else { - $_POST['Price'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['Price'])); } if ($_POST['Price'] == 0) { prnMsg(_('The price entered is zero') . ' ' . _('Is this intentional?'), 'warn'); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])))) { + if (!is_numeric($_POST['LeadTime'])) { $InputError = 1; unset($_POST['LeadTime']); prnMsg(_('The lead time entered was not numeric a number of days is expected no changes have been made to the database'), 'error'); - } else { - $_POST['LeadTime'] = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['LeadTime'])); } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])))) { + if (!is_numeric($_POST['MinOrderQty'])) { $InputError = 1; unset($_POST['MinOrderQty']); prnMsg(_('The minimum order quantity was not numeric and a number is expected no changes have been made to the database'), 'error'); - } else { - $_POST['MinOrderQty'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['MinOrderQty'])); - } - if (!is_numeric(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])))) { + } + if (!is_numeric($_POST['ConversionFactor'])) { $InputError = 1; unset($_POST['ConversionFactor']); prnMsg(_('The conversion factor entered was not numeric') . ' (' . _('a number is expected') . '). ' . _('The conversion factor is the number which the price must be divided by to get the unit price in our unit of measure') . '. <br />' . _('E.g.') . ' ' . _('The supplier sells an item by the tonne and we hold stock by the kg') . '. ' . _('The suppliers price must be divided by 1000 to get to our cost per kg') . '. ' . _('The conversion factor to enter is 1000') . '. <br /><br />' . _('No changes will be made to the database'), 'error'); - } else { - $_POST['ConversionFactor'] =doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'])); } if ($InputError == 0 AND isset($_POST['AddRecord'])) { $sql = "INSERT INTO purchdata (supplierno, @@ -198,36 +190,36 @@ $DisplayPreferred = _('No'); } printf("<td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s " . _('days') . "</td> - <td>%s</td> - <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> - <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> - </tr>", - $myrow['suppname'], - number_format($myrow['price'], 3), - $myrow['suppliersuom'], - $myrow['conversionfactor'], - number_format($myrow['price']/$myrow['conversionfactor'],2), - $myrow['currcode'], - ConvertSQLDate($myrow['effectivefrom']), - $myrow['minorderqty'], - $myrow['leadtime'], - $DisplayPreferred, - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom'], - $_SERVER['PHP_SELF'], - $StockID, - $myrow['supplierno'], - $myrow['effectivefrom']); + <td class=number>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s " . _('days') . "</td> + <td>%s</td> + <td><a href='%s?StockID=%s&SupplierID=%s&Edit=1&EffectiveFrom=%s'>" . _('Edit') . "</a></td> + <td><a href='%s?StockID=%s&SupplierID=%s&Delete=1&EffectiveFrom=%s' onclick=\"return confirm('" . _('Are you sure you wish to delete this suppliers price?') . "');\">" . _('Delete') . "</a></td> + </tr>", + $myrow['suppname'], + number_format($myrow['price'], 3), + $myrow['suppliersuom'], + $myrow['conversionfactor'], + number_format($myrow['price']/$myrow['conversionfactor'],2), + $myrow['currcode'], + ConvertSQLDate($myrow['effectivefrom']), + $myrow['minorderqty'], + $myrow['leadtime'], + $DisplayPreferred, + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom'], + $_SERVER['PHP_SELF'], + $StockID, + $myrow['supplierno'], + $myrow['effectivefrom']); } //end of while loop echo '</table><br/>'; if ($CountPreferreds > 1) { @@ -465,7 +457,7 @@ echo '<tr><td>' . _('Currency') . ':</td> <td><input type=hidden name="CurrCode" . value="' . $CurrCode . '">' . $CurrCode . '</td></tr>'; echo '<tr><td>' . _('Price') . ' (' . _('in Supplier Currency') . '):</td> - <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . number_format($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; + <td><input type="text" class="number" name="Price" maxlength=12 size=12 value=' . round($_POST['Price'], $myrow['decimalplaces']) . '></td></tr>'; echo '<tr><td>' . _('Date Updated') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="EffectiveFrom" maxlength=10 size=11 value="' . $_POST['EffectiveFrom'] . '"></td></tr>'; echo '<tr><td>' . _('Our Unit of Measure') . ':</td>'; Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/WorkOrderCosting.php 2011-06-26 01:21:26 UTC (rev 4607) @@ -27,16 +27,15 @@ } - $ErrMsg = _('Could not retrieve the details of the selected work order'); $WOResult = DB_query("SELECT workorders.loccode, locations.locationname, workorders.requiredby, workorders.startdate, workorders.closed - FROM workorders INNER JOIN locations - ON workorders.loccode=locations.loccode - WHERE workorders.wo='" . $_POST['WO'] . "'", + FROM workorders INNER JOIN locations + ON workorders.loccode=locations.loccode + WHERE workorders.wo='" . $_POST['WO'] . "'", $db, $ErrMsg); @@ -153,13 +152,15 @@ echo '<td>' . $RequirementsRow['stockid'] . '</td> <td>' . $RequirementsRow['description'] . '</td>'; - $IssuesResult = DB_query("SELECT trandate, - qty, - standardcost - FROM stockmoves + $IssuesResult = DB_query("SELECT stockmoves.trandate, + stockmoves.qty, + stockmoves.standardcost, + stockmaster.decimalplaces, + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=28 - AND reference = '" . $_POST['WO'] . "' - AND stockid = '" . $RequirementsRow['stockid'] . "'", + AND stockmoves.reference = '" . $_POST['WO'] . "' + AND stockmoves.stockid = '" . $RequirementsRow['stockid'] . "'", $db, _('Could not retrieve the issues of the item because:')); $IssueQty =0; @@ -174,7 +175,7 @@ } echo '<td colspan=4></td><td>' . ConvertSQLDate($IssuesRow['trandate']) . '</td> <td class=number>' . number_format(-$IssuesRow['qty'],$RequirementsRow['decimalplaces']) . '</td> - <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),2) . '</td></tr>'; + <td class=number>' . number_format(-($IssuesRow['qty']*$IssuesRow['standardcost']),$IssuesRow['decimalplaces']) . '</td></tr>'; $IssueQty -= $IssuesRow['qty'];// because qty for the stock movement will be negative $IssueCost -= ($IssuesRow['qty']*$IssuesRow['standardcost']); @@ -392,7 +393,7 @@ labourcost=0, overheadcost=0, lastcost='" . $WORow['currcost'] . "' - WHERE stockid='" . $_POST['StockID'] . "'"; + WHERE stockid='" . $WORow['stockid'] . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); $DbgMsg = _('The SQL that failed was'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-26 00:14:07 UTC (rev 4606) +++ trunk/doc/Change.log 2011-06-26 01:21:26 UTC (rev 4607) @@ -1,6 +1,9 @@ webERP Change Log -26/6/11 Phil: Went back to no numberformating on PO_Items.php price and quantity - Brian May still reporting issues +26/6/11 Phil: Fixed reference to $_POST['StockID'] in WorkOrderCosting.php when updating the new weighted average cost +26/6/11 Phil: Went back to no number_formatting on PurchData.php +26/6/11 Phil: Went back to no number_formatting on PO_Items.php price and quantity - Brian May still reporting issues +25/6/11 Phil: Made PO_PDFPurchOrder.php have the description of the order item run over several lines where it exceeds the width of the space allowed for it 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-26 00:14:14
|
Revision: 4606 http://web-erp.svn.sourceforge.net/web-erp/?rev=4606&view=rev Author: daintree Date: 2011-06-26 00:14:07 +0000 (Sun, 26 Jun 2011) Log Message: ----------- PO_Items - no formatting on quantities or prices entry Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-06-25 10:55:02 UTC (rev 4605) +++ trunk/PO_Items.php 2011-06-26 00:14:07 UTC (rev 4606) @@ -33,21 +33,21 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'.$POLine->LineNo]))){ + if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; } else { //a valid number for the conversion factor is entered - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'.$POLine->LineNo])); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; } - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['SuppQty'.$POLine->LineNo]))){ + if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ prnMsg(_('The quantity in the supplier units is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=round(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['SuppQty'.$POLine->LineNo]))*doubleval(str_replace($locale_info['thousands_sep'],'',$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)),$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=round($_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor,$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); } - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['SuppPrice'.$POLine->LineNo]))){ + if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['SuppPrice'.$POLine->LineNo]))/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['SuppPrice'.$POLine->LineNo]/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -680,13 +680,13 @@ <td>' . $POLine->Units . '</td> <td class="number">' . $DisplayPrice . '</td> <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' .number_format(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; - $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; + $_SESSION['PO'.$identifier]->Total += $LineTotal; } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-25 10:55:02 UTC (rev 4605) +++ trunk/doc/Change.log 2011-06-26 00:14:07 UTC (rev 4606) @@ -1,5 +1,6 @@ webERP Change Log +26/6/11 Phil: Went back to no numberformating on PO_Items.php price and quantity - Brian May still reporting issues 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-26 00:14:14
|
Revision: 4606 http://web-erp.svn.sourceforge.net/web-erp/?rev=4606&view=rev Author: daintree Date: 2011-06-26 00:14:07 +0000 (Sun, 26 Jun 2011) Log Message: ----------- PO_Items - no formatting on quantities or prices entry Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-06-25 10:55:02 UTC (rev 4605) +++ trunk/PO_Items.php 2011-06-26 00:14:07 UTC (rev 4606) @@ -33,21 +33,21 @@ if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'.$POLine->LineNo]))){ + if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; } else { //a valid number for the conversion factor is entered - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['ConversionFactor'.$POLine->LineNo])); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; } - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['SuppQty'.$POLine->LineNo]))){ + if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ prnMsg(_('The quantity in the supplier units is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=round(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['SuppQty'.$POLine->LineNo]))*doubleval(str_replace($locale_info['thousands_sep'],'',$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor)),$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=round($_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor,$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->DecimalPlaces); } - if (!is_numeric(str_replace($locale_info['thousands_sep'],'',$_POST['SuppPrice'.$POLine->LineNo]))){ + if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); } else { //ok to update the PO object variables - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=(doubleval(str_replace($locale_info['thousands_sep'],'',$_POST['SuppPrice'.$POLine->LineNo]))/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['SuppPrice'.$POLine->LineNo]/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -680,13 +680,13 @@ <td>' . $POLine->Units . '</td> <td class="number">' . $DisplayPrice . '</td> <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . round($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppliersUnit . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' .number_format(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; - $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; + $_SESSION['PO'.$identifier]->Total += $LineTotal; } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-25 10:55:02 UTC (rev 4605) +++ trunk/doc/Change.log 2011-06-26 00:14:07 UTC (rev 4606) @@ -1,5 +1,6 @@ webERP Change Log +26/6/11 Phil: Went back to no numberformating on PO_Items.php price and quantity - Brian May still reporting issues 22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids 23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-25 10:55:09
|
Revision: 4605 http://web-erp.svn.sourceforge.net/web-erp/?rev=4605&view=rev Author: daintree Date: 2011-06-25 10:55:02 +0000 (Sat, 25 Jun 2011) Log Message: ----------- multiple line PO descriptions Modified Paths: -------------- trunk/ContractBOM.php trunk/ContractCosting.php trunk/Contracts.php trunk/Credit_Invoice.php trunk/PO_PDFPurchOrder.php trunk/SalesInquiry.php trunk/SupplierCredit.php trunk/includes/class.pdf.php Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/ContractBOM.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -19,8 +19,6 @@ } include('includes/header.inc'); -$Maximum_Number_Of_Parts_To_Show=50; - if (isset($_POST['UpdateLines']) OR isset($_POST['BackToHeader'])) { if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { @@ -201,11 +199,11 @@ if ($myrow = DB_fetch_array($result1)){ $_SESSION['Contract'.$identifier]->Add_To_ContractBOM ($ItemCode, - $myrow['description'], - $DefaultWorkCentre, - $Quantity, /* Qty */ - $myrow['unitcost'], - $myrow['units']); + $myrow['description'], + $DefaultWorkCentre, + $Quantity, /* Qty */ + $myrow['unitcost'], + $myrow['units']); } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ @@ -375,18 +373,17 @@ </tr>'; $PartsDisplayed++; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ + if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ break; } #end of page full new headings if } #end of while loop echo '</table>'; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ + if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ - /*$Maximum_Number_Of_Parts_To_Show defined in config.php */ - prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . + prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } echo '<br /><div class="centre"><input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /></div>'; Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/ContractCosting.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -64,11 +64,15 @@ echo '<table class="selection"> <tr> <th colspan="6">' . _('Original Costing') .'</th> - <th colspan="6">' . _('Actual Costs') .'</th></tr>'; + <th colspan="6">' . _('Actual Costs') .'</th> + </tr>'; -echo '<tr><th colspan="12">' . _('Inventory Required') . '</th></tr>'; +echo '<tr> + <th colspan="12">' . _('Inventory Required') . '</th> + </tr>'; -echo '<tr><th>' . _('Item Code') . '</th> +echo '<tr> + <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit') . '</th> @@ -81,56 +85,70 @@ <th>' . _('Unit Cost') . '</th> <th>' . _('Total Cost') . '</th> </tr>'; + $ContractBOMBudget = 0; $ContractBOMActual = 0; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { - echo '<tr><td>' . $Component->StockID . '</td> - <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> - <td>' . $Component->UOM . '</td> - <td class="number">' . number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + echo '<tr> + <td>' . $Component->StockID . '</td> + <td>' . $Component->ItemDescription . '</td> + <td class="number">' . $Component->Quantity . '</td> + <td>' . $Component->UOM . '</td> + <td class="number">' . number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); + if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> - <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> - <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> - <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td>' . number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> + <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> + <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td>' . number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } else { - echo '<td colspan="6"></td></tr>'; + echo '<td colspan="6"></td> + </tr>'; } } foreach ($InventoryIssues as $Component) { //actual inventory components used $ContractBOMActual -=$Component->TotalCost; if ($Component->Matched == 0) { //then its a component that wasn't budget for - echo '<tr><td colspan="6"></td> + echo '<tr> + <td colspan="6"></td> <td>' . $Component->StockID . '</td> <td>' . $Component->Description . '</td> <td class="number">' . -$Component->Quantity . '</td> <td>' . $Component->Units . '</td> <td class="number">' . number_format($Component->TotalCost/$Component->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } //end if its a component not originally budget for } -echo '<tr><td class="number" colspan="5">' . _('Total Inventory Budgeted Cost') . ':</td> +echo '<tr> + <td class="number" colspan="5">' . _('Total Inventory Budgeted Cost') . ':</td> <td class="number">' . number_format($ContractBOMBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number" colspan="5">' . _('Total Inventory Actual Cost') . ':</td> - <td class="number">' . number_format($ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; -echo '<tr><th colspan="12" align="center">' . _('Other Costs') . '</th></tr>'; +echo '<tr> + <th colspan="12" align="center">' . _('Other Costs') . '</th> + </tr>'; $OtherReqtsBudget = 0; //other requirements budget sub-table -echo '<tr><td colspan="6"><table class="selection"> - <tr><th>' . _('Requirement') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th> - </tr>'; +echo '<tr> + <td colspan="6"><table class="selection"> + <tr> + <th>' . _('Requirement') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr><td>' . $Requirement->Requirement . '</td> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/Contracts.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -38,21 +38,21 @@ } if (isset($_GET['NewContract']) AND isset($_GET['SelectedCustomer'])) { - /* - * initialize a new contract - */ - $_SESSION['ExistingContract']=0; - unset($_SESSION['Contract'.$identifier]->ContractBOM); - unset($_SESSION['Contract'.$identifier]->ContractReqts); - unset($_SESSION['Contract'.$identifier]); - /* initialize new class object */ - $_SESSION['Contract'.$identifier] = new Contract; + /* + * initialize a new contract + */ + $_SESSION['ExistingContract']=0; + unset($_SESSION['Contract'.$identifier]->ContractBOM); + unset($_SESSION['Contract'.$identifier]->ContractReqts); + unset($_SESSION['Contract'.$identifier]); + /* initialize new class object */ + $_SESSION['Contract'.$identifier] = new Contract; - $_POST['SelectedCustomer'] = $_GET['SelectedCustomer']; + $_POST['SelectedCustomer'] = $_GET['SelectedCustomer']; - /*The customer is checked for credit and the Contract Object populated - * using the usual logic of when a customer is selected - * */ + /*The customer is checked for credit and the Contract Object populated + * using the usual logic of when a customer is selected + * */ } if (isset($_SESSION['Contract'.$identifier]) AND @@ -139,9 +139,9 @@ if (isset($_GET['ModifyContractRef'])){ if (isset($_SESSION['Contract'.$identifier])){ - unset ($_SESSION['Contract'.$identifier]->ContractBOM); - unset ($_SESSION['Contract'.$identifier]->ContractReqts); - unset ($_SESSION['Contract'.$identifier]); + unset ($_SESSION['Contract'.$identifier]->ContractBOM); + unset ($_SESSION['Contract'.$identifier]->ContractReqts); + unset ($_SESSION['Contract'.$identifier]); } $_SESSION['ExistingContract']=$_GET['ModifyContractRef']; @@ -178,7 +178,7 @@ if ($_SESSION['Contract'.$identifier]->Status==1){ $sql = "DELETE FROM salesorderdetails WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; - $ErrMsg = _('The quotation line for the contract could not be deleted because'); + $ErrMsg = _('The quotation lines for the contract could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); $sql = "DELETE FROM salesorders WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; $ErrMsg = _('The quotation for the contract could not be deleted because'); @@ -220,11 +220,11 @@ //First update the session['Contract'.$identifier] variable with all inputs from the form $InputError = False; //assume no errors on input then test for errors - if (strlen($_POST['ContractRef'])<2){ + if (strlen($_POST['ContractRef']) < 2){ prnMsg(_('The contract reference is expected to be more than 2 characters long. Please alter the contract reference before proceeding.'),'error'); $InputError = true; } - if(ContainsIllegalCharacters($_POST['ContractRef'])){ + if(ContainsIllegalCharacters($_POST['ContractRef']) OR strpos($_POST['ContractRef'],' ')>0){ prnMsg(_('The contract reference cannot contain any spaces, slashes, or inverted commas. Please alter the contract reference before proceeding.'),'error'); $InputError = true; } @@ -807,7 +807,7 @@ //end of page full new headings if } //end of while loop - echo '<input type="hidden" name="JustSelectedACustomer" value="Yes">'; + echo '<input type="hidden" name="JustSelectedACustomer" value="Yes" />'; echo '</table></form>'; @@ -938,7 +938,9 @@ <th>' . _('Quantity') . '</th> <th>' . _('Unit') . '</th> <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th></tr>'; + <th>' . _('Total Cost') . '</th> + </tr>'; + foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { echo '<tr><td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> @@ -949,22 +951,32 @@ </tr>'; $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); } - echo '<tr><th colspan="5"><b>' . _('Total stock cost') . '</b></th> - <th class="number"><b>' . number_format($ContractBOMCost,2) . '</b></th></tr>'; + echo '<tr> + <th colspan="5"><b>' . _('Total stock cost') . '</b></th> + <th class="number"><b>' . number_format($ContractBOMCost,2) . '</b></th> + </tr>'; } else { //there are no items set up against this contract - echo '<tr><td colspan="6"><i>' . _('None Entered') . '</i></td></tr>'; + echo '<tr> + <td colspan="6"><i>' . _('None Entered') . '</i></td> + </tr>'; } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> - <table class="selection"><tr><th colspan="4">' . _('Other Requirements') . '</th></tr>'; + <table class="selection"> + <tr> + <th colspan="4">' . _('Other Requirements') . '</th> + </tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ - echo '<tr><th>' . _('Requirement') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th></tr>'; + echo '<tr> + <th>' . _('Requirement') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { - echo '<tr><td>' . $Requirement->Requirement . '</td> + echo '<tr> + <td>' . $Requirement->Requirement . '</td> <td class="number">' . $Requirement->Quantity . '</td> <td class="number">' . $Requirement->CostPerUnit . '</td> <td class="number">' . number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/Credit_Invoice.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -1523,7 +1523,7 @@ } $j++; echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex=' . $j . ' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; - echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update Value=' . _('Update') . '><p>'; + echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update value=' . _('Update') . '><p>'; $j++; echo '<input type="submit" tabindex='.$j++.' name="ProcessCredit" Value="' . _('Process Credit') .'"></div>'; } Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/PO_PDFPurchOrder.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -245,6 +245,16 @@ $OrderTotal += ($POLine['unitprice']*$POLine['quantityord']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize,$POLine['itemcode'], 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize,$Desc, 'left'); + while (strlen($LeftOvers) > 1){ + $YPos-=$line_height; + if ($YPos-$line_height <= $Bottom_Margin){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$Page_Height - $FormDesign->Data->y; + include ('includes/PO_PDFOrderPageHeader.inc'); + } + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize,$LeftOvers, 'left'); + } //end if need a new page headed up $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize,$DisplayQty, 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize,$POLine['suppliersunit'], 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize,$DisplayDelDate, 'left'); Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/SalesInquiry.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -56,8 +56,7 @@ //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) -{ +function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) { //initialize no input errors $InputError = 0; @@ -76,13 +75,13 @@ prnMsg(_('Invalid To Date'),'error'); } - if ($_POST['ReportType'] == 'Summary' && $_POST['DateType'] == 'Order' && $_POST['SummaryType'] == 'transno') { + if ($_POST['ReportType'] == 'Summary' AND $_POST['DateType'] == 'Order' AND $_POST['SummaryType'] == 'transno') { $InputError = 1; prnMsg(_('Cannot summarize by transaction number with a date type of Order Date'),'error'); return; } - if ($_POST['ReportType'] == 'Detail' && $_POST['DateType'] == 'Order' && $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { + if ($_POST['ReportType'] == 'Detail' AND $_POST['DateType'] == 'Order' AND $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { $InputError = 1; prnMsg(_('Cannot sort by transaction number with a date type of Order Date'),'error'); return; @@ -99,7 +98,7 @@ # Add more to WHERE statement, if user entered something for the part number,debtorno, name // Variables that end with Op - meaning operator - are either = or LIKE $WherePart = ' '; - if (strlen($PartNumber) > 0 && $PartNumberOp == 'LIKE') { + if (strlen($PartNumber) > 0 AND $PartNumberOp == 'LIKE') { $PartNumber = $PartNumber . '%'; } else { $PartNumberOp = '='; @@ -119,7 +118,7 @@ } $WhereDebtorName = ' '; - if (strlen($DebtorName) > 0 && $DebtorNameOp == 'LIKE') { + if (strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { $DebtorName = $DebtorName . '%'; } else { $DebtorNameOp = '='; @@ -1105,7 +1104,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('For Sales Man') . ':</td><td><select name="Salesman">'; - $sql='SELECT salesmancode, salesmanname FROM salesman'; + $sql="SELECT salesmancode, salesmanname FROM salesman"; $SalesmanResult= DB_query($sql,$db); echo '<option selected value="All">' . _('All Salesmen') . '</option>'; While ($myrow = DB_fetch_array($SalesmanResult)){ @@ -1164,8 +1163,7 @@ } // End of function display() -function TempStockmoves(&$db) -{ +function TempStockmoves(&$db) { // When report based on Invoice Date, use stockmoves as the main file, but credit // notes, which are type 11 in stockmoves, do not have the order number in the // reference field; instead they have "Ex Inv - " and then the transno from the Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/SupplierCredit.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -279,16 +279,16 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class=selection>'; -echo '<tr><td><font color=red>' . _('Supplier Credit Note Reference') . ":</font></td> - <td><font size=2><input type=TEXT size=20 maxlength=20 name=SuppReference value='" . $_SESSION['SuppTrans']->SuppReference . "'></td>"; +echo '<tr><td><font color=red>' . _('Supplier Credit Note Reference') . ':</font></td> + <td><font size=2><input type="text" size=20 maxlength=20 name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '"></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ $_SESSION['SuppTrans']->TranDate= Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } -echo '<td><font color=red>' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ") :</font></td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']. "' size=11 maxlength=10 name='TranDate' value=" . $_SESSION['SuppTrans']->TranDate . '></td>'; -echo '<td><font color=red>' . _('Exchange Rate') . ":</font></td> - <td><input type=TEXT class='number' size=11 maxlength=10 name='ExRate' value=" . $_SESSION['SuppTrans']->ExRate . '></td></tr>'; +echo '<td><font color=red>' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</font></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size=11 maxlength=10 name="TranDate" value="' . $_SESSION['SuppTrans']->TranDate . '"></td>'; +echo '<td><font color=red>' . _('Exchange Rate') . ':</font></td> + <td><input type="text" class="number" size=11 maxlength=10 name="ExRate" value="' . $_SESSION['SuppTrans']->ExRate . '"></td></tr>'; echo '</table>'; echo '<br /><div class="centre"><input type="submit" name="GRNS" value="' . _('Purchase Orders') . '"> '; @@ -315,7 +315,7 @@ <th>' . _('Line Total') . '<br />' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> </tr>'; echo $TableHeader; - $TotalGRNvalue=0; + $TotalGRNValue=0; foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ @@ -344,7 +344,7 @@ <th>' . _('Amount') . '</th></tr>'; echo $TableHeader; - $TotalShiptvalue=0; + $TotalShiptValue=0; $i=0; @@ -443,7 +443,7 @@ <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; - $TotalGLvalue=0; + $TotalGLValue=0; foreach ($_SESSION['SuppTrans']->GLCodes as $EnteredGLCode){ @@ -467,13 +467,13 @@ } if (!isset($TotalGRNValue)) { - $TotalGRNvalue=0; + $TotalGRNValue=0; } if (!isset($TotalGLValue)) { - $TotalGLvalue=0; + $TotalGLValue=0; } if (!isset($TotalShiptValue)) { - $TotalShiptvalue=0; + $TotalShiptValue=0; } if (!isset($TotalContractsValue)){ $TotalContractsValue = 0; @@ -560,7 +560,7 @@ echo '<table class=selection><tr><td><font color=red>' . _('Comments') . '</font></td><td><textarea name=Comments cols=40 rows=2>' . $_SESSION['SuppTrans']->Comments . '</textarea></td></tr></table>'; -echo "<p><div class='centre'><input type=submit name='PostCreditNote' value='" . _('Enter Credit Note') . "'></div>"; +echo '<p><div class="centre"><input type=submit name="PostCreditNote" value="' . _('Enter Credit Note') . '"></div>'; if (isset($_POST['PostCreditNote'])){ Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/includes/class.pdf.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -70,11 +70,11 @@ TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2,$style); } - function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0) + function addText($xb,$YPos,$size,$text)//,$angle=0,$wordSpaceAdjust=0) { // Javier $text = html_entity_decode($text); $this->SetFontSize($size); - $this->Text($xb, $this->h-$yb, $text); + $this->Text($xb, $this->h-$YPos, $text); } function addInfo($label, $value) { @@ -103,8 +103,8 @@ } - function addJpegFromFile($img,$x,$y,$w=0,$h=0){ - $this->Image($img, $x, $this->h-$y-$h, $w, $h); + function addJpegFromFile($img,$XPos,$y,$Width=0,$Height=0){ + $this->Image($img, $XPos, $this->h-$y-$Height, $Width, $Height); } /* @@ -242,33 +242,35 @@ $this->line($XPos, $YPos-$Height, $XPos, $YPos); } - function addTextWrap($x, $yb, $w, $h, $txt, $align='J', $border=0, $fill=0) { - - //$txt = html_entity_decode($txt); - + function addTextWrap($XPos, $YPos, $Width, $Height, $Text, $Align='J', $border=0, $fill=0) { + + /* Returns the balance of the string that could not fit in the width + * XPos = pdf horizontal coordinate + * YPos = pdf vertical coordiante + */ //some special characters are html encoded //this code serves to make them appear human readable in pdf file - $txt = html_entity_decode($txt, ENT_QUOTES, 'UTF-8'); + $Text = html_entity_decode($Text, ENT_QUOTES, 'UTF-8'); - $this->x = $x; - $this->y = $this->h - $yb - $h; + $this->x = $XPos; + $this->y = $this->h - $YPos - $Height; - switch($align) { + switch($Align) { case 'right': - $align = 'R'; break; + $Align = 'R'; break; case 'center': - $align = 'C'; break; + $Align = 'C'; break; default: - $align = 'L'; + $Align = 'L'; } - $this->SetFontSize($h); + $this->SetFontSize($Height); $cw=&$this->CurrentFont['cw']; - if($w==0) { - $w=$this->w-$this->rMargin-$this->x; + if($Width==0) { + $Width=$this->w-$this->rMargin-$this->x; } - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); + $wmax=($Width-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$Text); $s=str_replace("\n",' ',$s); $s = trim($s).' '; $nb=strlen($s); @@ -318,13 +320,13 @@ } $sep = $i; } else { - if($align=='J') { + if($Align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } } - $this->Cell($w,$h,substr($s,0,$sep),$b,2,$align,$fill); + $this->Cell($Width,$Height,substr($s,0,$sep),$b,2,$Align,$fill); $this->x=$this->lMargin; return substr($s, $sep); } //end function addTextWrap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-25 10:55:09
|
Revision: 4605 http://web-erp.svn.sourceforge.net/web-erp/?rev=4605&view=rev Author: daintree Date: 2011-06-25 10:55:02 +0000 (Sat, 25 Jun 2011) Log Message: ----------- multiple line PO descriptions Modified Paths: -------------- trunk/ContractBOM.php trunk/ContractCosting.php trunk/Contracts.php trunk/Credit_Invoice.php trunk/PO_PDFPurchOrder.php trunk/SalesInquiry.php trunk/SupplierCredit.php trunk/includes/class.pdf.php Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/ContractBOM.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -19,8 +19,6 @@ } include('includes/header.inc'); -$Maximum_Number_Of_Parts_To_Show=50; - if (isset($_POST['UpdateLines']) OR isset($_POST['BackToHeader'])) { if($_SESSION['Contract'.$identifier]->Status!=2){ //dont do anything if the customer has committed to the contract foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { @@ -201,11 +199,11 @@ if ($myrow = DB_fetch_array($result1)){ $_SESSION['Contract'.$identifier]->Add_To_ContractBOM ($ItemCode, - $myrow['description'], - $DefaultWorkCentre, - $Quantity, /* Qty */ - $myrow['unitcost'], - $myrow['units']); + $myrow['description'], + $DefaultWorkCentre, + $Quantity, /* Qty */ + $myrow['unitcost'], + $myrow['units']); } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the contract BOM'),'error'); if ($debug==1){ @@ -375,18 +373,17 @@ </tr>'; $PartsDisplayed++; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ + if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ break; } #end of page full new headings if } #end of while loop echo '</table>'; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ + if ($PartsDisplayed == $_SESSION['DisplayRecordsMax']){ - /*$Maximum_Number_Of_Parts_To_Show defined in config.php */ - prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . + prnMsg( _('Only the first') . ' ' . $_SESSION['DisplayRecordsMax'] . ' ' . _('can be displayed') . '. ' . _('Please restrict your search to only the parts required'),'info'); } echo '<br /><div class="centre"><input type="submit" name="NewItem" value="' . _('Add to Contract Bill Of Material') .'" /></div>'; Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/ContractCosting.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -64,11 +64,15 @@ echo '<table class="selection"> <tr> <th colspan="6">' . _('Original Costing') .'</th> - <th colspan="6">' . _('Actual Costs') .'</th></tr>'; + <th colspan="6">' . _('Actual Costs') .'</th> + </tr>'; -echo '<tr><th colspan="12">' . _('Inventory Required') . '</th></tr>'; +echo '<tr> + <th colspan="12">' . _('Inventory Required') . '</th> + </tr>'; -echo '<tr><th>' . _('Item Code') . '</th> +echo '<tr> + <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit') . '</th> @@ -81,56 +85,70 @@ <th>' . _('Unit Cost') . '</th> <th>' . _('Total Cost') . '</th> </tr>'; + $ContractBOMBudget = 0; $ContractBOMActual = 0; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { - echo '<tr><td>' . $Component->StockID . '</td> - <td>' . $Component->ItemDescription . '</td> - <td class="number">' . $Component->Quantity . '</td> - <td>' . $Component->UOM . '</td> - <td class="number">' . number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + echo '<tr> + <td>' . $Component->StockID . '</td> + <td>' . $Component->ItemDescription . '</td> + <td class="number">' . $Component->Quantity . '</td> + <td>' . $Component->UOM . '</td> + <td class="number">' . number_format($Component->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . number_format(($Component->ItemCost * $Component->Quantity),$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); + if (isset($InventoryIssues[$Component->StockID])){ $InventoryIssues[$Component->StockID]->Matched=1; echo '<td colspan="2" align="center">' . _('Actual usage') . '</td> - <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> - <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> - <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td>' . number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> + <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> + <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td>' . number_format(-$InventoryIssues[$Component->StockID]->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } else { - echo '<td colspan="6"></td></tr>'; + echo '<td colspan="6"></td> + </tr>'; } } foreach ($InventoryIssues as $Component) { //actual inventory components used $ContractBOMActual -=$Component->TotalCost; if ($Component->Matched == 0) { //then its a component that wasn't budget for - echo '<tr><td colspan="6"></td> + echo '<tr> + <td colspan="6"></td> <td>' . $Component->StockID . '</td> <td>' . $Component->Description . '</td> <td class="number">' . -$Component->Quantity . '</td> <td>' . $Component->Units . '</td> <td class="number">' . number_format($Component->TotalCost/$Component->Quantity,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td class="number">' . number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format(-$Component->TotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } //end if its a component not originally budget for } -echo '<tr><td class="number" colspan="5">' . _('Total Inventory Budgeted Cost') . ':</td> +echo '<tr> + <td class="number" colspan="5">' . _('Total Inventory Budgeted Cost') . ':</td> <td class="number">' . number_format($ContractBOMBudget,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number" colspan="5">' . _('Total Inventory Actual Cost') . ':</td> - <td class="number">' . number_format($ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; + <td class="number">' . number_format($ContractBOMActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; -echo '<tr><th colspan="12" align="center">' . _('Other Costs') . '</th></tr>'; +echo '<tr> + <th colspan="12" align="center">' . _('Other Costs') . '</th> + </tr>'; $OtherReqtsBudget = 0; //other requirements budget sub-table -echo '<tr><td colspan="6"><table class="selection"> - <tr><th>' . _('Requirement') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th> - </tr>'; +echo '<tr> + <td colspan="6"><table class="selection"> + <tr> + <th>' . _('Requirement') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { echo '<tr><td>' . $Requirement->Requirement . '</td> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/Contracts.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -38,21 +38,21 @@ } if (isset($_GET['NewContract']) AND isset($_GET['SelectedCustomer'])) { - /* - * initialize a new contract - */ - $_SESSION['ExistingContract']=0; - unset($_SESSION['Contract'.$identifier]->ContractBOM); - unset($_SESSION['Contract'.$identifier]->ContractReqts); - unset($_SESSION['Contract'.$identifier]); - /* initialize new class object */ - $_SESSION['Contract'.$identifier] = new Contract; + /* + * initialize a new contract + */ + $_SESSION['ExistingContract']=0; + unset($_SESSION['Contract'.$identifier]->ContractBOM); + unset($_SESSION['Contract'.$identifier]->ContractReqts); + unset($_SESSION['Contract'.$identifier]); + /* initialize new class object */ + $_SESSION['Contract'.$identifier] = new Contract; - $_POST['SelectedCustomer'] = $_GET['SelectedCustomer']; + $_POST['SelectedCustomer'] = $_GET['SelectedCustomer']; - /*The customer is checked for credit and the Contract Object populated - * using the usual logic of when a customer is selected - * */ + /*The customer is checked for credit and the Contract Object populated + * using the usual logic of when a customer is selected + * */ } if (isset($_SESSION['Contract'.$identifier]) AND @@ -139,9 +139,9 @@ if (isset($_GET['ModifyContractRef'])){ if (isset($_SESSION['Contract'.$identifier])){ - unset ($_SESSION['Contract'.$identifier]->ContractBOM); - unset ($_SESSION['Contract'.$identifier]->ContractReqts); - unset ($_SESSION['Contract'.$identifier]); + unset ($_SESSION['Contract'.$identifier]->ContractBOM); + unset ($_SESSION['Contract'.$identifier]->ContractReqts); + unset ($_SESSION['Contract'.$identifier]); } $_SESSION['ExistingContract']=$_GET['ModifyContractRef']; @@ -178,7 +178,7 @@ if ($_SESSION['Contract'.$identifier]->Status==1){ $sql = "DELETE FROM salesorderdetails WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; - $ErrMsg = _('The quotation line for the contract could not be deleted because'); + $ErrMsg = _('The quotation lines for the contract could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); $sql = "DELETE FROM salesorders WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; $ErrMsg = _('The quotation for the contract could not be deleted because'); @@ -220,11 +220,11 @@ //First update the session['Contract'.$identifier] variable with all inputs from the form $InputError = False; //assume no errors on input then test for errors - if (strlen($_POST['ContractRef'])<2){ + if (strlen($_POST['ContractRef']) < 2){ prnMsg(_('The contract reference is expected to be more than 2 characters long. Please alter the contract reference before proceeding.'),'error'); $InputError = true; } - if(ContainsIllegalCharacters($_POST['ContractRef'])){ + if(ContainsIllegalCharacters($_POST['ContractRef']) OR strpos($_POST['ContractRef'],' ')>0){ prnMsg(_('The contract reference cannot contain any spaces, slashes, or inverted commas. Please alter the contract reference before proceeding.'),'error'); $InputError = true; } @@ -807,7 +807,7 @@ //end of page full new headings if } //end of while loop - echo '<input type="hidden" name="JustSelectedACustomer" value="Yes">'; + echo '<input type="hidden" name="JustSelectedACustomer" value="Yes" />'; echo '</table></form>'; @@ -938,7 +938,9 @@ <th>' . _('Quantity') . '</th> <th>' . _('Unit') . '</th> <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th></tr>'; + <th>' . _('Total Cost') . '</th> + </tr>'; + foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { echo '<tr><td>' . $Component->StockID . '</td> <td>' . $Component->ItemDescription . '</td> @@ -949,22 +951,32 @@ </tr>'; $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); } - echo '<tr><th colspan="5"><b>' . _('Total stock cost') . '</b></th> - <th class="number"><b>' . number_format($ContractBOMCost,2) . '</b></th></tr>'; + echo '<tr> + <th colspan="5"><b>' . _('Total stock cost') . '</b></th> + <th class="number"><b>' . number_format($ContractBOMCost,2) . '</b></th> + </tr>'; } else { //there are no items set up against this contract - echo '<tr><td colspan="6"><i>' . _('None Entered') . '</i></td></tr>'; + echo '<tr> + <td colspan="6"><i>' . _('None Entered') . '</i></td> + </tr>'; } echo '</table></td>'; //end of contract BOM table echo '<td valign="top"> - <table class="selection"><tr><th colspan="4">' . _('Other Requirements') . '</th></tr>'; + <table class="selection"> + <tr> + <th colspan="4">' . _('Other Requirements') . '</th> + </tr>'; $ContractReqtsCost = 0; if (count($_SESSION['Contract'.$identifier]->ContractReqts)!=0){ - echo '<tr><th>' . _('Requirement') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit Cost') . '</th> - <th>' . _('Total Cost') . '</th></tr>'; + echo '<tr> + <th>' . _('Requirement') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + </tr>'; foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { - echo '<tr><td>' . $Requirement->Requirement . '</td> + echo '<tr> + <td>' . $Requirement->Requirement . '</td> <td class="number">' . $Requirement->Quantity . '</td> <td class="number">' . $Requirement->CostPerUnit . '</td> <td class="number">' . number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/Credit_Invoice.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -1523,7 +1523,7 @@ } $j++; echo '<tr><td>' . _('Credit note text') . '</td><td><textarea tabindex=' . $j . ' name=CreditText cols=31 rows=5>' . $_POST['CreditText'] . '</textarea></td></tr>'; - echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update Value=' . _('Update') . '><p>'; + echo '</table><br /><div class="centre"><input tabindex=' . $j . ' type=submit name=Update value=' . _('Update') . '><p>'; $j++; echo '<input type="submit" tabindex='.$j++.' name="ProcessCredit" Value="' . _('Process Credit') .'"></div>'; } Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/PO_PDFPurchOrder.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -245,6 +245,16 @@ $OrderTotal += ($POLine['unitprice']*$POLine['quantityord']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize,$POLine['itemcode'], 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize,$Desc, 'left'); + while (strlen($LeftOvers) > 1){ + $YPos-=$line_height; + if ($YPos-$line_height <= $Bottom_Margin){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$Page_Height - $FormDesign->Data->y; + include ('includes/PO_PDFOrderPageHeader.inc'); + } + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize,$LeftOvers, 'left'); + } //end if need a new page headed up $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize,$DisplayQty, 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize,$POLine['suppliersunit'], 'left'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize,$DisplayDelDate, 'left'); Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/SalesInquiry.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -56,8 +56,7 @@ //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) -{ +function submit(&$db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$savesummarytype) { //initialize no input errors $InputError = 0; @@ -76,13 +75,13 @@ prnMsg(_('Invalid To Date'),'error'); } - if ($_POST['ReportType'] == 'Summary' && $_POST['DateType'] == 'Order' && $_POST['SummaryType'] == 'transno') { + if ($_POST['ReportType'] == 'Summary' AND $_POST['DateType'] == 'Order' AND $_POST['SummaryType'] == 'transno') { $InputError = 1; prnMsg(_('Cannot summarize by transaction number with a date type of Order Date'),'error'); return; } - if ($_POST['ReportType'] == 'Detail' && $_POST['DateType'] == 'Order' && $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { + if ($_POST['ReportType'] == 'Detail' AND $_POST['DateType'] == 'Order' AND $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { $InputError = 1; prnMsg(_('Cannot sort by transaction number with a date type of Order Date'),'error'); return; @@ -99,7 +98,7 @@ # Add more to WHERE statement, if user entered something for the part number,debtorno, name // Variables that end with Op - meaning operator - are either = or LIKE $WherePart = ' '; - if (strlen($PartNumber) > 0 && $PartNumberOp == 'LIKE') { + if (strlen($PartNumber) > 0 AND $PartNumberOp == 'LIKE') { $PartNumber = $PartNumber . '%'; } else { $PartNumberOp = '='; @@ -119,7 +118,7 @@ } $WhereDebtorName = ' '; - if (strlen($DebtorName) > 0 && $DebtorNameOp == 'LIKE') { + if (strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { $DebtorName = $DebtorName . '%'; } else { $DebtorNameOp = '='; @@ -1105,7 +1104,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('For Sales Man') . ':</td><td><select name="Salesman">'; - $sql='SELECT salesmancode, salesmanname FROM salesman'; + $sql="SELECT salesmancode, salesmanname FROM salesman"; $SalesmanResult= DB_query($sql,$db); echo '<option selected value="All">' . _('All Salesmen') . '</option>'; While ($myrow = DB_fetch_array($SalesmanResult)){ @@ -1164,8 +1163,7 @@ } // End of function display() -function TempStockmoves(&$db) -{ +function TempStockmoves(&$db) { // When report based on Invoice Date, use stockmoves as the main file, but credit // notes, which are type 11 in stockmoves, do not have the order number in the // reference field; instead they have "Ex Inv - " and then the transno from the Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/SupplierCredit.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -279,16 +279,16 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class=selection>'; -echo '<tr><td><font color=red>' . _('Supplier Credit Note Reference') . ":</font></td> - <td><font size=2><input type=TEXT size=20 maxlength=20 name=SuppReference value='" . $_SESSION['SuppTrans']->SuppReference . "'></td>"; +echo '<tr><td><font color=red>' . _('Supplier Credit Note Reference') . ':</font></td> + <td><font size=2><input type="text" size=20 maxlength=20 name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '"></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ $_SESSION['SuppTrans']->TranDate= Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); } -echo '<td><font color=red>' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ") :</font></td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']. "' size=11 maxlength=10 name='TranDate' value=" . $_SESSION['SuppTrans']->TranDate . '></td>'; -echo '<td><font color=red>' . _('Exchange Rate') . ":</font></td> - <td><input type=TEXT class='number' size=11 maxlength=10 name='ExRate' value=" . $_SESSION['SuppTrans']->ExRate . '></td></tr>'; +echo '<td><font color=red>' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</font></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size=11 maxlength=10 name="TranDate" value="' . $_SESSION['SuppTrans']->TranDate . '"></td>'; +echo '<td><font color=red>' . _('Exchange Rate') . ':</font></td> + <td><input type="text" class="number" size=11 maxlength=10 name="ExRate" value="' . $_SESSION['SuppTrans']->ExRate . '"></td></tr>'; echo '</table>'; echo '<br /><div class="centre"><input type="submit" name="GRNS" value="' . _('Purchase Orders') . '"> '; @@ -315,7 +315,7 @@ <th>' . _('Line Total') . '<br />' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> </tr>'; echo $TableHeader; - $TotalGRNvalue=0; + $TotalGRNValue=0; foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ @@ -344,7 +344,7 @@ <th>' . _('Amount') . '</th></tr>'; echo $TableHeader; - $TotalShiptvalue=0; + $TotalShiptValue=0; $i=0; @@ -443,7 +443,7 @@ <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; - $TotalGLvalue=0; + $TotalGLValue=0; foreach ($_SESSION['SuppTrans']->GLCodes as $EnteredGLCode){ @@ -467,13 +467,13 @@ } if (!isset($TotalGRNValue)) { - $TotalGRNvalue=0; + $TotalGRNValue=0; } if (!isset($TotalGLValue)) { - $TotalGLvalue=0; + $TotalGLValue=0; } if (!isset($TotalShiptValue)) { - $TotalShiptvalue=0; + $TotalShiptValue=0; } if (!isset($TotalContractsValue)){ $TotalContractsValue = 0; @@ -560,7 +560,7 @@ echo '<table class=selection><tr><td><font color=red>' . _('Comments') . '</font></td><td><textarea name=Comments cols=40 rows=2>' . $_SESSION['SuppTrans']->Comments . '</textarea></td></tr></table>'; -echo "<p><div class='centre'><input type=submit name='PostCreditNote' value='" . _('Enter Credit Note') . "'></div>"; +echo '<p><div class="centre"><input type=submit name="PostCreditNote" value="' . _('Enter Credit Note') . '"></div>'; if (isset($_POST['PostCreditNote'])){ Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2011-06-23 09:44:04 UTC (rev 4604) +++ trunk/includes/class.pdf.php 2011-06-25 10:55:02 UTC (rev 4605) @@ -70,11 +70,11 @@ TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2,$style); } - function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0) + function addText($xb,$YPos,$size,$text)//,$angle=0,$wordSpaceAdjust=0) { // Javier $text = html_entity_decode($text); $this->SetFontSize($size); - $this->Text($xb, $this->h-$yb, $text); + $this->Text($xb, $this->h-$YPos, $text); } function addInfo($label, $value) { @@ -103,8 +103,8 @@ } - function addJpegFromFile($img,$x,$y,$w=0,$h=0){ - $this->Image($img, $x, $this->h-$y-$h, $w, $h); + function addJpegFromFile($img,$XPos,$y,$Width=0,$Height=0){ + $this->Image($img, $XPos, $this->h-$y-$Height, $Width, $Height); } /* @@ -242,33 +242,35 @@ $this->line($XPos, $YPos-$Height, $XPos, $YPos); } - function addTextWrap($x, $yb, $w, $h, $txt, $align='J', $border=0, $fill=0) { - - //$txt = html_entity_decode($txt); - + function addTextWrap($XPos, $YPos, $Width, $Height, $Text, $Align='J', $border=0, $fill=0) { + + /* Returns the balance of the string that could not fit in the width + * XPos = pdf horizontal coordinate + * YPos = pdf vertical coordiante + */ //some special characters are html encoded //this code serves to make them appear human readable in pdf file - $txt = html_entity_decode($txt, ENT_QUOTES, 'UTF-8'); + $Text = html_entity_decode($Text, ENT_QUOTES, 'UTF-8'); - $this->x = $x; - $this->y = $this->h - $yb - $h; + $this->x = $XPos; + $this->y = $this->h - $YPos - $Height; - switch($align) { + switch($Align) { case 'right': - $align = 'R'; break; + $Align = 'R'; break; case 'center': - $align = 'C'; break; + $Align = 'C'; break; default: - $align = 'L'; + $Align = 'L'; } - $this->SetFontSize($h); + $this->SetFontSize($Height); $cw=&$this->CurrentFont['cw']; - if($w==0) { - $w=$this->w-$this->rMargin-$this->x; + if($Width==0) { + $Width=$this->w-$this->rMargin-$this->x; } - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); + $wmax=($Width-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$Text); $s=str_replace("\n",' ',$s); $s = trim($s).' '; $nb=strlen($s); @@ -318,13 +320,13 @@ } $sep = $i; } else { - if($align=='J') { + if($Align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } } - $this->Cell($w,$h,substr($s,0,$sep),$b,2,$align,$fill); + $this->Cell($Width,$Height,substr($s,0,$sep),$b,2,$Align,$fill); $this->x=$this->lMargin; return substr($s, $sep); } //end function addTextWrap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-23 09:44:12
|
Revision: 4604 http://web-erp.svn.sourceforge.net/web-erp/?rev=4604&view=rev Author: daintree Date: 2011-06-23 09:44:04 +0000 (Thu, 23 Jun 2011) Log Message: ----------- credit checks reinstated Modified Paths: -------------- trunk/AccountGroups.php trunk/PO_Items.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/GetSalesTransGLCodes.inc trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/AccountGroups.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -84,10 +84,10 @@ $i++; } else { $sql = "SELECT pandl, - sequenceintb, - sectioninaccounts - FROM accountgroups - WHERE groupname='" . $_POST['ParentGroupName'] . "'"; + sequenceintb, + sectioninaccounts + FROM accountgroups + WHERE groupname='" . $_POST['ParentGroupName'] . "'"; $DbgMsg = _('The SQL that was used to retrieve the information was'); $ErrMsg = _('Could not check whether the group is recursive because'); @@ -98,6 +98,7 @@ $_POST['SequenceInTB'] = $ParentGroupRow['sequenceintb']; $_POST['PandL'] = $ParentGroupRow['pandl']; $_POST['SectionInAccounts']= $ParentGroupRow['sectioninaccounts']; + prnMsg(_('Since this account group is a child group, the sequence in the trial balance, the section in the accounts and whether or not the account group appears in the balance sheet or profit and loss account are all properties inherited from the parent account group. Any changes made to these fields will have no effect.'),'warn'); } } if (!is_long((int) $_POST['SectionInAccounts'])) { Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/PO_Items.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -515,7 +515,7 @@ foreach ($_SESSION['PO'.$identifier]->LineItems AS $OrderItem) { /* do a loop round the items on the order to see that the item is not already on this order */ - if (($OrderItem->StockID == $ItemCode) and ($OrderItem->Deleted==false)) { + if (($OrderItem->StockID == $ItemCode) AND ($OrderItem->Deleted==false)) { $AlreadyOnThisOrder = 1; prnMsg( _('The item') . ' ' . $ItemCode . ' ' . _('is already on this order') . '. ' . _('The system will not allow the same item on the order more than once') . '. ' . _('However you can change the quantity ordered of the existing line if necessary'),'error'); } @@ -524,12 +524,13 @@ } if ($AlreadyOnThisOrder!=1 AND $Quantity > 0){ $sql = "SELECT description, + longdescription, stockid, units, decimalplaces, stockact, accountname - FROM stockmaster INNER JOIN stockcategory + FROM stockmaster INNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid INNER JOIN chartmaster ON chartmaster.accountcode = stockcategory.stockact @@ -548,16 +549,16 @@ suppliers_partno, leadtime, MAX(purchdata.effectivefrom) AS latesteffectivefrom - FROM purchdata - WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' - AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND purchdata.stockid = '". $ItemCode . "' - GROUP BY purchdata.price, - purchdata.conversionfactor, - purchdata.supplierdescription, - purchdata.suppliersuom, - purchdata.suppliers_partno, - purchdata.leadtime"; + FROM purchdata + WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' + AND purchdata.stockid = '". $ItemCode . "' + GROUP BY purchdata.price, + purchdata.conversionfactor, + purchdata.supplierdescription, + purchdata.suppliersuom, + purchdata.suppliers_partno, + purchdata.leadtime"; $ErrMsg = _('The purchasing data for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the purchasing data but failed was'); Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/SelectOrderItems.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -511,6 +511,7 @@ prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ + $_SESSION['Items'.$identifier]->CreditAvailable = GetCreditAvailable($_SESSION['Items'.$identifier]->DebtorNo,$db); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ @@ -993,13 +994,13 @@ * and before that we need to add a disposal stock category - if not already created * first off get the details about the asset being disposed of */ $AssetDetailsResult = DB_query("SELECT fixedassets.description, - fixedassets.longdescription, - fixedassets.barcode, - fixedassetcategories.costact, - fixedassets.cost-fixedassets.accumdepn AS nbv - FROM fixedassetcategories INNER JOIN fixedassets - ON fixedassetcategories.categoryid=fixedassets.assetcategoryid - WHERE fixedassets.assetid='" . $_POST['AssetToDisposeOf'] . "'",$db); + fixedassets.longdescription, + fixedassets.barcode, + fixedassetcategories.costact, + fixedassets.cost-fixedassets.accumdepn AS nbv + FROM fixedassetcategories INNER JOIN fixedassets + ON fixedassetcategories.categoryid=fixedassets.assetcategoryid + WHERE fixedassets.assetid='" . $_POST['AssetToDisposeOf'] . "'",$db); $AssetRow = DB_fetch_array($AssetDetailsResult); /* Check that the stock category for disposal "ASSETS" is defined already */ @@ -1138,17 +1139,36 @@ OR $OrderLine->Narrative != $Narrative OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { + + $WithinCreditLimit = true; + + if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn + and 2 for prohibit sales */ + $DifferenceInOrderValue = ($Quantity*$Price*(1-$DiscountPercentage/100)) - ($OrderLine->Quantity*$OrderLine->Price*(1-$OrderLine->DiscountPercentage)); + + $_SESSION['Items'.$identifier]->CreditAvailable -= $DifferenceInOrderValue; - $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, - $Quantity, - $Price, - ($DiscountPercentage/100), - $Narrative, - 'Yes', /*Update DB */ - $_POST['ItemDue_' . $OrderLine->LineNumber], - $_POST['POLine_' . $OrderLine->LineNumber], - $_POST['GPPercent_' . $OrderLine->LineNumber]); - } + if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ + prnMsg(_('The customer account will breach their credit limit'),'warn'); + } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ + prnMsg(_('This change would put the customer over their credit limit and is prohibited'),'warn'); + $WithinCreditLimit = false; + $_SESSION['Items'.$identifier]->CreditAvailable += $DifferenceInOrderValue; + } + } + + if ($WithinCreditLimit){ + $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, + $Quantity, + $Price, + ($DiscountPercentage/100), + $Narrative, + 'Yes', /*Update DB */ + $_POST['ItemDue_' . $OrderLine->LineNumber], + $_POST['POLine_' . $OrderLine->LineNumber], + $_POST['GPPercent_' . $OrderLine->LineNumber]); + } //within credit limit so make changes + } //there are changes to the order line to process } //page not called from itself - POST variables not set } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/doc/Change.log 2011-06-23 09:44:04 UTC (rev 4604) @@ -1,5 +1,7 @@ webERP Change Log +22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids +23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off 18/6/11 Phil: Made up a includes/LanguagesArray.php to contain a list of languages and the translated name of the language - updated WWW_Users.php and UserSettings.php and CustLoginSetup.php to use this array - so the selection of a language uses the language name rather than the locale codes 14/6/11 Phil: Added email to custcontacts and updated AddCustomerContacts.php SelectCustomer.php and Customers.php Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/DefineCartClass.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -148,21 +148,21 @@ global $db; $sql = "INSERT INTO salesorderdetails (orderlineno, - orderno, - stkcode, - quantity, - unitprice, - discountpercent, - itemdue, - poline) - VALUES(" . $this->LineCounter . ", - " . $_SESSION['ExistingOrder'] . ", - '" . trim(strtoupper($StockID)) ."', - " . $Qty . ", - " . $Price . ", - " . $Disc . ",' - " . $ItemDue . "', - " . $POLine . ")"; + orderno, + stkcode, + quantity, + unitprice, + discountpercent, + itemdue, + poline) + VALUES(" . $this->LineCounter . ", + " . $_SESSION['ExistingOrder'] . ", + '" . trim(strtoupper($StockID)) ."', + " . $Qty . ", + " . $Price . ", + " . $Disc . ",' + " . $ItemDue . "', + " . $POLine . ")"; $result = DB_query($sql, $db , _('The order line for') . ' ' . strtoupper($StockID) . ' ' ._('could not be inserted')); @@ -175,14 +175,14 @@ } function update_cart_item( $UpdateLineNumber, - $Qty, - $Price, - $Disc, - $Narrative, - $UpdateDB='No', - $ItemDue, - $POLine, - $GPPercent){ + $Qty, + $Price, + $Disc, + $Narrative, + $UpdateDB='No', + $ItemDue, + $POLine, + $GPPercent){ if ($Qty>0){ $this->LineItems[$UpdateLineNumber]->Quantity = $Qty; @@ -236,6 +236,7 @@ } } /* Since we need to check the LineItem above and might affect the DB, don't unset until after DB is updates occur */ + $this->CreditAvailable += ($this->LineItems[$LineNumber]->Quantity*$this->LineItems[$LineNumber]->Price*(1-$this->LineItems[$LineNumber]->DiscountPercent)); unset($this->LineItems[$LineNumber]); $this->ItemsOrdered--; Modified: trunk/includes/GetSalesTransGLCodes.inc =================================================================== --- trunk/includes/GetSalesTransGLCodes.inc 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/GetSalesTransGLCodes.inc 2011-06-23 09:44:04 UTC (rev 4604) @@ -71,7 +71,7 @@ FROM cogsglpostings WHERE area = 'AN' AND salestype='AN' - AND stkcat = '$StockCategory'"; + AND stkcat = '" . $StockCategory . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -81,7 +81,7 @@ DB_free_result($Result); $SQL = "SELECT glcode FROM cogsglpostings - WHERE area = '$Area' + WHERE area = '" . $Area . "' AND stkcat = 'ANY' AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); @@ -112,7 +112,7 @@ /*The default if all else fails */ /*Check GL account 1 exists */ prnMsg(_('Could not determine the correct general ledger account to use for posting the cost of this sale. Go to the setup menu and define appropriate COGS (Cost Of Goods Sold) accounts. To enable this invoice to be posted it has been posted to default sales and COGS - account number 1'),'warn'); - $SQL = 'SELECT accountcode FROM chartmaster WHERE accountcode=1'; + $SQL = "SELECT accountcode FROM chartmaster WHERE accountcode=1"; $Result = DB_query($SQL,$db); if (DB_num_rows($Result)==0){ /*It doesn't exist so create it */ $Result = DB_query("SELECT groupname FROM accountgroups WHERE groupname='Sales'",$db); @@ -177,12 +177,12 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); - $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '" . $Area . "' - AND stkcat = '" . $StockCategory . "' - AND salestype = 'AN'"; + $SQL = "SELECT salesglcode, + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = '" . $StockCategory . "' + AND salestype = 'AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -190,11 +190,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '" . $Area . "' - AND stkcat = 'ANY' - AND salestype = '" . $SalesType . "'"; + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = 'ANY' + AND salestype = '" . $SalesType . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -202,11 +202,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND salestype='AN' - AND stkcat = '$StockCategory'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND salestype='AN' + AND stkcat = '" . $StockCategory . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -214,11 +214,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '$Area' - AND stkcat = 'ANY' - AND salestype='AN'"; + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = 'ANY' + AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -226,11 +226,11 @@ if (DB_num_rows($Result)==0) { DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND stkcat = 'ANY' - AND salestype = '" . $SalesType . "'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND stkcat = 'ANY' + AND salestype = '" . $SalesType . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -238,11 +238,11 @@ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND stkcat = 'ANY' - AND salestype='AN'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND stkcat = 'ANY' + AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -250,30 +250,30 @@ /*The default if all else fails */ prnMsg(_('Could not determine the correct general ledger account to use for posting this sale to. Go to the setup menu and define appropriate Sale GL Posting accounts. To enable this invoice to be posted it has been posted to default sales and COGS - account number 1'),'warn'); /*Check GL account 1 exists */ - $SQL = 'SELECT accountcode FROM chartmaster WHERE accountcode=1'; + $SQL = "SELECT accountcode FROM chartmaster WHERE accountcode=1"; $Result = DB_query($SQL,$db); if (DB_num_rows($Result)==0){ /*It doesn't exist so create it */ /*First check the account group sales exists */ $Result = DB_query("SELECT groupname FROM accountgroups WHERE groupname='Sales'",$db); if (DB_num_rows($Result)==0) { - $Result = DB_query("INSERT INTO accountgroups (groupname, - sectioninaccounts, - pandl, - sequenceintb) - VALUES ('Sales', - 1, - 1, - 5)", - $db); + $Result = DB_query("INSERT INTO accountgroups (groupname, + sectioninaccounts, + pandl, + sequenceintb) + VALUES ('Sales', + 1, + 1, + 5)", + $db); } $SQL = "INSERT INTO chartmaster VALUES (1, 'Default Sales and COGS', 'Sales')"; $Result = DB_query($SQL,$db); } - return array(salesglcode=>1, - discountglcode=>1); + return array('salesglcode'=>1, + 'discountglcode'=>1); } $myrow = DB_fetch_array($Result); - Return $myrow; + return $myrow; } ?> \ No newline at end of file Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-06-23 09:44:04 UTC (rev 4604) @@ -111,24 +111,22 @@ $WithinCreditLimit = true; - if (!isset($_SESSION['WarnOnce']) and $_SESSION['Items'.$identifier]->SpecialInstructions) { + if ($_SESSION['Items'.$identifier]->SpecialInstructions) { prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); - $WarnOnce=1; } if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items'.$identifier]->CreditAvailable -= round(($NewItemQty * $Price * (1- $Discount)),2); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ - if (isset($_SESSION['WarnOnce']) and $_SESSION['WarnOnce'] < 2) prnMsg(_('The customer account will breach their credit limit'),'warn'); - $_SESSION['WarnOnce']=2; + prnMsg(_('The customer account will breach their credit limit'),'warn'); } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('No more lines can be added to this order the customer account is currently at or over their credit limit'),'warn'); $WithinCreditLimit = false; } } - if ($WithinCreditLimit ==true){ + if ($WithinCreditLimit == true){ $_SESSION['Items'.$identifier]->add_to_cart ($NewItem, $NewItemQty, $myItemRow['description'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-23 09:44:12
|
Revision: 4604 http://web-erp.svn.sourceforge.net/web-erp/?rev=4604&view=rev Author: daintree Date: 2011-06-23 09:44:04 +0000 (Thu, 23 Jun 2011) Log Message: ----------- credit checks reinstated Modified Paths: -------------- trunk/AccountGroups.php trunk/PO_Items.php trunk/SelectOrderItems.php trunk/doc/Change.log trunk/includes/DefineCartClass.php trunk/includes/GetSalesTransGLCodes.inc trunk/includes/SelectOrderItems_IntoCart.inc Modified: trunk/AccountGroups.php =================================================================== --- trunk/AccountGroups.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/AccountGroups.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -84,10 +84,10 @@ $i++; } else { $sql = "SELECT pandl, - sequenceintb, - sectioninaccounts - FROM accountgroups - WHERE groupname='" . $_POST['ParentGroupName'] . "'"; + sequenceintb, + sectioninaccounts + FROM accountgroups + WHERE groupname='" . $_POST['ParentGroupName'] . "'"; $DbgMsg = _('The SQL that was used to retrieve the information was'); $ErrMsg = _('Could not check whether the group is recursive because'); @@ -98,6 +98,7 @@ $_POST['SequenceInTB'] = $ParentGroupRow['sequenceintb']; $_POST['PandL'] = $ParentGroupRow['pandl']; $_POST['SectionInAccounts']= $ParentGroupRow['sectioninaccounts']; + prnMsg(_('Since this account group is a child group, the sequence in the trial balance, the section in the accounts and whether or not the account group appears in the balance sheet or profit and loss account are all properties inherited from the parent account group. Any changes made to these fields will have no effect.'),'warn'); } } if (!is_long((int) $_POST['SectionInAccounts'])) { Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/PO_Items.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -515,7 +515,7 @@ foreach ($_SESSION['PO'.$identifier]->LineItems AS $OrderItem) { /* do a loop round the items on the order to see that the item is not already on this order */ - if (($OrderItem->StockID == $ItemCode) and ($OrderItem->Deleted==false)) { + if (($OrderItem->StockID == $ItemCode) AND ($OrderItem->Deleted==false)) { $AlreadyOnThisOrder = 1; prnMsg( _('The item') . ' ' . $ItemCode . ' ' . _('is already on this order') . '. ' . _('The system will not allow the same item on the order more than once') . '. ' . _('However you can change the quantity ordered of the existing line if necessary'),'error'); } @@ -524,12 +524,13 @@ } if ($AlreadyOnThisOrder!=1 AND $Quantity > 0){ $sql = "SELECT description, + longdescription, stockid, units, decimalplaces, stockact, accountname - FROM stockmaster INNER JOIN stockcategory + FROM stockmaster INNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid INNER JOIN chartmaster ON chartmaster.accountcode = stockcategory.stockact @@ -548,16 +549,16 @@ suppliers_partno, leadtime, MAX(purchdata.effectivefrom) AS latesteffectivefrom - FROM purchdata - WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' - AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND purchdata.stockid = '". $ItemCode . "' - GROUP BY purchdata.price, - purchdata.conversionfactor, - purchdata.supplierdescription, - purchdata.suppliersuom, - purchdata.suppliers_partno, - purchdata.leadtime"; + FROM purchdata + WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' + AND purchdata.stockid = '". $ItemCode . "' + GROUP BY purchdata.price, + purchdata.conversionfactor, + purchdata.supplierdescription, + purchdata.suppliersuom, + purchdata.suppliers_partno, + purchdata.leadtime"; $ErrMsg = _('The purchasing data for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the purchasing data but failed was'); Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/SelectOrderItems.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -511,6 +511,7 @@ prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ + $_SESSION['Items'.$identifier]->CreditAvailable = GetCreditAvailable($_SESSION['Items'.$identifier]->DebtorNo,$db); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ @@ -993,13 +994,13 @@ * and before that we need to add a disposal stock category - if not already created * first off get the details about the asset being disposed of */ $AssetDetailsResult = DB_query("SELECT fixedassets.description, - fixedassets.longdescription, - fixedassets.barcode, - fixedassetcategories.costact, - fixedassets.cost-fixedassets.accumdepn AS nbv - FROM fixedassetcategories INNER JOIN fixedassets - ON fixedassetcategories.categoryid=fixedassets.assetcategoryid - WHERE fixedassets.assetid='" . $_POST['AssetToDisposeOf'] . "'",$db); + fixedassets.longdescription, + fixedassets.barcode, + fixedassetcategories.costact, + fixedassets.cost-fixedassets.accumdepn AS nbv + FROM fixedassetcategories INNER JOIN fixedassets + ON fixedassetcategories.categoryid=fixedassets.assetcategoryid + WHERE fixedassets.assetid='" . $_POST['AssetToDisposeOf'] . "'",$db); $AssetRow = DB_fetch_array($AssetDetailsResult); /* Check that the stock category for disposal "ASSETS" is defined already */ @@ -1138,17 +1139,36 @@ OR $OrderLine->Narrative != $Narrative OR $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] OR $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) { + + $WithinCreditLimit = true; + + if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn + and 2 for prohibit sales */ + $DifferenceInOrderValue = ($Quantity*$Price*(1-$DiscountPercentage/100)) - ($OrderLine->Quantity*$OrderLine->Price*(1-$OrderLine->DiscountPercentage)); + + $_SESSION['Items'.$identifier]->CreditAvailable -= $DifferenceInOrderValue; - $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, - $Quantity, - $Price, - ($DiscountPercentage/100), - $Narrative, - 'Yes', /*Update DB */ - $_POST['ItemDue_' . $OrderLine->LineNumber], - $_POST['POLine_' . $OrderLine->LineNumber], - $_POST['GPPercent_' . $OrderLine->LineNumber]); - } + if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ + prnMsg(_('The customer account will breach their credit limit'),'warn'); + } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ + prnMsg(_('This change would put the customer over their credit limit and is prohibited'),'warn'); + $WithinCreditLimit = false; + $_SESSION['Items'.$identifier]->CreditAvailable += $DifferenceInOrderValue; + } + } + + if ($WithinCreditLimit){ + $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, + $Quantity, + $Price, + ($DiscountPercentage/100), + $Narrative, + 'Yes', /*Update DB */ + $_POST['ItemDue_' . $OrderLine->LineNumber], + $_POST['POLine_' . $OrderLine->LineNumber], + $_POST['GPPercent_' . $OrderLine->LineNumber]); + } //within credit limit so make changes + } //there are changes to the order line to process } //page not called from itself - POST variables not set } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/doc/Change.log 2011-06-23 09:44:04 UTC (rev 4604) @@ -1,5 +1,7 @@ webERP Change Log +22/6/11 Phil: Added message to AccountGroups.php to show that child account groups cannot have changes to their account section, their profit and loss or balance sheet and sequence in TB as these properties belong only to parent account groups and are inherited by the kids +23/6/11 Phil: SelectOrderItems.php includes/DefineCartClass.php repaired credit checks 19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off 18/6/11 Phil: Made up a includes/LanguagesArray.php to contain a list of languages and the translated name of the language - updated WWW_Users.php and UserSettings.php and CustLoginSetup.php to use this array - so the selection of a language uses the language name rather than the locale codes 14/6/11 Phil: Added email to custcontacts and updated AddCustomerContacts.php SelectCustomer.php and Customers.php Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/DefineCartClass.php 2011-06-23 09:44:04 UTC (rev 4604) @@ -148,21 +148,21 @@ global $db; $sql = "INSERT INTO salesorderdetails (orderlineno, - orderno, - stkcode, - quantity, - unitprice, - discountpercent, - itemdue, - poline) - VALUES(" . $this->LineCounter . ", - " . $_SESSION['ExistingOrder'] . ", - '" . trim(strtoupper($StockID)) ."', - " . $Qty . ", - " . $Price . ", - " . $Disc . ",' - " . $ItemDue . "', - " . $POLine . ")"; + orderno, + stkcode, + quantity, + unitprice, + discountpercent, + itemdue, + poline) + VALUES(" . $this->LineCounter . ", + " . $_SESSION['ExistingOrder'] . ", + '" . trim(strtoupper($StockID)) ."', + " . $Qty . ", + " . $Price . ", + " . $Disc . ",' + " . $ItemDue . "', + " . $POLine . ")"; $result = DB_query($sql, $db , _('The order line for') . ' ' . strtoupper($StockID) . ' ' ._('could not be inserted')); @@ -175,14 +175,14 @@ } function update_cart_item( $UpdateLineNumber, - $Qty, - $Price, - $Disc, - $Narrative, - $UpdateDB='No', - $ItemDue, - $POLine, - $GPPercent){ + $Qty, + $Price, + $Disc, + $Narrative, + $UpdateDB='No', + $ItemDue, + $POLine, + $GPPercent){ if ($Qty>0){ $this->LineItems[$UpdateLineNumber]->Quantity = $Qty; @@ -236,6 +236,7 @@ } } /* Since we need to check the LineItem above and might affect the DB, don't unset until after DB is updates occur */ + $this->CreditAvailable += ($this->LineItems[$LineNumber]->Quantity*$this->LineItems[$LineNumber]->Price*(1-$this->LineItems[$LineNumber]->DiscountPercent)); unset($this->LineItems[$LineNumber]); $this->ItemsOrdered--; Modified: trunk/includes/GetSalesTransGLCodes.inc =================================================================== --- trunk/includes/GetSalesTransGLCodes.inc 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/GetSalesTransGLCodes.inc 2011-06-23 09:44:04 UTC (rev 4604) @@ -71,7 +71,7 @@ FROM cogsglpostings WHERE area = 'AN' AND salestype='AN' - AND stkcat = '$StockCategory'"; + AND stkcat = '" . $StockCategory . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -81,7 +81,7 @@ DB_free_result($Result); $SQL = "SELECT glcode FROM cogsglpostings - WHERE area = '$Area' + WHERE area = '" . $Area . "' AND stkcat = 'ANY' AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); @@ -112,7 +112,7 @@ /*The default if all else fails */ /*Check GL account 1 exists */ prnMsg(_('Could not determine the correct general ledger account to use for posting the cost of this sale. Go to the setup menu and define appropriate COGS (Cost Of Goods Sold) accounts. To enable this invoice to be posted it has been posted to default sales and COGS - account number 1'),'warn'); - $SQL = 'SELECT accountcode FROM chartmaster WHERE accountcode=1'; + $SQL = "SELECT accountcode FROM chartmaster WHERE accountcode=1"; $Result = DB_query($SQL,$db); if (DB_num_rows($Result)==0){ /*It doesn't exist so create it */ $Result = DB_query("SELECT groupname FROM accountgroups WHERE groupname='Sales'",$db); @@ -177,12 +177,12 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); - $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '" . $Area . "' - AND stkcat = '" . $StockCategory . "' - AND salestype = 'AN'"; + $SQL = "SELECT salesglcode, + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = '" . $StockCategory . "' + AND salestype = 'AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -190,11 +190,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '" . $Area . "' - AND stkcat = 'ANY' - AND salestype = '" . $SalesType . "'"; + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = 'ANY' + AND salestype = '" . $SalesType . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -202,11 +202,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND salestype='AN' - AND stkcat = '$StockCategory'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND salestype='AN' + AND stkcat = '" . $StockCategory . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -214,11 +214,11 @@ if (DB_num_rows($Result)==0){ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = '$Area' - AND stkcat = 'ANY' - AND salestype='AN'"; + discountglcode + FROM salesglpostings + WHERE area = '" . $Area . "' + AND stkcat = 'ANY' + AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -226,11 +226,11 @@ if (DB_num_rows($Result)==0) { DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND stkcat = 'ANY' - AND salestype = '" . $SalesType . "'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND stkcat = 'ANY' + AND salestype = '" . $SalesType . "'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -238,11 +238,11 @@ DB_free_result($Result); $SQL = "SELECT salesglcode, - discountglcode - FROM salesglpostings - WHERE area = 'AN' - AND stkcat = 'ANY' - AND salestype='AN'"; + discountglcode + FROM salesglpostings + WHERE area = 'AN' + AND stkcat = 'ANY' + AND salestype='AN'"; $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -250,30 +250,30 @@ /*The default if all else fails */ prnMsg(_('Could not determine the correct general ledger account to use for posting this sale to. Go to the setup menu and define appropriate Sale GL Posting accounts. To enable this invoice to be posted it has been posted to default sales and COGS - account number 1'),'warn'); /*Check GL account 1 exists */ - $SQL = 'SELECT accountcode FROM chartmaster WHERE accountcode=1'; + $SQL = "SELECT accountcode FROM chartmaster WHERE accountcode=1"; $Result = DB_query($SQL,$db); if (DB_num_rows($Result)==0){ /*It doesn't exist so create it */ /*First check the account group sales exists */ $Result = DB_query("SELECT groupname FROM accountgroups WHERE groupname='Sales'",$db); if (DB_num_rows($Result)==0) { - $Result = DB_query("INSERT INTO accountgroups (groupname, - sectioninaccounts, - pandl, - sequenceintb) - VALUES ('Sales', - 1, - 1, - 5)", - $db); + $Result = DB_query("INSERT INTO accountgroups (groupname, + sectioninaccounts, + pandl, + sequenceintb) + VALUES ('Sales', + 1, + 1, + 5)", + $db); } $SQL = "INSERT INTO chartmaster VALUES (1, 'Default Sales and COGS', 'Sales')"; $Result = DB_query($SQL,$db); } - return array(salesglcode=>1, - discountglcode=>1); + return array('salesglcode'=>1, + 'discountglcode'=>1); } $myrow = DB_fetch_array($Result); - Return $myrow; + return $myrow; } ?> \ No newline at end of file Modified: trunk/includes/SelectOrderItems_IntoCart.inc =================================================================== --- trunk/includes/SelectOrderItems_IntoCart.inc 2011-06-21 09:28:57 UTC (rev 4603) +++ trunk/includes/SelectOrderItems_IntoCart.inc 2011-06-23 09:44:04 UTC (rev 4604) @@ -111,24 +111,22 @@ $WithinCreditLimit = true; - if (!isset($_SESSION['WarnOnce']) and $_SESSION['Items'.$identifier]->SpecialInstructions) { + if ($_SESSION['Items'.$identifier]->SpecialInstructions) { prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); - $WarnOnce=1; } if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ $_SESSION['Items'.$identifier]->CreditAvailable -= round(($NewItemQty * $Price * (1- $Discount)),2); if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ - if (isset($_SESSION['WarnOnce']) and $_SESSION['WarnOnce'] < 2) prnMsg(_('The customer account will breach their credit limit'),'warn'); - $_SESSION['WarnOnce']=2; + prnMsg(_('The customer account will breach their credit limit'),'warn'); } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ prnMsg(_('No more lines can be added to this order the customer account is currently at or over their credit limit'),'warn'); $WithinCreditLimit = false; } } - if ($WithinCreditLimit ==true){ + if ($WithinCreditLimit == true){ $_SESSION['Items'.$identifier]->add_to_cart ($NewItem, $NewItemQty, $myItemRow['description'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-21 09:29:05
|
Revision: 4603 http://web-erp.svn.sourceforge.net/web-erp/?rev=4603&view=rev Author: daintree Date: 2011-06-21 09:28:57 +0000 (Tue, 21 Jun 2011) Log Message: ----------- more explanation of postings Modified Paths: -------------- trunk/doc/Manual/ManualManufacturing.html trunk/includes/DefineCartClass.php Modified: trunk/doc/Manual/ManualManufacturing.html =================================================================== --- trunk/doc/Manual/ManualManufacturing.html 2011-06-19 10:21:11 UTC (rev 4602) +++ trunk/doc/Manual/ManualManufacturing.html 2011-06-21 09:28:57 UTC (rev 4603) @@ -33,6 +33,19 @@ <li>Closing the work order - compares the quantity of components issued against the bill of material at the time of the first receipt of the manufactured items - the volume differences are evaluated at the standard cost (as at the time of the first receipt of manufactured item) to come up with the usage variance posted to the debit or credit of the manufactured item's stock category record's usage variance account. Then the cost of the items issued to the work order are compared against the cost as at the time the first receipt of the manufactured item was entered - differences here are taken to the price variances account in the manufactured item's stock category record. It is the closing of the work order that ensures that the costs received from the work order in the form of manufacturing output equals the cost of the inputs - the various components and materials issued to the work order</li> </ul> <br /><br /> +<table border=1> +<tr><th>Event</th><th>Debit</th><th>Credit</th></tr> +<tr><td>Components issued to the work order</td><td>WIP a/ct from stock category of manufactured item</td><td>Stock account from the category of the component item</td></tr> +<tr><td>Labour issued to the work order (identical to any other component except that labour type categories have profit and loss accounts for their stock account)</td><td>WIP a/ct from stock category of manufactured item</td><td>Labour recovery account from category of the labour type item</td></tr> +<tr><td>A completed manufactured item is received against the work order</td><td>stock account from the category of the manufactured item</td><td>WIP from the category of the manufactured item</td></tr> +<tr><td>Work order closed and the difference between the WIP debits and credits from the above transactions is compared and the balance is either +<ul> +<li>Standard costing - taken to material usage variance from the stock category of the manufactured item</li> +<li>Weighted average costing - if some of the manufactured stock remains on hand the variance is taken to the stock account from the category of the manufactured item. The cost of the manufactured item is updated with the recalculated WAC</li> +</ul></td> +<td>WIP / <br />Usage variance</td><td>WIP / <br />Usage variance OR stock</td></tr> +</table> +<br /><br /> <font size="+1"><b>Work Order Entry</b></font> <br /><br /> The Work Order is the medium for issuing components/raw materials to. A running total of the costs issued to the work order is maintained. Work orders can be created that have any number of output items. Output items are restricted to only "manufactured" items as defined in the item entry form. The work order tracks the quantity of the output items received against the work order and checks that no more than the work order quantity originally set up, with an allowance including the over-receive proportion as defined for purchase orders, is received. Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-06-19 10:21:11 UTC (rev 4602) +++ trunk/includes/DefineCartClass.php 2011-06-21 09:28:57 UTC (rev 4603) @@ -196,13 +196,13 @@ if ($UpdateDB=='Yes'){ global $db; $result = DB_query("UPDATE salesorderdetails SET quantity=" . $Qty . ", - unitprice=" . $Price . ", - discountpercent=" . $Disc . ", - narrative ='" . DB_escape_string($Narrative) . "', - itemdue = '" . FormatDateForSQL($ItemDue) . "', - poline = '" . DB_escape_string($POLine) . "' - WHERE orderno=" . $_SESSION['ExistingOrder'] . " - AND orderlineno=" . $UpdateLineNumber + unitprice=" . $Price . ", + discountpercent=" . $Disc . ", + narrative ='" . DB_escape_string($Narrative) . "', + itemdue = '" . FormatDateForSQL($ItemDue) . "', + poline = '" . DB_escape_string($POLine) . "' + WHERE orderno=" . $_SESSION['ExistingOrder'] . " + AND orderlineno=" . $UpdateLineNumber , $db , _('The order line number') . ' ' . $UpdateLineNumber . ' ' . _('could not be updated')); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-21 09:29:03
|
Revision: 4603 http://web-erp.svn.sourceforge.net/web-erp/?rev=4603&view=rev Author: daintree Date: 2011-06-21 09:28:57 +0000 (Tue, 21 Jun 2011) Log Message: ----------- more explanation of postings Modified Paths: -------------- trunk/doc/Manual/ManualManufacturing.html trunk/includes/DefineCartClass.php Modified: trunk/doc/Manual/ManualManufacturing.html =================================================================== --- trunk/doc/Manual/ManualManufacturing.html 2011-06-19 10:21:11 UTC (rev 4602) +++ trunk/doc/Manual/ManualManufacturing.html 2011-06-21 09:28:57 UTC (rev 4603) @@ -33,6 +33,19 @@ <li>Closing the work order - compares the quantity of components issued against the bill of material at the time of the first receipt of the manufactured items - the volume differences are evaluated at the standard cost (as at the time of the first receipt of manufactured item) to come up with the usage variance posted to the debit or credit of the manufactured item's stock category record's usage variance account. Then the cost of the items issued to the work order are compared against the cost as at the time the first receipt of the manufactured item was entered - differences here are taken to the price variances account in the manufactured item's stock category record. It is the closing of the work order that ensures that the costs received from the work order in the form of manufacturing output equals the cost of the inputs - the various components and materials issued to the work order</li> </ul> <br /><br /> +<table border=1> +<tr><th>Event</th><th>Debit</th><th>Credit</th></tr> +<tr><td>Components issued to the work order</td><td>WIP a/ct from stock category of manufactured item</td><td>Stock account from the category of the component item</td></tr> +<tr><td>Labour issued to the work order (identical to any other component except that labour type categories have profit and loss accounts for their stock account)</td><td>WIP a/ct from stock category of manufactured item</td><td>Labour recovery account from category of the labour type item</td></tr> +<tr><td>A completed manufactured item is received against the work order</td><td>stock account from the category of the manufactured item</td><td>WIP from the category of the manufactured item</td></tr> +<tr><td>Work order closed and the difference between the WIP debits and credits from the above transactions is compared and the balance is either +<ul> +<li>Standard costing - taken to material usage variance from the stock category of the manufactured item</li> +<li>Weighted average costing - if some of the manufactured stock remains on hand the variance is taken to the stock account from the category of the manufactured item. The cost of the manufactured item is updated with the recalculated WAC</li> +</ul></td> +<td>WIP / <br />Usage variance</td><td>WIP / <br />Usage variance OR stock</td></tr> +</table> +<br /><br /> <font size="+1"><b>Work Order Entry</b></font> <br /><br /> The Work Order is the medium for issuing components/raw materials to. A running total of the costs issued to the work order is maintained. Work orders can be created that have any number of output items. Output items are restricted to only "manufactured" items as defined in the item entry form. The work order tracks the quantity of the output items received against the work order and checks that no more than the work order quantity originally set up, with an allowance including the over-receive proportion as defined for purchase orders, is received. Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2011-06-19 10:21:11 UTC (rev 4602) +++ trunk/includes/DefineCartClass.php 2011-06-21 09:28:57 UTC (rev 4603) @@ -196,13 +196,13 @@ if ($UpdateDB=='Yes'){ global $db; $result = DB_query("UPDATE salesorderdetails SET quantity=" . $Qty . ", - unitprice=" . $Price . ", - discountpercent=" . $Disc . ", - narrative ='" . DB_escape_string($Narrative) . "', - itemdue = '" . FormatDateForSQL($ItemDue) . "', - poline = '" . DB_escape_string($POLine) . "' - WHERE orderno=" . $_SESSION['ExistingOrder'] . " - AND orderlineno=" . $UpdateLineNumber + unitprice=" . $Price . ", + discountpercent=" . $Disc . ", + narrative ='" . DB_escape_string($Narrative) . "', + itemdue = '" . FormatDateForSQL($ItemDue) . "', + poline = '" . DB_escape_string($POLine) . "' + WHERE orderno=" . $_SESSION['ExistingOrder'] . " + AND orderlineno=" . $UpdateLineNumber , $db , _('The order line number') . ' ' . $UpdateLineNumber . ' ' . _('could not be updated')); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-19 10:21:17
|
Revision: 4602 http://web-erp.svn.sourceforge.net/web-erp/?rev=4602&view=rev Author: daintree Date: 2011-06-19 10:21:11 +0000 (Sun, 19 Jun 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Credit_Invoice.php trunk/doc/Change.log Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-06-18 22:27:44 UTC (rev 4601) +++ trunk/Credit_Invoice.php 2011-06-19 10:21:11 UTC (rev 4602) @@ -981,7 +981,7 @@ '" . $OrderLine->QtyDispatched . "', '" . $OrderLine->DiscountPercent . "', '" . $OrderLine->StandardCost . "', - '" . ($QtyOnHandPrior +$OrderLine->QtyDispatched) . "'', + '" . ($QtyOnHandPrior +$OrderLine->QtyDispatched) . "', '" . $OrderLine->Narrative . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); @@ -1502,9 +1502,9 @@ $SQL="SELECT accountcode, accountname - FROM chartmaster, accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode"; + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=1 ORDER BY chartmaster.accountcode"; $Result = DB_query($SQL,$db); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-18 22:27:44 UTC (rev 4601) +++ trunk/doc/Change.log 2011-06-19 10:21:11 UTC (rev 4602) @@ -1,5 +1,6 @@ webERP Change Log +19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off 18/6/11 Phil: Made up a includes/LanguagesArray.php to contain a list of languages and the translated name of the language - updated WWW_Users.php and UserSettings.php and CustLoginSetup.php to use this array - so the selection of a language uses the language name rather than the locale codes 14/6/11 Phil: Added email to custcontacts and updated AddCustomerContacts.php SelectCustomer.php and Customers.php 13/6/11 Phil: Birthdays (xhtml/indenting/quoting/casing/decimalplaces) for Areas.php, BOMInquiry.php, BOMS.php, BankAccounts.php, BankMatching.php, COGSGLPosting.php, CompanyPreferences.php, ConfirmDispatch_Invoice.php StockLocTransfer.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-19 10:21:17
|
Revision: 4602 http://web-erp.svn.sourceforge.net/web-erp/?rev=4602&view=rev Author: daintree Date: 2011-06-19 10:21:11 +0000 (Sun, 19 Jun 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Credit_Invoice.php trunk/doc/Change.log Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2011-06-18 22:27:44 UTC (rev 4601) +++ trunk/Credit_Invoice.php 2011-06-19 10:21:11 UTC (rev 4602) @@ -981,7 +981,7 @@ '" . $OrderLine->QtyDispatched . "', '" . $OrderLine->DiscountPercent . "', '" . $OrderLine->StandardCost . "', - '" . ($QtyOnHandPrior +$OrderLine->QtyDispatched) . "'', + '" . ($QtyOnHandPrior +$OrderLine->QtyDispatched) . "', '" . $OrderLine->Narrative . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); @@ -1502,9 +1502,9 @@ $SQL="SELECT accountcode, accountname - FROM chartmaster, accountgroups - WHERE chartmaster.group_=accountgroups.groupname - AND ccountgroups.pandl=1 ORDER BY chartmaster.accountcode"; + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_=accountgroups.groupname + WHERE accountgroups.pandl=1 ORDER BY chartmaster.accountcode"; $Result = DB_query($SQL,$db); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-06-18 22:27:44 UTC (rev 4601) +++ trunk/doc/Change.log 2011-06-19 10:21:11 UTC (rev 4602) @@ -1,5 +1,6 @@ webERP Change Log +19/6/11 Phil: Credit_Invoice.php typos in quoting changes preventing posting credits on write offs also sql on gl account selection for write off 18/6/11 Phil: Made up a includes/LanguagesArray.php to contain a list of languages and the translated name of the language - updated WWW_Users.php and UserSettings.php and CustLoginSetup.php to use this array - so the selection of a language uses the language name rather than the locale codes 14/6/11 Phil: Added email to custcontacts and updated AddCustomerContacts.php SelectCustomer.php and Customers.php 13/6/11 Phil: Birthdays (xhtml/indenting/quoting/casing/decimalplaces) for Areas.php, BOMInquiry.php, BOMS.php, BankAccounts.php, BankMatching.php, COGSGLPosting.php, CompanyPreferences.php, ConfirmDispatch_Invoice.php StockLocTransfer.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-18 22:27:50
|
Revision: 4601 http://web-erp.svn.sourceforge.net/web-erp/?rev=4601&view=rev Author: daintree Date: 2011-06-18 22:27:44 +0000 (Sat, 18 Jun 2011) Log Message: ----------- ricards earliest dispatch mods Modified Paths: -------------- trunk/SystemParameters.php trunk/includes/DateFunctions.inc trunk/sql/mysql/upgrade4.04.4-4.04.5.sql Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/SystemParameters.php 2011-06-18 22:27:44 UTC (rev 4601) @@ -117,6 +117,9 @@ if ($_SESSION['QuickEntries'] != $_POST['X_QuickEntries'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_QuickEntries']."' WHERE confname = 'QuickEntries'"; } + if ($_SESSION['WorkingDaysWeek'] != $_POST['X_WorkingDaysWeek'] ) { + $sql[] = "UPDATE config SET confvalue = '".$_POST['X_WorkingDaysWeek']."' WHERE confname = 'WorkingDaysWeek'"; + } if ($_SESSION['DispatchCutOffTime'] != $_POST['X_DispatchCutOffTime'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_DispatchCutOffTime']."' WHERE confname = 'DispatchCutOffTime'"; } @@ -458,6 +461,16 @@ <td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td> </tr>'; +// Working days on a week +echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td> + <td><select Name="X_WorkingDaysWeek"> + <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected ':'').'value="7">7 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected ':'').'value="6">6 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected ':'').'value="5">5 '._('working days').'</option> + </select></td> + <td>' . _('Number of working days on a week') . '</td> + </tr>'; + // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> <td><select Name="X_DispatchCutOffTime">'; Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/includes/DateFunctions.inc 2011-06-18 22:27:44 UTC (rev 4601) @@ -777,19 +777,21 @@ function CalcEarliestDispatchDate (){ -/*This function will need to be modified depending on the business - many businesses run 24x7 -The default assumes no delivery on Sat and Sun*/ +/*There is a system parameter that allows the number of working days to be defined $_SESSION['WorkingDaysWeek'] if this is set to 5 then the assumption is no delivery on Sat and Sun + * if the number of working days is 6 then it is assumed that there is no delivery on Sunday + * if the number of working days is 7 then there are deliveries every day + * */ $EarliestDispatch = time(); - if (Date('w',$EarliestDispatch)==0 ){ + if ((Date('w',$EarliestDispatch)==0) AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a sunday the dispatch date must be tomorrow (Monday) or after */ +/*if today is a sunday AND the company does NOT work 7 days a week, the dispatch date must be tomorrow (Monday) or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+1,Date('y',$EarliestDispatch)); - } elseif (Date('w',$EarliestDispatch)==6){ + } elseif ((Date('w',$EarliestDispatch)==6) AND ($_SESSION['WorkingDaysWeek'] != '6') AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a saturday the dispatch date must be Monday or after */ +/*if today is a saturday AND the company does NOT work at least 6 days a week, the dispatch date must be Monday or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+2,Date('y',$EarliestDispatch)); Modified: trunk/sql/mysql/upgrade4.04.4-4.04.5.sql =================================================================== --- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 22:27:44 UTC (rev 4601) @@ -1,2 +1,3 @@ ALTER TABLE `custcontacts` ADD `email` VARCHAR( 55 ) NOT NULL; +INSERT INTO config (confname, confvalue) VALUES ('WorkingDaysWeek','5'); UPDATE config SET confvalue='4.04.5' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-18 22:27:50
|
Revision: 4601 http://web-erp.svn.sourceforge.net/web-erp/?rev=4601&view=rev Author: daintree Date: 2011-06-18 22:27:44 +0000 (Sat, 18 Jun 2011) Log Message: ----------- ricards earliest dispatch mods Modified Paths: -------------- trunk/SystemParameters.php trunk/includes/DateFunctions.inc trunk/sql/mysql/upgrade4.04.4-4.04.5.sql Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/SystemParameters.php 2011-06-18 22:27:44 UTC (rev 4601) @@ -117,6 +117,9 @@ if ($_SESSION['QuickEntries'] != $_POST['X_QuickEntries'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_QuickEntries']."' WHERE confname = 'QuickEntries'"; } + if ($_SESSION['WorkingDaysWeek'] != $_POST['X_WorkingDaysWeek'] ) { + $sql[] = "UPDATE config SET confvalue = '".$_POST['X_WorkingDaysWeek']."' WHERE confname = 'WorkingDaysWeek'"; + } if ($_SESSION['DispatchCutOffTime'] != $_POST['X_DispatchCutOffTime'] ) { $sql[] = "UPDATE config SET confvalue = '".$_POST['X_DispatchCutOffTime']."' WHERE confname = 'DispatchCutOffTime'"; } @@ -458,6 +461,16 @@ <td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td> </tr>'; +// Working days on a week +echo '<tr style="outline: 1px solid"><td>' . _('Working Days on a Week') . ':</td> + <td><select Name="X_WorkingDaysWeek"> + <option '.($_SESSION['WorkingDaysWeek']=='7'?'selected ':'').'value="7">7 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='6'?'selected ':'').'value="6">6 '._('working days').'</option> + <option '.($_SESSION['WorkingDaysWeek']=='5'?'selected ':'').'value="5">5 '._('working days').'</option> + </select></td> + <td>' . _('Number of working days on a week') . '</td> + </tr>'; + // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> <td><select Name="X_DispatchCutOffTime">'; Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/includes/DateFunctions.inc 2011-06-18 22:27:44 UTC (rev 4601) @@ -777,19 +777,21 @@ function CalcEarliestDispatchDate (){ -/*This function will need to be modified depending on the business - many businesses run 24x7 -The default assumes no delivery on Sat and Sun*/ +/*There is a system parameter that allows the number of working days to be defined $_SESSION['WorkingDaysWeek'] if this is set to 5 then the assumption is no delivery on Sat and Sun + * if the number of working days is 6 then it is assumed that there is no delivery on Sunday + * if the number of working days is 7 then there are deliveries every day + * */ $EarliestDispatch = time(); - if (Date('w',$EarliestDispatch)==0 ){ + if ((Date('w',$EarliestDispatch)==0) AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a sunday the dispatch date must be tomorrow (Monday) or after */ +/*if today is a sunday AND the company does NOT work 7 days a week, the dispatch date must be tomorrow (Monday) or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+1,Date('y',$EarliestDispatch)); - } elseif (Date('w',$EarliestDispatch)==6){ + } elseif ((Date('w',$EarliestDispatch)==6) AND ($_SESSION['WorkingDaysWeek'] != '6') AND ($_SESSION['WorkingDaysWeek'] != '7')){ -/*if today is a saturday the dispatch date must be Monday or after */ +/*if today is a saturday AND the company does NOT work at least 6 days a week, the dispatch date must be Monday or after */ $EarliestDispatch = Mktime(0,0,0,Date('m',$EarliestDispatch),Date('d',$EarliestDispatch)+2,Date('y',$EarliestDispatch)); Modified: trunk/sql/mysql/upgrade4.04.4-4.04.5.sql =================================================================== --- trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 07:05:12 UTC (rev 4600) +++ trunk/sql/mysql/upgrade4.04.4-4.04.5.sql 2011-06-18 22:27:44 UTC (rev 4601) @@ -1,2 +1,3 @@ ALTER TABLE `custcontacts` ADD `email` VARCHAR( 55 ) NOT NULL; +INSERT INTO config (confname, confvalue) VALUES ('WorkingDaysWeek','5'); UPDATE config SET confvalue='4.04.5' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-18 07:05:19
|
Revision: 4600 http://web-erp.svn.sourceforge.net/web-erp/?rev=4600&view=rev Author: daintree Date: 2011-06-18 07:05:12 +0000 (Sat, 18 Jun 2011) Log Message: ----------- sql script amended Modified Paths: -------------- trunk/sql/mysql/upgrade4.04-4.04.1.sql Modified: trunk/sql/mysql/upgrade4.04-4.04.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.04-4.04.1.sql 2011-06-18 05:13:36 UTC (rev 4599) +++ trunk/sql/mysql/upgrade4.04-4.04.1.sql 2011-06-18 07:05:12 UTC (rev 4600) @@ -1,6 +1,3 @@ -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesTopItemsInquiry.php', 2, 'Shows top selling items either by quantity or sales value by user selectable period range'); -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesCategoryPeriodInquiry.php', 2, 'Shows sales by caetgory for a user selectable period range'); -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesByTypePeriodInquiry.php', 2, 'Shows sales value by sales type by user selectable period range'); ALTER TABLE `scripts` CHANGE `pagesecurity` `pagesecurity` INT( 11 ) NOT NULL DEFAULT '1'; ALTER TABLE `pctabs` ADD `assigner` VARCHAR( 20 ) NOT NULL COMMENT 'Cash assigner for the tab' AFTER `tablimit`; UPDATE pctabs SET assigner = authorizer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-06-18 07:05:18
|
Revision: 4600 http://web-erp.svn.sourceforge.net/web-erp/?rev=4600&view=rev Author: daintree Date: 2011-06-18 07:05:12 +0000 (Sat, 18 Jun 2011) Log Message: ----------- sql script amended Modified Paths: -------------- trunk/sql/mysql/upgrade4.04-4.04.1.sql Modified: trunk/sql/mysql/upgrade4.04-4.04.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.04-4.04.1.sql 2011-06-18 05:13:36 UTC (rev 4599) +++ trunk/sql/mysql/upgrade4.04-4.04.1.sql 2011-06-18 07:05:12 UTC (rev 4600) @@ -1,6 +1,3 @@ -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesTopItemsInquiry.php', 2, 'Shows top selling items either by quantity or sales value by user selectable period range'); -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesCategoryPeriodInquiry.php', 2, 'Shows sales by caetgory for a user selectable period range'); -INSERT INTO scripts (script, pagesecurity, description) VALUES ('SalesByTypePeriodInquiry.php', 2, 'Shows sales value by sales type by user selectable period range'); ALTER TABLE `scripts` CHANGE `pagesecurity` `pagesecurity` INT( 11 ) NOT NULL DEFAULT '1'; ALTER TABLE `pctabs` ADD `assigner` VARCHAR( 20 ) NOT NULL COMMENT 'Cash assigner for the tab' AFTER `tablimit`; UPDATE pctabs SET assigner = authorizer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |