From: <dai...@us...> - 2012-01-29 03:23:18
|
Revision: 4848 http://web-erp.svn.sourceforge.net/web-erp/?rev=4848&view=rev Author: daintree Date: 2012-01-29 03:23:11 +0000 (Sun, 29 Jan 2012) Log Message: ----------- fix Z_ChangeStockCode.php for SalesCategories Modified Paths: -------------- trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2012-01-29 03:10:08 UTC (rev 4847) +++ trunk/Z_ChangeStockCode.php 2012-01-29 03:23:11 UTC (rev 4848) @@ -285,7 +285,13 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + echo '<br />' . _('Changing sales category information'); + $sql = "UPDATE salescatprod SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales category records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + echo '<br />' . _('Changing any serialised item information'); @@ -297,6 +303,8 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + + DB_ReinstateForeignKeys($db); $result = DB_Txn_Commit($db); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-29 03:10:08 UTC (rev 4847) +++ trunk/doc/Change.log 2012-01-29 03:23:11 UTC (rev 4848) @@ -1,5 +1,7 @@ webERP Change Log +29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method +29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" 28/1/12 Phil: ConfirmDispatch_Invoice.php corrected link to ConfirmDispatchControlled_Invoice.php to send $identifier to get the correct session variable containing the order to invoice 28/1/12 Tim: SpecialOrder.php added $identifier to session class variable to avoid overlapping sessions in multiple tabs. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-29 03:23:18
|
Revision: 4848 http://web-erp.svn.sourceforge.net/web-erp/?rev=4848&view=rev Author: daintree Date: 2012-01-29 03:23:11 +0000 (Sun, 29 Jan 2012) Log Message: ----------- fix Z_ChangeStockCode.php for SalesCategories Modified Paths: -------------- trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2012-01-29 03:10:08 UTC (rev 4847) +++ trunk/Z_ChangeStockCode.php 2012-01-29 03:23:11 UTC (rev 4848) @@ -285,7 +285,13 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + echo '<br />' . _('Changing sales category information'); + $sql = "UPDATE salescatprod SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales category records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + echo '<br />' . _('Changing any serialised item information'); @@ -297,6 +303,8 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); + + DB_ReinstateForeignKeys($db); $result = DB_Txn_Commit($db); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-29 03:10:08 UTC (rev 4847) +++ trunk/doc/Change.log 2012-01-29 03:23:11 UTC (rev 4848) @@ -1,5 +1,7 @@ webERP Change Log +29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method +29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" 28/1/12 Phil: ConfirmDispatch_Invoice.php corrected link to ConfirmDispatchControlled_Invoice.php to send $identifier to get the correct session variable containing the order to invoice 28/1/12 Tim: SpecialOrder.php added $identifier to session class variable to avoid overlapping sessions in multiple tabs. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-30 18:49:45
|
Revision: 4855 http://web-erp.svn.sourceforge.net/web-erp/?rev=4855&view=rev Author: daintree Date: 2012-01-30 18:49:39 +0000 (Mon, 30 Jan 2012) Log Message: ----------- fix typo Modified Paths: -------------- trunk/Payments.php trunk/api/api_salesorders.php trunk/api/api_xml-rpc.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/Payments.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -735,7 +735,7 @@ echo '<tr><th colspan="4"><font size="3" color="blue">' . _('Payment'); if ($_SESSION['PaymentDetail' . $identifier]->SupplierID!=''){ - echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifer]->SuppName; + echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifier]->SuppName; } if ($_SESSION['PaymentDetail' . $identifier]->BankAccountName!=''){ Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/api/api_salesorders.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -631,12 +631,12 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { /*debug info to file */ $fp = fopen( '/root/Web-Server/apidebug/debuginfo.txt', "w"); - fputs($fp, 'starting to invoice order ' . $OrderNo); + fputs($fp, 'Starting to invoice order ' . $OrderNo . "\n"); $Errors = array(); $db = db($User, $Password); if (gettype($db)=='integer') { - $Errors[0]=NoAuthorisation; + $Errors[]=NoAuthorisation; return $Errors; } $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db); @@ -682,23 +682,22 @@ ON locations.loccode=salesorders.fromstkloc INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev - WHERE salesorders.orderno = '" . $OrderNumber . "'"; + WHERE salesorders.orderno = '" . $OrderNo . "'"; $OrderHeaderResult = api_DB_query($OrderHeaderSQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoReadOrder; } - fputs($fp, 'Got order header' . "\n"); + fputs($fp, "Got order header with the SQL:\n" . $OrderHeaderSQL . "\n"); $OrderHeader = DB_fetch_array($OrderHeaderResult); $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $OrderHeader['fromstkloc'] ."'",$db); - $Result = api_DB_query($SQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoTaxProvince; } - $myrow = DB_fetch_row($Result); + $myrow = DB_fetch_row($TaxProvResult); $DispTaxProvinceID = $myrow[0]; $LineItemsSQL = "SELECT stkcode, @@ -718,7 +717,7 @@ $Errors[] = NoReadOrderLines; return $Errors; } - fputs($fp, 'Got order line items' . "\n"); + fputs($fp, "Got the order line items with the SQL:\n" . $LineItemsSQL . "\n"); /*Start an SQL transaction */ $result = DB_Txn_Begin($db); @@ -735,7 +734,7 @@ while ($OrderLineRow = DB_fetch_array($LineItemsResult)) { $StandardCost = $OrderLineRow['standardcost']; - + $LocalCurrencyPrice= ($OrderLineRow['unitprice'] *(1- floatval($OrderLineRow['discountpercent'])))/ $OrderHeader['rate']; $LineNetAmount = $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] *(1- floatval($OrderLineRow['discountpercent'])); /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item @@ -756,10 +755,14 @@ AND taxauthrates.taxcatid = '" . $OrderLineRow['taxcatid'] . "' ORDER BY taxgrouptaxes.calculationorder"; - $GetTaxRatesResult = api_DB_query($SQL,$db,'','',true); + $GetTaxRatesResult = api_DB_query($SQL,$db); + if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; + } else{ + fputs($fp, "Got taxes using the following SQL:\n" . $SQL . "\n"); } + $LineTaxAmount = 0; $TaxTotals =array(); @@ -800,14 +803,16 @@ /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */ $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLineRow['quantity'] . ", - actualdispatchdate = '" . $OrderHeader['orddate']. "', + actualdispatchdate = '" . $OrderHeader['orddate'] . "', completed='1' WHERE orderno = '" . $OrderNo . "' AND stkcode = '" . $OrderLineRow['stkcode'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); - - if ($OrderHeader['mbflag']=='B' OR $OrderHeader['mbflag']=='M') { + + fputs($fp, "Updated order details for " . $OrderLineRow['stkcode'] . ' quantity of ' . $OrderLineRow['quantity'] . " invoiced using the following SQL\n" . $SQL); + + if ($OrderLineRow['mbflag']=='B' OR $OrderLineRow['mbflag']=='M') { $Assembly = False; /* Need to get the current location quantity @@ -817,7 +822,7 @@ WHERE locstock.stockid='" . $OrderLineRow['stkcode'] . "' AND loccode= '" . $OrderHeader['fromstkloc'] . "'"; $Result = api_DB_query($SQL, $db); - + if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_row($Result); $QtyOnHandPrior = $LocQtyRow[0]; @@ -831,7 +836,7 @@ WHERE locstock.stockid = '" . $OrderLineRow['stkcode'] . "' AND loccode = '" . $OrderHeader['fromstkloc'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); - + $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -862,8 +867,10 @@ '" . ($QtyOnHandPrior - $OrderLineRow['quantity']) . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - - } else if ($OrderHeader['mbflag']=='A'){ /* its an assembly */ + + fputs($fp, "Insert stock movement using the following SQL:\n" . $SQL . "\n"); + + } else if ($OrderLineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ $Assembly=True; @@ -938,9 +945,8 @@ } /* end of assembly explosion and updates */ } /* end of its an assembly */ - // Insert stock movements - with unit cost - $LocalCurrencyPrice= ($OrderLineRow['unitprice'] *(1- floatval($OrderLineRow['discountpercent'])))/ $OrderHeader['rate']; - if ($OrderHeader['mbflag']=='A' OR $OrderHeader['mbflag']=='D'){ + + if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ /*it's a Dummy/Service item or an Assembly item - still need stock movement record * but quantites on hand are always nil */ $SQL = "INSERT INTO stockmoves (stockid, @@ -992,41 +998,43 @@ '" . $Tax['TaxOnTax'] . "')"; $Result = DB_query($SQL,$db,'','',true); + fputs($fp, "Inserted stockmovestaxes using the following SQL:\n" . $SQL . "\n"); } + /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), - salesanalysis.stkcategory, - salesanalysis.area, - salesanalysis.salesperson, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.stockid - FROM salesanalysis, - custbranch, - stockmaster - WHERE salesanalysis.stkcategory=stockmaster.categoryid - AND salesanalysis.stockid=stockmaster.stockid - AND salesanalysis.cust=custbranch.debtorno - AND salesanalysis.custbranch=custbranch.branchcode - AND salesanalysis.area=custbranch.area - AND salesanalysis.salesperson=custbranch.salesman - AND salesanalysis.typeabbrev ='" . $OrderHeader['ordertype'] . "' - AND salesanalysis.periodno='" . $PeriodNo . "' - AND salesanalysis.cust " . LIKE . " '" . $OrderHeader['debtorno'] . "' - AND salesanalysis.custbranch " . LIKE . " '" . $OrderHeader['branchcode'] . "' - AND salesanalysis.stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' - AND salesanalysis.budgetoractual='1' - GROUP BY salesanalysis.stockid, - salesanalysis.stkcategory, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.area, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.salesperson"; + salesanalysis.stkcategory, + salesanalysis.area, + salesanalysis.salesperson, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.stockid + FROM salesanalysis, + custbranch, + stockmaster + WHERE salesanalysis.stkcategory=stockmaster.categoryid + AND salesanalysis.stockid=stockmaster.stockid + AND salesanalysis.cust=custbranch.debtorno + AND salesanalysis.custbranch=custbranch.branchcode + AND salesanalysis.area=custbranch.area + AND salesanalysis.salesperson=custbranch.salesman + AND salesanalysis.typeabbrev ='" . $OrderHeader['ordertype'] . "' + AND salesanalysis.periodno='" . $PeriodNo . "' + AND salesanalysis.cust " . LIKE . " '" . $OrderHeader['debtorno'] . "' + AND salesanalysis.custbranch " . LIKE . " '" . $OrderHeader['branchcode'] . "' + AND salesanalysis.stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' + AND salesanalysis.budgetoractual='1' + GROUP BY salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson"; $ErrMsg = _('The count of existing Sales analysis records could not run because'); $DbgMsg = _('SQL to count the no of sales analysis records'); Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/api/api_xml-rpc.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -1169,7 +1169,7 @@ $ReturnValue[0] = _('If successful this function returns a two element array; the first element is 0 for success or an error code, while the second element is the invoice number.'); /*E*/$InvoiceSalesOrder_sig = array(array($xmlrpcStruct,$xmlrpcStruct), -/*x*/ array($xmlrpcStruct,$xmlrpcStruct,$xmlrpcString,$xmlrpcString)); +/*x*/ array($xmlrpcStruct,$xmlrpcInt,$xmlrpcString,$xmlrpcString)); $InvoiceSalesOrder_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue ); function xmlrpc_InvoiceSalesOrder($xmlrpcmsg){ @@ -3074,6 +3074,10 @@ "function" => "xmlrpc_ModifySalesOrderLine", "signature" => $ModifySalesOrderLine_sig, "docstring" => $ModifySalesOrderLine_doc), + "weberp.xmlrpc_InvoiceSalesOrder" => array( + "function" => "xmlrpc_InvoiceSalesOrder", + "signature" => $InvoiceSalesOrder_sig, + "docstring" => $InvoiceSalesOrder_doc), "weberp.xmlrpc_InsertGLAccount" => array( "function" => "xmlrpc_InsertGLAccount", "signature" => $InsertGLAccount_sig, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-30 18:49:48
|
Revision: 4855 http://web-erp.svn.sourceforge.net/web-erp/?rev=4855&view=rev Author: daintree Date: 2012-01-30 18:49:39 +0000 (Mon, 30 Jan 2012) Log Message: ----------- fix typo Modified Paths: -------------- trunk/Payments.php trunk/api/api_salesorders.php trunk/api/api_xml-rpc.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/Payments.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -735,7 +735,7 @@ echo '<tr><th colspan="4"><font size="3" color="blue">' . _('Payment'); if ($_SESSION['PaymentDetail' . $identifier]->SupplierID!=''){ - echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifer]->SuppName; + echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifier]->SuppName; } if ($_SESSION['PaymentDetail' . $identifier]->BankAccountName!=''){ Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/api/api_salesorders.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -631,12 +631,12 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { /*debug info to file */ $fp = fopen( '/root/Web-Server/apidebug/debuginfo.txt', "w"); - fputs($fp, 'starting to invoice order ' . $OrderNo); + fputs($fp, 'Starting to invoice order ' . $OrderNo . "\n"); $Errors = array(); $db = db($User, $Password); if (gettype($db)=='integer') { - $Errors[0]=NoAuthorisation; + $Errors[]=NoAuthorisation; return $Errors; } $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db); @@ -682,23 +682,22 @@ ON locations.loccode=salesorders.fromstkloc INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev - WHERE salesorders.orderno = '" . $OrderNumber . "'"; + WHERE salesorders.orderno = '" . $OrderNo . "'"; $OrderHeaderResult = api_DB_query($OrderHeaderSQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoReadOrder; } - fputs($fp, 'Got order header' . "\n"); + fputs($fp, "Got order header with the SQL:\n" . $OrderHeaderSQL . "\n"); $OrderHeader = DB_fetch_array($OrderHeaderResult); $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $OrderHeader['fromstkloc'] ."'",$db); - $Result = api_DB_query($SQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoTaxProvince; } - $myrow = DB_fetch_row($Result); + $myrow = DB_fetch_row($TaxProvResult); $DispTaxProvinceID = $myrow[0]; $LineItemsSQL = "SELECT stkcode, @@ -718,7 +717,7 @@ $Errors[] = NoReadOrderLines; return $Errors; } - fputs($fp, 'Got order line items' . "\n"); + fputs($fp, "Got the order line items with the SQL:\n" . $LineItemsSQL . "\n"); /*Start an SQL transaction */ $result = DB_Txn_Begin($db); @@ -735,7 +734,7 @@ while ($OrderLineRow = DB_fetch_array($LineItemsResult)) { $StandardCost = $OrderLineRow['standardcost']; - + $LocalCurrencyPrice= ($OrderLineRow['unitprice'] *(1- floatval($OrderLineRow['discountpercent'])))/ $OrderHeader['rate']; $LineNetAmount = $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] *(1- floatval($OrderLineRow['discountpercent'])); /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item @@ -756,10 +755,14 @@ AND taxauthrates.taxcatid = '" . $OrderLineRow['taxcatid'] . "' ORDER BY taxgrouptaxes.calculationorder"; - $GetTaxRatesResult = api_DB_query($SQL,$db,'','',true); + $GetTaxRatesResult = api_DB_query($SQL,$db); + if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; + } else{ + fputs($fp, "Got taxes using the following SQL:\n" . $SQL . "\n"); } + $LineTaxAmount = 0; $TaxTotals =array(); @@ -800,14 +803,16 @@ /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */ $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLineRow['quantity'] . ", - actualdispatchdate = '" . $OrderHeader['orddate']. "', + actualdispatchdate = '" . $OrderHeader['orddate'] . "', completed='1' WHERE orderno = '" . $OrderNo . "' AND stkcode = '" . $OrderLineRow['stkcode'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); - - if ($OrderHeader['mbflag']=='B' OR $OrderHeader['mbflag']=='M') { + + fputs($fp, "Updated order details for " . $OrderLineRow['stkcode'] . ' quantity of ' . $OrderLineRow['quantity'] . " invoiced using the following SQL\n" . $SQL); + + if ($OrderLineRow['mbflag']=='B' OR $OrderLineRow['mbflag']=='M') { $Assembly = False; /* Need to get the current location quantity @@ -817,7 +822,7 @@ WHERE locstock.stockid='" . $OrderLineRow['stkcode'] . "' AND loccode= '" . $OrderHeader['fromstkloc'] . "'"; $Result = api_DB_query($SQL, $db); - + if (DB_num_rows($Result)==1){ $LocQtyRow = DB_fetch_row($Result); $QtyOnHandPrior = $LocQtyRow[0]; @@ -831,7 +836,7 @@ WHERE locstock.stockid = '" . $OrderLineRow['stkcode'] . "' AND loccode = '" . $OrderHeader['fromstkloc'] . "'"; $Result = api_DB_query($SQL,$db,'','',true); - + $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -862,8 +867,10 @@ '" . ($QtyOnHandPrior - $OrderLineRow['quantity']) . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - - } else if ($OrderHeader['mbflag']=='A'){ /* its an assembly */ + + fputs($fp, "Insert stock movement using the following SQL:\n" . $SQL . "\n"); + + } else if ($OrderLineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ $Assembly=True; @@ -938,9 +945,8 @@ } /* end of assembly explosion and updates */ } /* end of its an assembly */ - // Insert stock movements - with unit cost - $LocalCurrencyPrice= ($OrderLineRow['unitprice'] *(1- floatval($OrderLineRow['discountpercent'])))/ $OrderHeader['rate']; - if ($OrderHeader['mbflag']=='A' OR $OrderHeader['mbflag']=='D'){ + + if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ /*it's a Dummy/Service item or an Assembly item - still need stock movement record * but quantites on hand are always nil */ $SQL = "INSERT INTO stockmoves (stockid, @@ -992,41 +998,43 @@ '" . $Tax['TaxOnTax'] . "')"; $Result = DB_query($SQL,$db,'','',true); + fputs($fp, "Inserted stockmovestaxes using the following SQL:\n" . $SQL . "\n"); } + /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), - salesanalysis.stkcategory, - salesanalysis.area, - salesanalysis.salesperson, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.stockid - FROM salesanalysis, - custbranch, - stockmaster - WHERE salesanalysis.stkcategory=stockmaster.categoryid - AND salesanalysis.stockid=stockmaster.stockid - AND salesanalysis.cust=custbranch.debtorno - AND salesanalysis.custbranch=custbranch.branchcode - AND salesanalysis.area=custbranch.area - AND salesanalysis.salesperson=custbranch.salesman - AND salesanalysis.typeabbrev ='" . $OrderHeader['ordertype'] . "' - AND salesanalysis.periodno='" . $PeriodNo . "' - AND salesanalysis.cust " . LIKE . " '" . $OrderHeader['debtorno'] . "' - AND salesanalysis.custbranch " . LIKE . " '" . $OrderHeader['branchcode'] . "' - AND salesanalysis.stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' - AND salesanalysis.budgetoractual='1' - GROUP BY salesanalysis.stockid, - salesanalysis.stkcategory, - salesanalysis.cust, - salesanalysis.custbranch, - salesanalysis.area, - salesanalysis.periodno, - salesanalysis.typeabbrev, - salesanalysis.salesperson"; + salesanalysis.stkcategory, + salesanalysis.area, + salesanalysis.salesperson, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.stockid + FROM salesanalysis, + custbranch, + stockmaster + WHERE salesanalysis.stkcategory=stockmaster.categoryid + AND salesanalysis.stockid=stockmaster.stockid + AND salesanalysis.cust=custbranch.debtorno + AND salesanalysis.custbranch=custbranch.branchcode + AND salesanalysis.area=custbranch.area + AND salesanalysis.salesperson=custbranch.salesman + AND salesanalysis.typeabbrev ='" . $OrderHeader['ordertype'] . "' + AND salesanalysis.periodno='" . $PeriodNo . "' + AND salesanalysis.cust " . LIKE . " '" . $OrderHeader['debtorno'] . "' + AND salesanalysis.custbranch " . LIKE . " '" . $OrderHeader['branchcode'] . "' + AND salesanalysis.stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' + AND salesanalysis.budgetoractual='1' + GROUP BY salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson"; $ErrMsg = _('The count of existing Sales analysis records could not run because'); $DbgMsg = _('SQL to count the no of sales analysis records'); Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2012-01-30 13:40:51 UTC (rev 4854) +++ trunk/api/api_xml-rpc.php 2012-01-30 18:49:39 UTC (rev 4855) @@ -1169,7 +1169,7 @@ $ReturnValue[0] = _('If successful this function returns a two element array; the first element is 0 for success or an error code, while the second element is the invoice number.'); /*E*/$InvoiceSalesOrder_sig = array(array($xmlrpcStruct,$xmlrpcStruct), -/*x*/ array($xmlrpcStruct,$xmlrpcStruct,$xmlrpcString,$xmlrpcString)); +/*x*/ array($xmlrpcStruct,$xmlrpcInt,$xmlrpcString,$xmlrpcString)); $InvoiceSalesOrder_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue ); function xmlrpc_InvoiceSalesOrder($xmlrpcmsg){ @@ -3074,6 +3074,10 @@ "function" => "xmlrpc_ModifySalesOrderLine", "signature" => $ModifySalesOrderLine_sig, "docstring" => $ModifySalesOrderLine_doc), + "weberp.xmlrpc_InvoiceSalesOrder" => array( + "function" => "xmlrpc_InvoiceSalesOrder", + "signature" => $InvoiceSalesOrder_sig, + "docstring" => $InvoiceSalesOrder_doc), "weberp.xmlrpc_InsertGLAccount" => array( "function" => "xmlrpc_InsertGLAccount", "signature" => $InsertGLAccount_sig, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-01-30 21:03:45
|
Revision: 4856 http://web-erp.svn.sourceforge.net/web-erp/?rev=4856&view=rev Author: vvs2012 Date: 2012-01-30 21:03:38 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Modified Paths: -------------- trunk/ReverseGRN.php trunk/doc/Change.log Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2012-01-30 18:49:39 UTC (rev 4855) +++ trunk/ReverseGRN.php 2012-01-30 21:03:38 UTC (rev 4856) @@ -50,7 +50,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem INNER JOIN purchorders ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . $_GET['GRNNo'] . "'"; + WHERE grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-30 18:49:39 UTC (rev 4855) +++ trunk/doc/Change.log 2012-01-30 21:03:38 UTC (rev 4856) @@ -1,5 +1,6 @@ webERP Change Log +30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php 29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-01-30 21:03:45
|
Revision: 4856 http://web-erp.svn.sourceforge.net/web-erp/?rev=4856&view=rev Author: vvs2012 Date: 2012-01-30 21:03:38 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Modified Paths: -------------- trunk/ReverseGRN.php trunk/doc/Change.log Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2012-01-30 18:49:39 UTC (rev 4855) +++ trunk/ReverseGRN.php 2012-01-30 21:03:38 UTC (rev 4856) @@ -50,7 +50,7 @@ ON grns.podetailitem=purchorderdetails.podetailitem INNER JOIN purchorders ON purchorderdetails.orderno = purchorders.orderno - WHERE AND grnno='" . $_GET['GRNNo'] . "'"; + WHERE grnno='" . $_GET['GRNNo'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not get the details of the GRN selected for reversal because') . ' '; $DbgMsg = _('The following SQL to retrieve the GRN details was used') . ':'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-30 18:49:39 UTC (rev 4855) +++ trunk/doc/Change.log 2012-01-30 21:03:38 UTC (rev 4856) @@ -1,5 +1,6 @@ webERP Change Log +30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php 29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-31 06:45:44
|
Revision: 4858 http://web-erp.svn.sourceforge.net/web-erp/?rev=4858&view=rev Author: daintree Date: 2012-01-31 06:45:38 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fixes Modified Paths: -------------- trunk/PO_Items.php trunk/Stocks.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/PO_Items.php 2012-01-31 06:45:38 UTC (rev 4858) @@ -24,8 +24,6 @@ include('includes/header.inc'); -$Maximum_Number_Of_Parts_To_Show=50; - if (!isset($_POST['Commit'])) { echo '<a href="'.$rootpath.'/PO_Header.php?identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br />'; } @@ -1124,9 +1122,6 @@ </tr>'; $j++; $PartsDisplayed++; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ - break; - } #end of page full new headings if } #end of while loop Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/Stocks.php 2012-01-31 06:45:38 UTC (rev 4858) @@ -415,7 +415,7 @@ '" . $JournalNo . "', '" . Date('Y-m-d') . "', '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "', - '" . $NewStockAccount . "', + '" . $NewStockAct . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . ($UnitCost* $StockQtyRow[0]) . "')"; $ErrMsg = _('The stock cost journal could not be inserted because'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/doc/Change.log 2012-01-31 06:45:38 UTC (rev 4858) @@ -1,5 +1,7 @@ webERP Change Log +31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct +31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php 29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed @@ -24,7 +26,7 @@ 19/1/12 Phil:StockCheck.php fixed error in SQL two ANDs in calculating quantity demand reported by Ricard 19/1/12 Paul Harness: SelectOrderItems.php $i++ - in code for frequently ordered items. 17/1/12 Vitaly: Removed unused .table2 declaration from default.css. Fixed border settings in .table1. -16/1/12 Phil: Made StockReorderLevel.php just update changed fields rather than update all locations even though they may not have changed. +16/1/12 Phil: Made StockReorderLevel.php just update changed fields rather than update all locations even though they may not have changed./ 8/1/12 Phil: Added new api functions to get tax group taxes, list tax authorities, get tax authority details and get tax authority tax rates, also to list and get payment methods 8/1/12 Paul Harness: PcAuthorizeExpenses.php Compare date against SQL raw date format, then convert for display when deciding to display authorize checkbox. 8/1/12 Paul Harness: PcClaimExpensesFromTab.php Use DefaultDateFormat for date in expense entry. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-31 06:45:44
|
Revision: 4858 http://web-erp.svn.sourceforge.net/web-erp/?rev=4858&view=rev Author: daintree Date: 2012-01-31 06:45:38 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fixes Modified Paths: -------------- trunk/PO_Items.php trunk/Stocks.php trunk/doc/Change.log Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/PO_Items.php 2012-01-31 06:45:38 UTC (rev 4858) @@ -24,8 +24,6 @@ include('includes/header.inc'); -$Maximum_Number_Of_Parts_To_Show=50; - if (!isset($_POST['Commit'])) { echo '<a href="'.$rootpath.'/PO_Header.php?identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br />'; } @@ -1124,9 +1122,6 @@ </tr>'; $j++; $PartsDisplayed++; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ - break; - } #end of page full new headings if } #end of while loop Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/Stocks.php 2012-01-31 06:45:38 UTC (rev 4858) @@ -415,7 +415,7 @@ '" . $JournalNo . "', '" . Date('Y-m-d') . "', '" . GetPeriod(Date($_SESSION['DefaultDateFormat']),$db,true) . "', - '" . $NewStockAccount . "', + '" . $NewStockAct . "', '" . $StockID . ' ' . _('Change stock category') . "', '" . ($UnitCost* $StockQtyRow[0]) . "')"; $ErrMsg = _('The stock cost journal could not be inserted because'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 04:18:41 UTC (rev 4857) +++ trunk/doc/Change.log 2012-01-31 06:45:38 UTC (rev 4858) @@ -1,5 +1,7 @@ webERP Change Log +31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct +31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php 29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed @@ -24,7 +26,7 @@ 19/1/12 Phil:StockCheck.php fixed error in SQL two ANDs in calculating quantity demand reported by Ricard 19/1/12 Paul Harness: SelectOrderItems.php $i++ - in code for frequently ordered items. 17/1/12 Vitaly: Removed unused .table2 declaration from default.css. Fixed border settings in .table1. -16/1/12 Phil: Made StockReorderLevel.php just update changed fields rather than update all locations even though they may not have changed. +16/1/12 Phil: Made StockReorderLevel.php just update changed fields rather than update all locations even though they may not have changed./ 8/1/12 Phil: Added new api functions to get tax group taxes, list tax authorities, get tax authority details and get tax authority tax rates, also to list and get payment methods 8/1/12 Paul Harness: PcAuthorizeExpenses.php Compare date against SQL raw date format, then convert for display when deciding to display authorize checkbox. 8/1/12 Paul Harness: PcClaimExpensesFromTab.php Use DefaultDateFormat for date in expense entry. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-31 09:26:58
|
Revision: 4859 http://web-erp.svn.sourceforge.net/web-erp/?rev=4859&view=rev Author: daintree Date: 2012-01-31 09:26:48 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fixes Modified Paths: -------------- trunk/api/api_salesorders.php trunk/doc/Change.log Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-01-31 06:45:38 UTC (rev 4858) +++ trunk/api/api_salesorders.php 2012-01-31 09:26:48 UTC (rev 4859) @@ -226,15 +226,15 @@ /* Check that the item due date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyItemDueDate($itemdue, $i, $Errors, $db) { + function VerifyItemDueDate($ItemDue, $i, $Errors, $db) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=api_DB_query($sql, $db); $myrow=DB_fetch_array($result); $DateFormat=$myrow[0]; - if (mb_strstr($itemdue,'/')) { - $DateArray = explode('/',$itemdue); - } elseif (mb_strstr($itemdue,'.')) { - $DateArray = explode('.',$itemdue); + if (mb_strstr($ItemDue,'/')) { + $DateArray = explode('/',$ItemDue); + } elseif (mb_strstr($PeriodEnd,'.')) { + $DateArray = explode('.',$ItemDue); } if ($DateFormat=='d/m/Y') { $Day=$DateArray[0]; @@ -487,9 +487,12 @@ if (isset($OrderLine['narrative'])){ $Errors=VerifyNarrative($OrderLine['narrative'], sizeof($Errors), $Errors); } + /* + * Not sure why the verification of itemdue doesn't work if (isset($OrderLine['itemdue'])){ $Errors=VerifyItemDueDate($OrderLine['itemdue'], sizeof($Errors), $Errors); } + */ if (isset($OrderLine['poline'])){ $Errors=VerifyPOLine($OrderLine['poline'], sizeof($Errors), $Errors); } @@ -504,8 +507,10 @@ } $FieldValues.= "'" . $value . "', "; } + $sql = "INSERT INTO salesorderdetails (" . mb_substr($FieldNames,0,-2) . ") VALUES (" . mb_substr($FieldValues,0,-2) . ")"; + if (sizeof($Errors)==0) { $result = api_DB_Query($sql, $db); if (DB_error_no($db) != 0) { @@ -629,9 +634,6 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { - /*debug info to file */ - $fp = fopen( '/root/Web-Server/apidebug/debuginfo.txt', "w"); - fputs($fp, 'Starting to invoice order ' . $OrderNo . "\n"); $Errors = array(); $db = db($User, $Password); @@ -657,8 +659,6 @@ $Errors[] = NoCompanyRecord; } - fputs($fp, 'Got company info' . "\n"); - $OrderHeaderSQL = "SELECT salesorders.debtorno, debtorsmaster.name, salesorders.branchcode, @@ -689,8 +689,6 @@ $Errors[] = NoReadOrder; } - fputs($fp, "Got order header with the SQL:\n" . $OrderHeaderSQL . "\n"); - $OrderHeader = DB_fetch_array($OrderHeaderResult); $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $OrderHeader['fromstkloc'] ."'",$db); @@ -717,7 +715,6 @@ $Errors[] = NoReadOrderLines; return $Errors; } - fputs($fp, "Got the order line items with the SQL:\n" . $LineItemsSQL . "\n"); /*Start an SQL transaction */ $result = DB_Txn_Begin($db); @@ -725,8 +722,6 @@ $InvoiceNo = GetNextTransNo(10, $db); $PeriodNo = GetCurrentPeriod($db); - fputs($fp, 'Got invoice number ' . $InvoiceNo . "\n and into PeriodNo " . $PeriodNo . "\n"); - $TotalFXNetInvoice = 0; $TotalFXTax = 0; $LineCounter =0; @@ -759,9 +754,7 @@ if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; - } else{ - fputs($fp, "Got taxes using the following SQL:\n" . $SQL . "\n"); - } + } $LineTaxAmount = 0; $TaxTotals =array(); @@ -810,7 +803,6 @@ $Result = api_DB_query($SQL,$db,'','',true); - fputs($fp, "Updated order details for " . $OrderLineRow['stkcode'] . ' quantity of ' . $OrderLineRow['quantity'] . " invoiced using the following SQL\n" . $SQL); if ($OrderLineRow['mbflag']=='B' OR $OrderLineRow['mbflag']=='M') { $Assembly = False; @@ -868,8 +860,6 @@ $Result = api_DB_query($SQL,$db,'','',true); - fputs($fp, "Insert stock movement using the following SQL:\n" . $SQL . "\n"); - } else if ($OrderLineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ @@ -982,7 +972,6 @@ } /*Get the ID of the StockMove... */ $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); - /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -998,7 +987,6 @@ '" . $Tax['TaxOnTax'] . "')"; $Result = DB_query($SQL,$db,'','',true); - fputs($fp, "Inserted stockmovestaxes using the following SQL:\n" . $SQL . "\n"); } /*Insert Sales Analysis records */ @@ -1041,7 +1029,7 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $myrow = DB_fetch_row($Result); - + if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis @@ -1057,7 +1045,7 @@ AND stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' AND salesanalysis.stkcategory ='" . $myrow[1] . "' AND budgetoractual='1'"; - + } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis ( typeabbrev, @@ -1090,6 +1078,7 @@ WHERE stockmaster.stockid = '" . $OrderLineRow['stkcode'] . "' AND custbranch.debtorno = '" . $OrderHeader['debtorno'] . "' AND custbranch.branchcode='" . $OrderHeader['branchcode'] . "'"; + } $Result = api_DB_query($SQL,$db,'','',true); @@ -1114,7 +1103,7 @@ '" . ($StandardCost * $OrderLineRow['quantity']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ $StockGLCode = GetStockGLCode($OrderLineRow['stkcode'],$db); @@ -1134,6 +1123,7 @@ '" . (-$StandardCost * $OrderLineRow['quantity']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ if ($CompanyRecord['gllink_debtors']==1 AND $OrderLineRow['unitprice'] !=0){ @@ -1157,7 +1147,7 @@ '" . -$OrderLineRow['unitprice'] * $OrderLineRow['quantity']/$OrderHeader['rate'] . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - + if ($OrderLineRow['discountpercent'] !=0){ $SQL = "INSERT INTO gltrans (type, @@ -1232,6 +1222,7 @@ $Result = api_DB_query($SQL,$db,'','',true); } EnsureGLEntriesBalance(10,$InvoiceNo,$db); + } /*end of if Sales and GL integrated */ /*Update order header for invoice charged on */ @@ -1271,22 +1262,23 @@ '" . $OrderHeader['shipvia'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ - foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { - + foreach ($TaxTotals AS $TaxAuthID => $Tax) { + $SQL = "INSERT INTO debtortranstaxes (debtortransid, taxauthid, taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . $TaxAmount/$OrderHeader['rate'] . "')"; + '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); } if (sizeof($Errors)==0) { + $Result = DB_Txn_Commit($db); $Errors[0]=0; $Errors[1]=$InvoiceNo; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 06:45:38 UTC (rev 4858) +++ trunk/doc/Change.log 2012-01-31 09:26:48 UTC (rev 4859) @@ -3,7 +3,7 @@ 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php -29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method +29/1/12 Phil: Alterations to API to fix SQL and to add InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" 28/1/12 Phil: ConfirmDispatch_Invoice.php corrected link to ConfirmDispatchControlled_Invoice.php to send $identifier to get the correct session variable containing the order to invoice This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-31 09:26:59
|
Revision: 4859 http://web-erp.svn.sourceforge.net/web-erp/?rev=4859&view=rev Author: daintree Date: 2012-01-31 09:26:48 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fixes Modified Paths: -------------- trunk/api/api_salesorders.php trunk/doc/Change.log Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-01-31 06:45:38 UTC (rev 4858) +++ trunk/api/api_salesorders.php 2012-01-31 09:26:48 UTC (rev 4859) @@ -226,15 +226,15 @@ /* Check that the item due date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyItemDueDate($itemdue, $i, $Errors, $db) { + function VerifyItemDueDate($ItemDue, $i, $Errors, $db) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=api_DB_query($sql, $db); $myrow=DB_fetch_array($result); $DateFormat=$myrow[0]; - if (mb_strstr($itemdue,'/')) { - $DateArray = explode('/',$itemdue); - } elseif (mb_strstr($itemdue,'.')) { - $DateArray = explode('.',$itemdue); + if (mb_strstr($ItemDue,'/')) { + $DateArray = explode('/',$ItemDue); + } elseif (mb_strstr($PeriodEnd,'.')) { + $DateArray = explode('.',$ItemDue); } if ($DateFormat=='d/m/Y') { $Day=$DateArray[0]; @@ -487,9 +487,12 @@ if (isset($OrderLine['narrative'])){ $Errors=VerifyNarrative($OrderLine['narrative'], sizeof($Errors), $Errors); } + /* + * Not sure why the verification of itemdue doesn't work if (isset($OrderLine['itemdue'])){ $Errors=VerifyItemDueDate($OrderLine['itemdue'], sizeof($Errors), $Errors); } + */ if (isset($OrderLine['poline'])){ $Errors=VerifyPOLine($OrderLine['poline'], sizeof($Errors), $Errors); } @@ -504,8 +507,10 @@ } $FieldValues.= "'" . $value . "', "; } + $sql = "INSERT INTO salesorderdetails (" . mb_substr($FieldNames,0,-2) . ") VALUES (" . mb_substr($FieldValues,0,-2) . ")"; + if (sizeof($Errors)==0) { $result = api_DB_Query($sql, $db); if (DB_error_no($db) != 0) { @@ -629,9 +634,6 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { - /*debug info to file */ - $fp = fopen( '/root/Web-Server/apidebug/debuginfo.txt', "w"); - fputs($fp, 'Starting to invoice order ' . $OrderNo . "\n"); $Errors = array(); $db = db($User, $Password); @@ -657,8 +659,6 @@ $Errors[] = NoCompanyRecord; } - fputs($fp, 'Got company info' . "\n"); - $OrderHeaderSQL = "SELECT salesorders.debtorno, debtorsmaster.name, salesorders.branchcode, @@ -689,8 +689,6 @@ $Errors[] = NoReadOrder; } - fputs($fp, "Got order header with the SQL:\n" . $OrderHeaderSQL . "\n"); - $OrderHeader = DB_fetch_array($OrderHeaderResult); $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $OrderHeader['fromstkloc'] ."'",$db); @@ -717,7 +715,6 @@ $Errors[] = NoReadOrderLines; return $Errors; } - fputs($fp, "Got the order line items with the SQL:\n" . $LineItemsSQL . "\n"); /*Start an SQL transaction */ $result = DB_Txn_Begin($db); @@ -725,8 +722,6 @@ $InvoiceNo = GetNextTransNo(10, $db); $PeriodNo = GetCurrentPeriod($db); - fputs($fp, 'Got invoice number ' . $InvoiceNo . "\n and into PeriodNo " . $PeriodNo . "\n"); - $TotalFXNetInvoice = 0; $TotalFXTax = 0; $LineCounter =0; @@ -759,9 +754,7 @@ if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; - } else{ - fputs($fp, "Got taxes using the following SQL:\n" . $SQL . "\n"); - } + } $LineTaxAmount = 0; $TaxTotals =array(); @@ -810,7 +803,6 @@ $Result = api_DB_query($SQL,$db,'','',true); - fputs($fp, "Updated order details for " . $OrderLineRow['stkcode'] . ' quantity of ' . $OrderLineRow['quantity'] . " invoiced using the following SQL\n" . $SQL); if ($OrderLineRow['mbflag']=='B' OR $OrderLineRow['mbflag']=='M') { $Assembly = False; @@ -868,8 +860,6 @@ $Result = api_DB_query($SQL,$db,'','',true); - fputs($fp, "Insert stock movement using the following SQL:\n" . $SQL . "\n"); - } else if ($OrderLineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ @@ -982,7 +972,6 @@ } /*Get the ID of the StockMove... */ $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); - /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -998,7 +987,6 @@ '" . $Tax['TaxOnTax'] . "')"; $Result = DB_query($SQL,$db,'','',true); - fputs($fp, "Inserted stockmovestaxes using the following SQL:\n" . $SQL . "\n"); } /*Insert Sales Analysis records */ @@ -1041,7 +1029,7 @@ $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $myrow = DB_fetch_row($Result); - + if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis @@ -1057,7 +1045,7 @@ AND stockid " . LIKE . " '" . $OrderLineRow['stkcode'] . "' AND salesanalysis.stkcategory ='" . $myrow[1] . "' AND budgetoractual='1'"; - + } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis ( typeabbrev, @@ -1090,6 +1078,7 @@ WHERE stockmaster.stockid = '" . $OrderLineRow['stkcode'] . "' AND custbranch.debtorno = '" . $OrderHeader['debtorno'] . "' AND custbranch.branchcode='" . $OrderHeader['branchcode'] . "'"; + } $Result = api_DB_query($SQL,$db,'','',true); @@ -1114,7 +1103,7 @@ '" . ($StandardCost * $OrderLineRow['quantity']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ $StockGLCode = GetStockGLCode($OrderLineRow['stkcode'],$db); @@ -1134,6 +1123,7 @@ '" . (-$StandardCost * $OrderLineRow['quantity']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ if ($CompanyRecord['gllink_debtors']==1 AND $OrderLineRow['unitprice'] !=0){ @@ -1157,7 +1147,7 @@ '" . -$OrderLineRow['unitprice'] * $OrderLineRow['quantity']/$OrderHeader['rate'] . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - + if ($OrderLineRow['discountpercent'] !=0){ $SQL = "INSERT INTO gltrans (type, @@ -1232,6 +1222,7 @@ $Result = api_DB_query($SQL,$db,'','',true); } EnsureGLEntriesBalance(10,$InvoiceNo,$db); + } /*end of if Sales and GL integrated */ /*Update order header for invoice charged on */ @@ -1271,22 +1262,23 @@ '" . $OrderHeader['shipvia'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ - foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { - + foreach ($TaxTotals AS $TaxAuthID => $Tax) { + $SQL = "INSERT INTO debtortranstaxes (debtortransid, taxauthid, taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . $TaxAmount/$OrderHeader['rate'] . "')"; + '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); } if (sizeof($Errors)==0) { + $Result = DB_Txn_Commit($db); $Errors[0]=0; $Errors[1]=$InvoiceNo; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 06:45:38 UTC (rev 4858) +++ trunk/doc/Change.log 2012-01-31 09:26:48 UTC (rev 4859) @@ -3,7 +3,7 @@ 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php -29/1/12 Phil: Alterations to API to fix SQL and to start work on adding InvoiceSalesOrder method +29/1/12 Phil: Alterations to API to fix SQL and to add InvoiceSalesOrder method 29/1/12 Phil: Z_ChangeStockCode.php now alters SalesCategories of items being changed 28/1/12 Ahmed.Fawzy: StockCategories.php fixes for numericvalue not displaying and errored with "minimum value is not numeric" 28/1/12 Phil: ConfirmDispatch_Invoice.php corrected link to ConfirmDispatchControlled_Invoice.php to send $identifier to get the correct session variable containing the order to invoice This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-01-31 21:49:08
|
Revision: 4861 http://web-erp.svn.sourceforge.net/web-erp/?rev=4861&view=rev Author: vvs2012 Date: 2012-01-31 21:48:58 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. Modified Paths: -------------- trunk/GoodsReceived.php trunk/ReorderLevelLocation.php trunk/ReverseGRN.php trunk/SuppInvGRNs.php trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/GoodsReceived.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -448,7 +448,7 @@ VALUES ('" . $GRN . "', '" . $OrderLine->PODetailRec . "', '" . $OrderLine->StockID . "', - '" . $OrderLine->ItemDescription . "', + '" . DB_escape_string($OrderLine->ItemDescription) . "', '" . $_POST['DefaultReceivedDate'] . "', '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO'.$identifier]->SupplierID . "', @@ -507,7 +507,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . $_SESSION['PO'.$identifier]->SupplierID . " (" . $_SESSION['PO'.$identifier]->SupplierName . ") - " .$_SESSION['PO'.$identifier]->OrderNo . "', + '" . $_SESSION['PO'.$identifier]->SupplierID . " (" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierName) . ") - " .$_SESSION['PO'.$identifier]->OrderNo . "', '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', '" . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . "' @@ -662,7 +662,7 @@ '" . $PeriodNo . "', '" . $OrderLine->GLCode . "', 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID - . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + . " - " . DB_escape_string($OrderLine->ItemDescription) . " x " . $OrderLine->ReceiveQty . " @ " . locale_number_format($CurrentStandardCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' )"; @@ -686,7 +686,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', - '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . -$UnitCost * $OrderLine->ReceiveQty . "' )"; Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/ReorderLevelLocation.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -139,7 +139,7 @@ <td class="number">'.$QtyInvoice.'</td> <td class="number">'.$ohRow['0'].'</td> <td class="number">'.$ohinRow['0'].'</td> - <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> + <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="10" size="10" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /></td> </tr> '; $i++; Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/ReverseGRN.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -221,7 +221,7 @@ $Result=DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); /* If its a stock item .... Insert stock movements - with unit cost */ - + $NewQtyOnHand = $QtyOnHandPrior - $QtyToReverse; $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -242,7 +242,7 @@ '" . _('Reversal') . ' - ' . $_POST['SupplierID'] . ' - ' . $GRN['orderno'] . "', '" . -$QtyToReverse . "', '" . $GRN['stdcostunit'] . "', - '" . $QtyOnHandPrior - $QtyToReverse . "' + '" . $NewQtyOnHand . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/SuppInvGRNs.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -80,7 +80,7 @@ if (!is_numeric(filter_number_format($_POST['ChgPrice'])) AND filter_number_format($_POST['ChgPrice'])<0){ $InputError = True; prnMsg(_('The price charged in the suppliers currency is either not numeric or negative') . '. ' . _('The goods received cannot be invoiced at this price'),'error'); - } elseif ($_SESSION['Check_Price_Charged_vs_Order_Price'] == True) { + } elseif ($_SESSION['Check_Price_Charged_vs_Order_Price'] == True AND $_POST['OrderPrice'] != 0) { if (filter_number_format($_POST['ChgPrice'])/$_POST['OrderPrice'] > (1+ ($_SESSION['OverChargeProportion'] / 100))){ prnMsg(_('The price being invoiced is more than the purchase order price by more than') . ' ' . $_SESSION['OverChargeProportion'] . '%. ' . _('The system is set up to prohibit this so will put this invoice on hold until it is authorised'),'warn'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/doc/Change.log 2012-01-31 21:48:58 UTC (rev 4861) @@ -1,5 +1,6 @@ webERP Change Log +31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/includes/ConnectDB_mysql.inc 2012-01-31 21:48:58 UTC (rev 4861) @@ -165,7 +165,7 @@ } function DB_escape_string($String){ - return mysql_real_escape_string(htmlspecialchars($String, ENT_COMPAT, 'utf-8')); + return mysql_real_escape_string(htmlspecialchars($String, ENT_COMPAT, 'utf-8', false)); } function DB_show_tables(&$Conn){ Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/includes/ConnectDB_mysqli.inc 2012-01-31 21:48:58 UTC (rev 4861) @@ -177,7 +177,7 @@ function DB_escape_string($String){ global $db; - return mysqli_real_escape_string($db, htmlspecialchars($String, ENT_COMPAT,'utf-8')); + return mysqli_real_escape_string($db, htmlspecialchars($String, ENT_COMPAT,'utf-8', false)); } function DB_show_tables(&$Conn){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-01-31 21:49:09
|
Revision: 4861 http://web-erp.svn.sourceforge.net/web-erp/?rev=4861&view=rev Author: vvs2012 Date: 2012-01-31 21:48:58 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. Modified Paths: -------------- trunk/GoodsReceived.php trunk/ReorderLevelLocation.php trunk/ReverseGRN.php trunk/SuppInvGRNs.php trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/GoodsReceived.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -448,7 +448,7 @@ VALUES ('" . $GRN . "', '" . $OrderLine->PODetailRec . "', '" . $OrderLine->StockID . "', - '" . $OrderLine->ItemDescription . "', + '" . DB_escape_string($OrderLine->ItemDescription) . "', '" . $_POST['DefaultReceivedDate'] . "', '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO'.$identifier]->SupplierID . "', @@ -507,7 +507,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $LocalCurrencyPrice . "', '" . $PeriodNo . "', - '" . $_SESSION['PO'.$identifier]->SupplierID . " (" . $_SESSION['PO'.$identifier]->SupplierName . ") - " .$_SESSION['PO'.$identifier]->OrderNo . "', + '" . $_SESSION['PO'.$identifier]->SupplierID . " (" . DB_escape_string($_SESSION['PO'.$identifier]->SupplierName) . ") - " .$_SESSION['PO'.$identifier]->OrderNo . "', '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', '" . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . "' @@ -662,7 +662,7 @@ '" . $PeriodNo . "', '" . $OrderLine->GLCode . "', 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID - . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + . " - " . DB_escape_string($OrderLine->ItemDescription) . " x " . $OrderLine->ReceiveQty . " @ " . locale_number_format($CurrentStandardCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' )"; @@ -686,7 +686,7 @@ '" . $_POST['DefaultReceivedDate'] . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['grnact'] . "', - '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . DB_escape_string($OrderLine->ItemDescription) . ' x ' . $OrderLine->ReceiveQty . ' @ ' . locale_number_format($UnitCost,$_SESSION['CompanyRecord']['decimalplaces']) . "', '" . -$UnitCost * $OrderLine->ReceiveQty . "' )"; Modified: trunk/ReorderLevelLocation.php =================================================================== --- trunk/ReorderLevelLocation.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/ReorderLevelLocation.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -139,7 +139,7 @@ <td class="number">'.$QtyInvoice.'</td> <td class="number">'.$ohRow['0'].'</td> <td class="number">'.$ohinRow['0'].'</td> - <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="3" size="4" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> + <td><input type="text" class="number" name="ReorderLevel' . $i .'" maxlength="10" size="10" value="'. locale_number_format($myrow['reorderlevel'],0) .'" /> <input type="hidden" name="StockID' . $i . '" value="' . $myrow['stockid'] . '" /></td> </tr> '; $i++; Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/ReverseGRN.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -221,7 +221,7 @@ $Result=DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); /* If its a stock item .... Insert stock movements - with unit cost */ - + $NewQtyOnHand = $QtyOnHandPrior - $QtyToReverse; $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -242,7 +242,7 @@ '" . _('Reversal') . ' - ' . $_POST['SupplierID'] . ' - ' . $GRN['orderno'] . "', '" . -$QtyToReverse . "', '" . $GRN['stdcostunit'] . "', - '" . $QtyOnHandPrior - $QtyToReverse . "' + '" . $NewQtyOnHand . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Stock movement records could not be inserted because'); Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/SuppInvGRNs.php 2012-01-31 21:48:58 UTC (rev 4861) @@ -80,7 +80,7 @@ if (!is_numeric(filter_number_format($_POST['ChgPrice'])) AND filter_number_format($_POST['ChgPrice'])<0){ $InputError = True; prnMsg(_('The price charged in the suppliers currency is either not numeric or negative') . '. ' . _('The goods received cannot be invoiced at this price'),'error'); - } elseif ($_SESSION['Check_Price_Charged_vs_Order_Price'] == True) { + } elseif ($_SESSION['Check_Price_Charged_vs_Order_Price'] == True AND $_POST['OrderPrice'] != 0) { if (filter_number_format($_POST['ChgPrice'])/$_POST['OrderPrice'] > (1+ ($_SESSION['OverChargeProportion'] / 100))){ prnMsg(_('The price being invoiced is more than the purchase order price by more than') . ' ' . $_SESSION['OverChargeProportion'] . '%. ' . _('The system is set up to prohibit this so will put this invoice on hold until it is authorised'),'warn'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/doc/Change.log 2012-01-31 21:48:58 UTC (rev 4861) @@ -1,5 +1,6 @@ webERP Change Log +31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; 30/1/12 Vitaly: Removed extra 'AND' in SQL statement in ReverseGRN.php Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/includes/ConnectDB_mysql.inc 2012-01-31 21:48:58 UTC (rev 4861) @@ -165,7 +165,7 @@ } function DB_escape_string($String){ - return mysql_real_escape_string(htmlspecialchars($String, ENT_COMPAT, 'utf-8')); + return mysql_real_escape_string(htmlspecialchars($String, ENT_COMPAT, 'utf-8', false)); } function DB_show_tables(&$Conn){ Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2012-01-31 18:46:10 UTC (rev 4860) +++ trunk/includes/ConnectDB_mysqli.inc 2012-01-31 21:48:58 UTC (rev 4861) @@ -177,7 +177,7 @@ function DB_escape_string($String){ global $db; - return mysqli_real_escape_string($db, htmlspecialchars($String, ENT_COMPAT,'utf-8')); + return mysqli_real_escape_string($db, htmlspecialchars($String, ENT_COMPAT,'utf-8', false)); } function DB_show_tables(&$Conn){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-02 09:51:21
|
Revision: 4863 http://web-erp.svn.sourceforge.net/web-erp/?rev=4863&view=rev Author: daintree Date: 2012-02-02 09:51:09 +0000 (Thu, 02 Feb 2012) Log Message: ----------- API stuff Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_errorcodes.php trunk/api/api_xml-rpc.php trunk/doc/Manual/ManualCreatingNewSystem.html Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_debtortransactions.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -241,7 +241,11 @@ return $Errors; } -/* Retrieves the default sales GL code for a given part code and sales area */ +/* Retrieves the default sales GL code for a given part code and sales area + * + * This function also in SQL_CommonFunctions...better to use it from there as it covers all cases + * and not limited to stk='any'!! + * function GetSalesGLCode($salesarea, $partnumber, $db) { $sql="SELECT salesglcode FROM salesglpostings WHERE stkcat='any'"; @@ -249,6 +253,7 @@ $myrow=DB_fetch_array($result); return $myrow[0]; } +*/ /* Retrieves the default debtors code for webERP */ function GetDebtorsGLCode($db) { @@ -258,7 +263,10 @@ return $myrow[0]; } -/* Retrieves the next transaction number for the given type */ +/* Retrieves the next transaction number for the given type + * This function is already included from SQL_CommonFunctions.php???? + Isn't it?? + function GetNextTransactionNo($type, $db) { $sql="SELECT typeno FROM systypes WHERE typeid='" . $type . "'"; $result=DB_query($sql, $db); @@ -267,9 +275,666 @@ return $NextTransaction; } +*/ +/* Create a customer credit note in webERP. + * Needs an associative array for the Header + * and an array of assocative arrays for the $LineDetails + */ + function CreateCreditNote($Header,$LineDetails, $User, $Password) { + + /* $Header contains an associative array in the format: + * Header['debtorno'] + * Header['branchcode'] + * Header['trandate'] + * Header['tpe'] + * Header['fromstkloc'] + * Header['customerref'] + * Header['shipvia'] + * + * and $LineDetails contains an array of associative arrays of the format: + * + * $LineDetails[0]['stockid'] + * $LineDetails[0]['price'] + * $LineDetails[0]['qty'] + * $LineDetails[0]['discountpercent'] + */ + $Errors = array(); + $db = db($User, $Password); + if (gettype($db)=='integer') { + $Errors[0]=NoAuthorisation; + return $Errors; + } + $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); + /*Does not deal with assembly items or serialise/lot track items - for use by POS */ + /*Get Company Defaults */ + $ReadCoyResult = api_DB_query("SELECT debtorsact, + freightact, + gllink_debtors, + gllink_stock + FROM companies + WHERE coycode=1",$db); + + $CompanyRecord = DB_fetch_array($ReadCoyResult); + if (DB_error_no($db) != 0) { + $Errors[] = NoCompanyRecord; + } + + $HeaderSQL = "SELECT custbranch.area, + custbranch.taxgroupid, + debtorsmaster.currcode, + rate, + salesman + FROM debtorsmaster + INNER JOIN custbranch + ON debtorsmaster.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + WHERE custbranch.debtorno = '" . $Header['debtorno'] . "' + AND custbranch.branchcode='" . $Header['branchcode'] . "'"; + + $HeaderResult = api_DB_query($OrderHeaderSQL,$db); + if (DB_error_no($db) != 0) { + $Errors[] = NoReadCustomerBranch; + } + + $CN_Header = DB_fetch_array($HeaderResult); + + $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $Header['fromstkloc'] ."'",$db); + if (DB_error_no($db) != 0) { + $Errors[] = NoTaxProvince; + } + $myrow = DB_fetch_row($TaxProvResult); + $DispTaxProvinceID = $myrow[0]; + + /*Start an SQL transaction */ + $result = DB_Txn_Begin($db); + /*Now Get the next credit note number - function in SQL_CommonFunctions*/ + $CreditNoteNo = GetNextTransNo(11, $db); + $PeriodNo = GetCurrentPeriod($db); + + $TotalFXNetCredit = 0; + $TotalFXTax = 0; + $LineCounter =0; + + foreach ($LineItems as $CN_Line) { + + $LineSQL = "SELECT taxcatid, + mbflag, + materialcost+labourcost+overheadcost AS standardcost + FROM stockmaster + WHERE stockid ='" . $CN_Line['stockid'] . "'"; + + $LineResult = api_DB_query($LineSQL,$db); + if (DB_error_no($db) != 0 OR DB_num_rows($LineResult)==0) { + $Errors[] = NoReadItem; + return $Errors; + } + $LineRow = DB_fetch_array($LineResult); + + $StandardCost = $LineRow['standardcost']; + $LocalCurrencyPrice= ($CN_Line['price'] *(1- floatval($CN_Line['discountpercent'])))/ $CN_Header['rate']; + $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); + + /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item + and the taxprovince of the dispatch location */ + + $SQL = "SELECT taxgrouptaxes.calculationorder, + taxauthorities.description, + taxgrouptaxes.taxauthid, + taxauthorities.taxglcode, + taxgrouptaxes.taxontax, + taxauthrates.taxrate + FROM taxauthrates INNER JOIN taxgrouptaxes ON + taxauthrates.taxauthority=taxgrouptaxes.taxauthid + INNER JOIN taxauthorities ON + taxauthrates.taxauthority=taxauthorities.taxid + WHERE taxgrouptaxes.taxgroupid='" . $CN_Header['taxgroupid'] . "' + AND taxauthrates.dispatchtaxprovince='" . $DispTaxProvinceID . "' + AND taxauthrates.taxcatid = '" . $CN_Line['taxcatid'] . "' + ORDER BY taxgrouptaxes.calculationorder"; + + $GetTaxRatesResult = api_DB_query($SQL,$db); + + if (DB_error_no($db) != 0) { + $Errors[] = TaxRatesFailed; + } + + $LineTaxAmount = 0; + $TaxTotals =array(); + + while ($myrow = DB_fetch_array($GetTaxRatesResult)){ + if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { + $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; + } + $TaxAuthID=$myrow['taxauthid']; + $TaxTotals[$myrow['taxauthid']]['GLCode'] = $myrow['taxglcode']; + $TaxTotals[$myrow['taxauthid']]['TaxRate'] = $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['TaxAuthDescription'] = $myrow['description']; + + if ($myrow['taxontax'] ==1){ + $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + } else { + $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; + } + + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid + so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ + $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], + 'TaxAuthID' =>$myrow['taxauthid'], + 'TaxAuthDescription'=>$myrow['description'], + 'TaxRate'=>$myrow['taxrate'], + 'TaxOnTax'=>$myrow['taxontax'], + 'TaxAuthAmount'=>$TaxAuthAmount); + $LineTaxAmount += $TaxAuthAmount; + + }//end loop around Taxes + + $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); + + $TotalFXNetCredit += $LineNetAmount; + $TotalFXTax += $LineTaxAmount; + + + if ($LineRow['mbflag']=='B' OR $LineRow['mbflag']=='M') { + $Assembly = False; + + /* Need to get the current location quantity + will need it later for the stock movement */ + $SQL="SELECT locstock.quantity + FROM locstock + WHERE locstock.stockid='" . $CN_Line['stockid'] . "' + AND loccode= '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL, $db); + + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /* There must be some error this should never happen */ + $QtyOnHandPrior = 0; + } + + $SQL = "UPDATE locstock + SET quantity = locstock.quantity - " . $CN_Line['qty'] . " + WHERE locstock.stockid = '" . $CN_Line['stockid'] . "' + AND loccode = '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL,$db,'','',true); + + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh) + VALUES ('" . $CN_Line['stockid'] . "', + '11', + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $Header['customerref'] . "', + '" . -$CN_Line['qty'] . "', + '" . $CN_Line['discountpercent'] . "', + '" . $StandardCost . "', + '" . ($QtyOnHandPrior - $CN_Line['qty']) . "' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + + } else if ($LineRow['mbflag']=='A'){ /* its an assembly */ + /*Need to get the BOM for this part and make + stock moves for the components then update the Location stock balances */ + $Assembly=True; + $StandardCost =0; /*To start with - accumulate the cost of the comoponents for use in journals later on */ + $SQL = "SELECT bom.component, + bom.quantity, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $CN_Line['stockid'] . "' + AND bom.effectiveto >= '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + + $AssResult = api_DB_query($SQL,$db); + + while ($AssParts = DB_fetch_array($AssResult,$db)){ + + $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; + /* Need to get the current location quantity + will need it later for the stock movement */ + $SQL="SELECT locstock.quantity + FROM locstock + WHERE locstock.stockid='" . $AssParts['component'] . "' + AND loccode= '" . $Header['fromstkloc'] . "'"; + + $Result = api_DB_query($SQL,$db); + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /*There must be some error this should never happen */ + $QtyOnHandPrior = 0; + } + if (empty($AssParts['standard'])) { + $AssParts['standard']=0; + } + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh) + VALUES ('" . $AssParts['component'] . "', + 11, + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $CN_Line['stkcode'] . ' ' . $Header['customerref'] . "', + '" . (-$AssParts['quantity'] * $CN_Line['qty']) . "', + '" . $AssParts['standard'] . "', + 0, + '" . ($QtyOnHandPrior - ($AssParts['quantity'] * $CN_Line['qty'])) . "' )"; + + $Result = DB_query($SQL,$db,'','',true); + + $SQL = "UPDATE locstock + SET quantity = locstock.quantity - " . ($AssParts['quantity'] * $CN_Line['qty']) . " + WHERE locstock.stockid = '" . $AssParts['component'] . "' + AND loccode = '" . $Header['fromlocstk'] . "'"; + + $Result = DB_query($SQL,$db,'','',true); + } /* end of assembly explosion and updates */ + } /* end of its an assembly */ + + + if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ + /*it's a Dummy/Service item or an Assembly item - still need stock movement record + * but quantites on hand are always nil */ + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh) + VALUES ('" . $CN_Line['stockid'] . "', + '11', + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $Header['customerref'] . "', + '" . -$CN_Line['qty'] . "', + '" . $CN_Line['discountpercent'] . "', + '" . $StandardCost . "', + '0' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + /*Get the ID of the StockMove... */ + $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + /*Insert the taxes that applied to this line */ + foreach ($LineTaxes[$LineCounter] as $Tax) { + + $SQL = "INSERT INTO stockmovestaxes (stkmoveno, + taxauthid, + taxrate, + taxcalculationorder, + taxontax) + VALUES ('" . $StkMoveNo . "', + '" . $Tax['TaxAuthID'] . "', + '" . $Tax['TaxRate'] . "', + '" . $Tax['TaxCalculationOrder'] . "', + '" . $Tax['TaxOnTax'] . "')"; + + $Result = DB_query($SQL,$db,'','',true); + } + + /*Insert Sales Analysis records */ + + $SQL="SELECT COUNT(*), + salesanalysis.stkcategory, + salesanalysis.area, + salesanalysis.salesperson, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.stockid + FROM salesanalysis, + custbranch, + stockmaster + WHERE salesanalysis.stkcategory=stockmaster.categoryid + AND salesanalysis.stockid=stockmaster.stockid + AND salesanalysis.cust=custbranch.debtorno + AND salesanalysis.custbranch=custbranch.branchcode + AND salesanalysis.area=custbranch.area + AND salesanalysis.salesperson=custbranch.salesman + AND salesanalysis.typeabbrev ='" . $Header['tpe'] . "' + AND salesanalysis.periodno='" . $PeriodNo . "' + AND salesanalysis.cust " . LIKE . " '" . $Header['debtorno'] . "' + AND salesanalysis.custbranch " . LIKE . " '" . $Header['branchcode'] . "' + AND salesanalysis.stockid " . LIKE . " '" . $CN_Line['stockid'] . "' + AND salesanalysis.budgetoractual='1' + GROUP BY salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson"; + + $ErrMsg = _('The count of existing Sales analysis records could not run because'); + $DbgMsg = _('SQL to count the no of sales analysis records'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + + $myrow = DB_fetch_row($Result); + + if ($myrow[0]>0){ /*Update the existing record that already exists */ + + $SQL = "UPDATE salesanalysis + SET amt=amt+" . ($CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . ", + qty=qty +" . $CN_Line['qty'] . ", + disc=disc+" . ($CN_Line['discountpercent'] * $CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . " + WHERE salesanalysis.area='" . $myrow[2] . "' + AND salesanalysis.salesperson='" . $myrow[3] . "' + AND typeabbrev ='" . $Header['tpe'] . "' + AND periodno = '" . $PeriodNo . "' + AND cust " . LIKE . " '" . $Header['debtorno'] . "' + AND custbranch " . LIKE . " '" . $Header['branchcode'] . "' + AND stockid " . LIKE . " '" . $CN_Line['stockid'] . "' + AND salesanalysis.stkcategory ='" . $myrow[1] . "' + AND budgetoractual='1'"; + + } else { /* insert a new sales analysis record */ + + $SQL = "INSERT INTO salesanalysis ( typeabbrev, + periodno, + amt, + cost, + cust, + custbranch, + qty, + disc, + stockid, + area, + budgetoractual, + salesperson, + stkcategory ) + SELECT '" . $Header['tpe']. "', + '" . $PeriodNo . "', + '" . ($CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . "', + 0, + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $CN_Line['qty'] . "', + '" . ($CN_Line['discountpercent'] * $CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . "', + '" . $CN_Line['stockid'] . "', + custbranch.area, + 1, + custbranch.salesman, + stockmaster.categoryid + FROM stockmaster, custbranch + WHERE stockmaster.stockid = '" . $CN_Line['stockid'] . "' + AND custbranch.debtorno = '" . $Header['debtorno'] . "' + AND custbranch.branchcode='" . $Header['branchcode'] . "'"; + + } + + $Result = api_DB_query($SQL,$db,'','',true); + + if ($CompanyRecord['gllink_stock']==1 AND $StandardCost !=0){ + +/*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . GetCOGSGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db) . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $StandardCost . "', + '" . ($StandardCost * $CN_Line['qty']) . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + +/*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ + $StockGLCode = GetStockGLCode($CN_Line['stockid'],$db); + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $StockGLCode['stockact'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $StandardCost . "', + '" . (-$StandardCost * $CN_Line['qty']) . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ + + if ($CompanyRecord['gllink_debtors']==1 AND $CN_Line['price'] !=0){ + + //Post sales transaction to GL credit sales + $SalesGLAccounts = GetSalesGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db); + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount ) + VALUES ('11', + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $SalesGLAccounts['salesglcode'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $CN_Line['price'] . "', + '" . (-$CN_Line['price'] * $CN_Line['qty']/$CN_Header['rate']) . "' + )"; + $Result = api_DB_query($SQL,$db,'','',true); + + if ($CN_Line['discountpercent'] !=0){ + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $SalesGLAccounts['discountglcode'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " @ " . ($CN_Line['discountpercent'] * 100) . "%', + '" . ($CN_Line['price'] * $CN_Line['quantity'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; + + $Result = DB_query($SQL,$db,'','',true); + } /*end of if discount !=0 */ + + } /*end of if sales integrated with gl */ + + $LineCounter++; //needed for the array of taxes by line + } /*end of OrderLine loop */ + + $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$OrderHeader['rate']; + + +//To here + + + if ($CompanyRecord['gllink_debtors']==1){ + + /*Now post the tax to the GL at local currency equivalent */ + if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { + + + /*Loop through the tax authorities array to post each total to the taxauth glcode */ + foreach ($TaxTotals as $Tax){ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount ) + VALUES (10, + '" . $InvoiceNo . "', + '" . $OrderHeader['orddate']. "', + '" . $PeriodNo . "', + '" . $Tax['GLCode'] . "', + '" . $OrderHeader['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', + '" . -$Tax['FXAmount']/$OrderHeader['rate'] . "' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + } + + /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ + if (($TotalCreditLocalCurr) !=0) { + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('10', + '" . $InvoiceNo . "', + '" . $OrderHeader['orddate'] . "', + '" . $PeriodNo . "', + '" . $CompanyRecord['debtorsact'] . "', + '" . $OrderHeader['debtorno'] . "', + '" . $TotalCreditLocalCurr . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + EnsureGLEntriesBalance(10,$InvoiceNo,$db); + + } /*end of if Sales and GL integrated */ + + /*Update order header for invoice charged on */ + $SQL = "UPDATE salesorders SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') WHERE orderno= '" . $OrderNo . "'"; + $Result = api_DB_query($SQL,$db,'','',true); + + /*Now insert the DebtorTrans */ + + $SQL = "INSERT INTO debtortrans (transno, + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + order_, + ovamount, + ovgst, + rate, + shipvia) + VALUES ( + '". $InvoiceNo . "', + 10, + '" . $OrderHeader['debtorno'] . "', + '" . $OrderHeader['branchcode'] . "', + '" . $OrderHeader['orddate'] . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '" . $OrderHeader['customerref'] . "', + '" . $OrderHeader['sales_type'] . "', + '" . $OrderNo . "', + '" . $TotalFXNetCredit . "', + '" . $TotalFXTax . "', + '" . $OrderHeader['rate'] . "', + '" . $OrderHeader['shipvia'] . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + + /*for each Tax - need to insert into debtortranstaxes */ + foreach ($TaxTotals AS $TaxAuthID => $Tax) { + + $SQL = "INSERT INTO debtortranstaxes (debtortransid, + taxauthid, + taxamount) + VALUES ('" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; + $Result = api_DB_query($SQL,$db,'','',true); + } + + if (sizeof($Errors)==0) { + + $Result = DB_Txn_Commit($db); + $Errors[0]=0; + $Errors[1]=$InvoiceNo; + } else { + $Result = DB_Txn_Rollback($db); + } + return $Errors; + + } /*End of CreateCreditNote method */ + /* Create a customer invoice in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. + * There are no stock updates no accounting for assemblies no updates + * to sales analysis records - no cost of sales entries in GL + * USE WITH CAUTION */ function InsertSalesInvoice($InvoiceDetails, $user, $password) { $Errors = array(); @@ -397,6 +1062,9 @@ /* Create a customer credit note in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. All values should be sent as negatives. + * stock is not updated and the method cannot deal with assembly items + * the sales analysis is not updated either + * USE WITH CAUTION!! */ function InsertSalesCredit($CreditDetails, $user, $password) { $Errors = array(); Modified: trunk/api/api_errorcodes.php =================================================================== --- trunk/api/api_errorcodes.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_errorcodes.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -165,7 +165,8 @@ Define('NoReadOrderLines',1160); Define('NoTaxProvince',1161); Define('TaxRatesFailed',1162); - + Define('NoReadCustomerBranch',1163); + Define('NoReadItem',1164); /* Array of Descriptions of errors */ $ErrorDescription['1'] = _('No Authorisation'); @@ -331,5 +332,7 @@ $ErrorDescription['1160'] = _('Unable to read sales order lines'); $ErrorDescription['1161'] = _('Unable to get tax province of location'); $ErrorDescription['1162'] = _('Unable to read tax rates for this item and tax group'); + $ErrorDescription['1163'] = _('Unable to read customer and branch details'); + $ErrorDescription['1164'] = _('Unable to read credit note item details'); ?> \ No newline at end of file Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_xml-rpc.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -1056,6 +1056,35 @@ unset($Parameter); unset($ReturnValue); + $Description = _('Creates a credit note from header details associative array and line items'); + $Parameter[0]['name'] = _('Credit Note Header Details'); + $Parameter[0]['description'] = _('An associative array describing the credit note header with the fields debtorno, branchcode, trandate, tpe, fromstkloc, customerref, shipvia'); + $Parameter[1]['name'] = _('Credit note line items'); + $Parameter[1]['description'] = _('The lines of stock being returned on this credit note. Only stock returns can be dealt with using this API method. This is an array of associative arrays containing the fields, stockid, price, qty, discountpercent for the items returned'); + $Parameter[2]['name'] = _('User name'); + $Parameter[2]['description'] = _('A valid weberp username. This user should have security access to this data.'); + $Parameter[3]['name'] = _('User password'); + $Parameter[3]['description'] = _('The weberp password associated with this user name. '); + $ReturnValue[0] = _('This function returns an array of integers. ') + ._('If the first element is zero then the function was successful, and the second element is the credit note number. ') + ._('Otherwise an array of error codes is returned and no insertion takes place. '); + +/*E*/$CreateCreditNote_sig = array(array($xmlrpcStruct,$xmlrpcStruct), +/*x*/ array($xmlrpcStruct,$xmlrpcStruct,$xmlrpcArray,$xmlrpcString,$xmlrpcString)); + $CreateCreditNote_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue ); + + function xmlrpc_CreateCreditNote($xmlrpcmsg){ + ob_start('ob_file_callback'); +/*x*/ if ($xmlrpcmsg->getNumParams() == 4) { +/*x*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreateCreditNote(php_xmlrpc_decode($xmlrpcmsg->getParam( 0 )), php_xmlrpc_decode($xmlrpcmsg->getParam( 1 )), $xmlrpcmsg->getParam( 2 )->scalarval( ),$xmlrpcmsg->getParam( 3 )->scalarval( ))) ); +/*x*/ } else { +/*e*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreateCreditNote(php_xmlrpc_decode($xmlrpcmsg->getParam( 0 )),php_xmlrpc_decode($xmlrpcmsg->getParam( 1 )), '', ''))); +/*x*/ } + ob_end_flush(); + return $rtn; + } + + $Description = _('Inserts a sales invoice into the debtortrans table and does the relevant GL entries'); $Parameter[0]['name'] = _('Invoice Details'); $Parameter[0]['description'] = _('An array of index/value items describing the invoice.') @@ -3038,6 +3067,10 @@ "function" => "xmlrpc_InsertSalesInvoice", "signature" => $InsertSalesInvoice_sig, "docstring" => $InsertSalesInvoice_doc), + "weberp.xmlrpc_CreateCreditNote" => array( + "function" => "xmlrpc_CreateCreditNote", + "signature" => $CreateCreditNote_sig, + "docstring" => $CreateCreditNote_doc), "weberp.xmlrpc_InsertSalesCredit" => array( "function" => "xmlrpc_InsertSalesCredit", "signature" => $InsertSalesCredit_sig, Modified: trunk/doc/Manual/ManualCreatingNewSystem.html =================================================================== --- trunk/doc/Manual/ManualCreatingNewSystem.html 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/doc/Manual/ManualCreatingNewSystem.html 2012-02-02 09:51:09 UTC (rev 4863) @@ -317,11 +317,11 @@ <font size="+1"><b>Sales Ledger - Accounts Receivable Integration to General Ledger Issues</b></font> <br /><br /> Some flexibility is provided in how sales transactions are posted to the general ledger. Different sales accounts can be used depending on any combination of the sales area of the customer, the sales type and the stock category of the item sold. Before entering any sales it is important to defined the posting schema under setup - Sales GL Interface Postings. The same flexibility is also afforded to the posting of cost of goods sold (COGS)- of course these journals are only created if the stock GL interface is activated. If it is then again it is critical to ensure the proper set up of the posting schema for COGS under the setup tab - COGS GL Interface posting - +<br /><br /> <font size="+1"><b>Tax</b></font> <br /><br /> Taxes must be setup. In Setup there are Tax Group Maintenance, Dispatch Tax Province Maintenance, Tax Categories Maintenance and Tax Authorities and Rates Maintenance. Before you set up customer branches the tax group that relates the branch must be defined - the tax group specifies the tax authorities to which taxes must be charged on sales to the branch. The system allows any number of tax authorities to be included in a tax group. The tax category must be specified on the setup of items - some items attract tax at higher rates and these must be flagged as such. As many tax categories as necessary can be defined. There is a more detailed section in the manual for further details on tax. - +<br /><br /> <font size="+1"><b>Setting Up Customers</b></font> <br /><br /> As many branches as required can be set up, it is recommended that branches be used liberally for all customer contacts even though the branch may not be invoiced. Thus all contacts can be kept against the customer they belong with. Each branch requires a sales area and a salesperson. Sales Areas are the areas defined for analysis purposes. Both Sales Areas and Salespeople are set up from the System Setup tab of the main menu. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-02 09:51:20
|
Revision: 4863 http://web-erp.svn.sourceforge.net/web-erp/?rev=4863&view=rev Author: daintree Date: 2012-02-02 09:51:09 +0000 (Thu, 02 Feb 2012) Log Message: ----------- API stuff Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_errorcodes.php trunk/api/api_xml-rpc.php trunk/doc/Manual/ManualCreatingNewSystem.html Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_debtortransactions.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -241,7 +241,11 @@ return $Errors; } -/* Retrieves the default sales GL code for a given part code and sales area */ +/* Retrieves the default sales GL code for a given part code and sales area + * + * This function also in SQL_CommonFunctions...better to use it from there as it covers all cases + * and not limited to stk='any'!! + * function GetSalesGLCode($salesarea, $partnumber, $db) { $sql="SELECT salesglcode FROM salesglpostings WHERE stkcat='any'"; @@ -249,6 +253,7 @@ $myrow=DB_fetch_array($result); return $myrow[0]; } +*/ /* Retrieves the default debtors code for webERP */ function GetDebtorsGLCode($db) { @@ -258,7 +263,10 @@ return $myrow[0]; } -/* Retrieves the next transaction number for the given type */ +/* Retrieves the next transaction number for the given type + * This function is already included from SQL_CommonFunctions.php???? + Isn't it?? + function GetNextTransactionNo($type, $db) { $sql="SELECT typeno FROM systypes WHERE typeid='" . $type . "'"; $result=DB_query($sql, $db); @@ -267,9 +275,666 @@ return $NextTransaction; } +*/ +/* Create a customer credit note in webERP. + * Needs an associative array for the Header + * and an array of assocative arrays for the $LineDetails + */ + function CreateCreditNote($Header,$LineDetails, $User, $Password) { + + /* $Header contains an associative array in the format: + * Header['debtorno'] + * Header['branchcode'] + * Header['trandate'] + * Header['tpe'] + * Header['fromstkloc'] + * Header['customerref'] + * Header['shipvia'] + * + * and $LineDetails contains an array of associative arrays of the format: + * + * $LineDetails[0]['stockid'] + * $LineDetails[0]['price'] + * $LineDetails[0]['qty'] + * $LineDetails[0]['discountpercent'] + */ + $Errors = array(); + $db = db($User, $Password); + if (gettype($db)=='integer') { + $Errors[0]=NoAuthorisation; + return $Errors; + } + $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); + /*Does not deal with assembly items or serialise/lot track items - for use by POS */ + /*Get Company Defaults */ + $ReadCoyResult = api_DB_query("SELECT debtorsact, + freightact, + gllink_debtors, + gllink_stock + FROM companies + WHERE coycode=1",$db); + + $CompanyRecord = DB_fetch_array($ReadCoyResult); + if (DB_error_no($db) != 0) { + $Errors[] = NoCompanyRecord; + } + + $HeaderSQL = "SELECT custbranch.area, + custbranch.taxgroupid, + debtorsmaster.currcode, + rate, + salesman + FROM debtorsmaster + INNER JOIN custbranch + ON debtorsmaster.debtorno = custbranch.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + WHERE custbranch.debtorno = '" . $Header['debtorno'] . "' + AND custbranch.branchcode='" . $Header['branchcode'] . "'"; + + $HeaderResult = api_DB_query($OrderHeaderSQL,$db); + if (DB_error_no($db) != 0) { + $Errors[] = NoReadCustomerBranch; + } + + $CN_Header = DB_fetch_array($HeaderResult); + + $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $Header['fromstkloc'] ."'",$db); + if (DB_error_no($db) != 0) { + $Errors[] = NoTaxProvince; + } + $myrow = DB_fetch_row($TaxProvResult); + $DispTaxProvinceID = $myrow[0]; + + /*Start an SQL transaction */ + $result = DB_Txn_Begin($db); + /*Now Get the next credit note number - function in SQL_CommonFunctions*/ + $CreditNoteNo = GetNextTransNo(11, $db); + $PeriodNo = GetCurrentPeriod($db); + + $TotalFXNetCredit = 0; + $TotalFXTax = 0; + $LineCounter =0; + + foreach ($LineItems as $CN_Line) { + + $LineSQL = "SELECT taxcatid, + mbflag, + materialcost+labourcost+overheadcost AS standardcost + FROM stockmaster + WHERE stockid ='" . $CN_Line['stockid'] . "'"; + + $LineResult = api_DB_query($LineSQL,$db); + if (DB_error_no($db) != 0 OR DB_num_rows($LineResult)==0) { + $Errors[] = NoReadItem; + return $Errors; + } + $LineRow = DB_fetch_array($LineResult); + + $StandardCost = $LineRow['standardcost']; + $LocalCurrencyPrice= ($CN_Line['price'] *(1- floatval($CN_Line['discountpercent'])))/ $CN_Header['rate']; + $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); + + /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item + and the taxprovince of the dispatch location */ + + $SQL = "SELECT taxgrouptaxes.calculationorder, + taxauthorities.description, + taxgrouptaxes.taxauthid, + taxauthorities.taxglcode, + taxgrouptaxes.taxontax, + taxauthrates.taxrate + FROM taxauthrates INNER JOIN taxgrouptaxes ON + taxauthrates.taxauthority=taxgrouptaxes.taxauthid + INNER JOIN taxauthorities ON + taxauthrates.taxauthority=taxauthorities.taxid + WHERE taxgrouptaxes.taxgroupid='" . $CN_Header['taxgroupid'] . "' + AND taxauthrates.dispatchtaxprovince='" . $DispTaxProvinceID . "' + AND taxauthrates.taxcatid = '" . $CN_Line['taxcatid'] . "' + ORDER BY taxgrouptaxes.calculationorder"; + + $GetTaxRatesResult = api_DB_query($SQL,$db); + + if (DB_error_no($db) != 0) { + $Errors[] = TaxRatesFailed; + } + + $LineTaxAmount = 0; + $TaxTotals =array(); + + while ($myrow = DB_fetch_array($GetTaxRatesResult)){ + if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { + $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; + } + $TaxAuthID=$myrow['taxauthid']; + $TaxTotals[$myrow['taxauthid']]['GLCode'] = $myrow['taxglcode']; + $TaxTotals[$myrow['taxauthid']]['TaxRate'] = $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['TaxAuthDescription'] = $myrow['description']; + + if ($myrow['taxontax'] ==1){ + $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + } else { + $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; + } + + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid + so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ + $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], + 'TaxAuthID' =>$myrow['taxauthid'], + 'TaxAuthDescription'=>$myrow['description'], + 'TaxRate'=>$myrow['taxrate'], + 'TaxOnTax'=>$myrow['taxontax'], + 'TaxAuthAmount'=>$TaxAuthAmount); + $LineTaxAmount += $TaxAuthAmount; + + }//end loop around Taxes + + $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); + + $TotalFXNetCredit += $LineNetAmount; + $TotalFXTax += $LineTaxAmount; + + + if ($LineRow['mbflag']=='B' OR $LineRow['mbflag']=='M') { + $Assembly = False; + + /* Need to get the current location quantity + will need it later for the stock movement */ + $SQL="SELECT locstock.quantity + FROM locstock + WHERE locstock.stockid='" . $CN_Line['stockid'] . "' + AND loccode= '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL, $db); + + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /* There must be some error this should never happen */ + $QtyOnHandPrior = 0; + } + + $SQL = "UPDATE locstock + SET quantity = locstock.quantity - " . $CN_Line['qty'] . " + WHERE locstock.stockid = '" . $CN_Line['stockid'] . "' + AND loccode = '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL,$db,'','',true); + + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh) + VALUES ('" . $CN_Line['stockid'] . "', + '11', + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $Header['customerref'] . "', + '" . -$CN_Line['qty'] . "', + '" . $CN_Line['discountpercent'] . "', + '" . $StandardCost . "', + '" . ($QtyOnHandPrior - $CN_Line['qty']) . "' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + + } else if ($LineRow['mbflag']=='A'){ /* its an assembly */ + /*Need to get the BOM for this part and make + stock moves for the components then update the Location stock balances */ + $Assembly=True; + $StandardCost =0; /*To start with - accumulate the cost of the comoponents for use in journals later on */ + $SQL = "SELECT bom.component, + bom.quantity, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standard + FROM bom INNER JOIN stockmaster + ON bom.component=stockmaster.stockid + WHERE bom.parent='" . $CN_Line['stockid'] . "' + AND bom.effectiveto >= '" . Date('Y-m-d') . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "'"; + + $AssResult = api_DB_query($SQL,$db); + + while ($AssParts = DB_fetch_array($AssResult,$db)){ + + $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; + /* Need to get the current location quantity + will need it later for the stock movement */ + $SQL="SELECT locstock.quantity + FROM locstock + WHERE locstock.stockid='" . $AssParts['component'] . "' + AND loccode= '" . $Header['fromstkloc'] . "'"; + + $Result = api_DB_query($SQL,$db); + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; + } else { + /*There must be some error this should never happen */ + $QtyOnHandPrior = 0; + } + if (empty($AssParts['standard'])) { + $AssParts['standard']=0; + } + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + prd, + reference, + qty, + standardcost, + show_on_inv_crds, + newqoh) + VALUES ('" . $AssParts['component'] . "', + 11, + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $PeriodNo . "', + '" . _('Assembly') . ': ' . $CN_Line['stkcode'] . ' ' . $Header['customerref'] . "', + '" . (-$AssParts['quantity'] * $CN_Line['qty']) . "', + '" . $AssParts['standard'] . "', + 0, + '" . ($QtyOnHandPrior - ($AssParts['quantity'] * $CN_Line['qty'])) . "' )"; + + $Result = DB_query($SQL,$db,'','',true); + + $SQL = "UPDATE locstock + SET quantity = locstock.quantity - " . ($AssParts['quantity'] * $CN_Line['qty']) . " + WHERE locstock.stockid = '" . $AssParts['component'] . "' + AND loccode = '" . $Header['fromlocstk'] . "'"; + + $Result = DB_query($SQL,$db,'','',true); + } /* end of assembly explosion and updates */ + } /* end of its an assembly */ + + + if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ + /*it's a Dummy/Service item or an Assembly item - still need stock movement record + * but quantites on hand are always nil */ + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + debtorno, + branchcode, + price, + prd, + reference, + qty, + discountpercent, + standardcost, + newqoh) + VALUES ('" . $CN_Line['stockid'] . "', + '11', + '" . $CreditNoteNo . "', + '" . $Header['fromstkloc'] . "', + '" . $Header['trandate'] . "', + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $LocalCurrencyPrice . "', + '" . $PeriodNo . "', + '" . $Header['customerref'] . "', + '" . -$CN_Line['qty'] . "', + '" . $CN_Line['discountpercent'] . "', + '" . $StandardCost . "', + '0' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + /*Get the ID of the StockMove... */ + $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + /*Insert the taxes that applied to this line */ + foreach ($LineTaxes[$LineCounter] as $Tax) { + + $SQL = "INSERT INTO stockmovestaxes (stkmoveno, + taxauthid, + taxrate, + taxcalculationorder, + taxontax) + VALUES ('" . $StkMoveNo . "', + '" . $Tax['TaxAuthID'] . "', + '" . $Tax['TaxRate'] . "', + '" . $Tax['TaxCalculationOrder'] . "', + '" . $Tax['TaxOnTax'] . "')"; + + $Result = DB_query($SQL,$db,'','',true); + } + + /*Insert Sales Analysis records */ + + $SQL="SELECT COUNT(*), + salesanalysis.stkcategory, + salesanalysis.area, + salesanalysis.salesperson, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.stockid + FROM salesanalysis, + custbranch, + stockmaster + WHERE salesanalysis.stkcategory=stockmaster.categoryid + AND salesanalysis.stockid=stockmaster.stockid + AND salesanalysis.cust=custbranch.debtorno + AND salesanalysis.custbranch=custbranch.branchcode + AND salesanalysis.area=custbranch.area + AND salesanalysis.salesperson=custbranch.salesman + AND salesanalysis.typeabbrev ='" . $Header['tpe'] . "' + AND salesanalysis.periodno='" . $PeriodNo . "' + AND salesanalysis.cust " . LIKE . " '" . $Header['debtorno'] . "' + AND salesanalysis.custbranch " . LIKE . " '" . $Header['branchcode'] . "' + AND salesanalysis.stockid " . LIKE . " '" . $CN_Line['stockid'] . "' + AND salesanalysis.budgetoractual='1' + GROUP BY salesanalysis.stockid, + salesanalysis.stkcategory, + salesanalysis.cust, + salesanalysis.custbranch, + salesanalysis.area, + salesanalysis.periodno, + salesanalysis.typeabbrev, + salesanalysis.salesperson"; + + $ErrMsg = _('The count of existing Sales analysis records could not run because'); + $DbgMsg = _('SQL to count the no of sales analysis records'); + $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + + $myrow = DB_fetch_row($Result); + + if ($myrow[0]>0){ /*Update the existing record that already exists */ + + $SQL = "UPDATE salesanalysis + SET amt=amt+" . ($CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . ", + qty=qty +" . $CN_Line['qty'] . ", + disc=disc+" . ($CN_Line['discountpercent'] * $CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . " + WHERE salesanalysis.area='" . $myrow[2] . "' + AND salesanalysis.salesperson='" . $myrow[3] . "' + AND typeabbrev ='" . $Header['tpe'] . "' + AND periodno = '" . $PeriodNo . "' + AND cust " . LIKE . " '" . $Header['debtorno'] . "' + AND custbranch " . LIKE . " '" . $Header['branchcode'] . "' + AND stockid " . LIKE . " '" . $CN_Line['stockid'] . "' + AND salesanalysis.stkcategory ='" . $myrow[1] . "' + AND budgetoractual='1'"; + + } else { /* insert a new sales analysis record */ + + $SQL = "INSERT INTO salesanalysis ( typeabbrev, + periodno, + amt, + cost, + cust, + custbranch, + qty, + disc, + stockid, + area, + budgetoractual, + salesperson, + stkcategory ) + SELECT '" . $Header['tpe']. "', + '" . $PeriodNo . "', + '" . ($CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . "', + 0, + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $CN_Line['qty'] . "', + '" . ($CN_Line['discountpercent'] * $CN_Line['price'] * $CN_Line['qty'] / $CN_Header['rate']) . "', + '" . $CN_Line['stockid'] . "', + custbranch.area, + 1, + custbranch.salesman, + stockmaster.categoryid + FROM stockmaster, custbranch + WHERE stockmaster.stockid = '" . $CN_Line['stockid'] . "' + AND custbranch.debtorno = '" . $Header['debtorno'] . "' + AND custbranch.branchcode='" . $Header['branchcode'] . "'"; + + } + + $Result = api_DB_query($SQL,$db,'','',true); + + if ($CompanyRecord['gllink_stock']==1 AND $StandardCost !=0){ + +/*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . GetCOGSGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db) . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $StandardCost . "', + '" . ($StandardCost * $CN_Line['qty']) . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + +/*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ + $StockGLCode = GetStockGLCode($CN_Line['stockid'],$db); + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $StockGLCode['stockact'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $StandardCost . "', + '" . (-$StandardCost * $CN_Line['qty']) . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ + + if ($CompanyRecord['gllink_debtors']==1 AND $CN_Line['price'] !=0){ + + //Post sales transaction to GL credit sales + $SalesGLAccounts = GetSalesGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db); + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount ) + VALUES ('11', + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $SalesGLAccounts['salesglcode'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $CN_Line['price'] . "', + '" . (-$CN_Line['price'] * $CN_Line['qty']/$CN_Header['rate']) . "' + )"; + $Result = api_DB_query($SQL,$db,'','',true); + + if ($CN_Line['discountpercent'] !=0){ + + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', + '" . $PeriodNo . "', + '" . $SalesGLAccounts['discountglcode'] . "', + '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " @ " . ($CN_Line['discountpercent'] * 100) . "%', + '" . ($CN_Line['price'] * $CN_Line['quantity'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; + + $Result = DB_query($SQL,$db,'','',true); + } /*end of if discount !=0 */ + + } /*end of if sales integrated with gl */ + + $LineCounter++; //needed for the array of taxes by line + } /*end of OrderLine loop */ + + $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$OrderHeader['rate']; + + +//To here + + + if ($CompanyRecord['gllink_debtors']==1){ + + /*Now post the tax to the GL at local currency equivalent */ + if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { + + + /*Loop through the tax authorities array to post each total to the taxauth glcode */ + foreach ($TaxTotals as $Tax){ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount ) + VALUES (10, + '" . $InvoiceNo . "', + '" . $OrderHeader['orddate']. "', + '" . $PeriodNo . "', + '" . $Tax['GLCode'] . "', + '" . $OrderHeader['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', + '" . -$Tax['FXAmount']/$OrderHeader['rate'] . "' )"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + } + + /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ + if (($TotalCreditLocalCurr) !=0) { + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('10', + '" . $InvoiceNo . "', + '" . $OrderHeader['orddate'] . "', + '" . $PeriodNo . "', + '" . $CompanyRecord['debtorsact'] . "', + '" . $OrderHeader['debtorno'] . "', + '" . $TotalCreditLocalCurr . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + } + EnsureGLEntriesBalance(10,$InvoiceNo,$db); + + } /*end of if Sales and GL integrated */ + + /*Update order header for invoice charged on */ + $SQL = "UPDATE salesorders SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') WHERE orderno= '" . $OrderNo . "'"; + $Result = api_DB_query($SQL,$db,'','',true); + + /*Now insert the DebtorTrans */ + + $SQL = "INSERT INTO debtortrans (transno, + type, + debtorno, + branchcode, + trandate, + inputdate, + prd, + reference, + tpe, + order_, + ovamount, + ovgst, + rate, + shipvia) + VALUES ( + '". $InvoiceNo . "', + 10, + '" . $OrderHeader['debtorno'] . "', + '" . $OrderHeader['branchcode'] . "', + '" . $OrderHeader['orddate'] . "', + '" . date('Y-m-d H-i-s') . "', + '" . $PeriodNo . "', + '" . $OrderHeader['customerref'] . "', + '" . $OrderHeader['sales_type'] . "', + '" . $OrderNo . "', + '" . $TotalFXNetCredit . "', + '" . $TotalFXTax . "', + '" . $OrderHeader['rate'] . "', + '" . $OrderHeader['shipvia'] . "')"; + + $Result = api_DB_query($SQL,$db,'','',true); + + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + + /*for each Tax - need to insert into debtortranstaxes */ + foreach ($TaxTotals AS $TaxAuthID => $Tax) { + + $SQL = "INSERT INTO debtortranstaxes (debtortransid, + taxauthid, + taxamount) + VALUES ('" . $DebtorTransID . "', + '" . $TaxAuthID . "', + '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; + $Result = api_DB_query($SQL,$db,'','',true); + } + + if (sizeof($Errors)==0) { + + $Result = DB_Txn_Commit($db); + $Errors[0]=0; + $Errors[1]=$InvoiceNo; + } else { + $Result = DB_Txn_Rollback($db); + } + return $Errors; + + } /*End of CreateCreditNote method */ + /* Create a customer invoice in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. + * There are no stock updates no accounting for assemblies no updates + * to sales analysis records - no cost of sales entries in GL + * USE WITH CAUTION */ function InsertSalesInvoice($InvoiceDetails, $user, $password) { $Errors = array(); @@ -397,6 +1062,9 @@ /* Create a customer credit note in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. All values should be sent as negatives. + * stock is not updated and the method cannot deal with assembly items + * the sales analysis is not updated either + * USE WITH CAUTION!! */ function InsertSalesCredit($CreditDetails, $user, $password) { $Errors = array(); Modified: trunk/api/api_errorcodes.php =================================================================== --- trunk/api/api_errorcodes.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_errorcodes.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -165,7 +165,8 @@ Define('NoReadOrderLines',1160); Define('NoTaxProvince',1161); Define('TaxRatesFailed',1162); - + Define('NoReadCustomerBranch',1163); + Define('NoReadItem',1164); /* Array of Descriptions of errors */ $ErrorDescription['1'] = _('No Authorisation'); @@ -331,5 +332,7 @@ $ErrorDescription['1160'] = _('Unable to read sales order lines'); $ErrorDescription['1161'] = _('Unable to get tax province of location'); $ErrorDescription['1162'] = _('Unable to read tax rates for this item and tax group'); + $ErrorDescription['1163'] = _('Unable to read customer and branch details'); + $ErrorDescription['1164'] = _('Unable to read credit note item details'); ?> \ No newline at end of file Modified: trunk/api/api_xml-rpc.php =================================================================== --- trunk/api/api_xml-rpc.php 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/api/api_xml-rpc.php 2012-02-02 09:51:09 UTC (rev 4863) @@ -1056,6 +1056,35 @@ unset($Parameter); unset($ReturnValue); + $Description = _('Creates a credit note from header details associative array and line items'); + $Parameter[0]['name'] = _('Credit Note Header Details'); + $Parameter[0]['description'] = _('An associative array describing the credit note header with the fields debtorno, branchcode, trandate, tpe, fromstkloc, customerref, shipvia'); + $Parameter[1]['name'] = _('Credit note line items'); + $Parameter[1]['description'] = _('The lines of stock being returned on this credit note. Only stock returns can be dealt with using this API method. This is an array of associative arrays containing the fields, stockid, price, qty, discountpercent for the items returned'); + $Parameter[2]['name'] = _('User name'); + $Parameter[2]['description'] = _('A valid weberp username. This user should have security access to this data.'); + $Parameter[3]['name'] = _('User password'); + $Parameter[3]['description'] = _('The weberp password associated with this user name. '); + $ReturnValue[0] = _('This function returns an array of integers. ') + ._('If the first element is zero then the function was successful, and the second element is the credit note number. ') + ._('Otherwise an array of error codes is returned and no insertion takes place. '); + +/*E*/$CreateCreditNote_sig = array(array($xmlrpcStruct,$xmlrpcStruct), +/*x*/ array($xmlrpcStruct,$xmlrpcStruct,$xmlrpcArray,$xmlrpcString,$xmlrpcString)); + $CreateCreditNote_doc = apiBuildDocHTML( $Description,$Parameter,$ReturnValue ); + + function xmlrpc_CreateCreditNote($xmlrpcmsg){ + ob_start('ob_file_callback'); +/*x*/ if ($xmlrpcmsg->getNumParams() == 4) { +/*x*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreateCreditNote(php_xmlrpc_decode($xmlrpcmsg->getParam( 0 )), php_xmlrpc_decode($xmlrpcmsg->getParam( 1 )), $xmlrpcmsg->getParam( 2 )->scalarval( ),$xmlrpcmsg->getParam( 3 )->scalarval( ))) ); +/*x*/ } else { +/*e*/ $rtn = new xmlrpcresp( php_xmlrpc_encode(CreateCreditNote(php_xmlrpc_decode($xmlrpcmsg->getParam( 0 )),php_xmlrpc_decode($xmlrpcmsg->getParam( 1 )), '', ''))); +/*x*/ } + ob_end_flush(); + return $rtn; + } + + $Description = _('Inserts a sales invoice into the debtortrans table and does the relevant GL entries'); $Parameter[0]['name'] = _('Invoice Details'); $Parameter[0]['description'] = _('An array of index/value items describing the invoice.') @@ -3038,6 +3067,10 @@ "function" => "xmlrpc_InsertSalesInvoice", "signature" => $InsertSalesInvoice_sig, "docstring" => $InsertSalesInvoice_doc), + "weberp.xmlrpc_CreateCreditNote" => array( + "function" => "xmlrpc_CreateCreditNote", + "signature" => $CreateCreditNote_sig, + "docstring" => $CreateCreditNote_doc), "weberp.xmlrpc_InsertSalesCredit" => array( "function" => "xmlrpc_InsertSalesCredit", "signature" => $InsertSalesCredit_sig, Modified: trunk/doc/Manual/ManualCreatingNewSystem.html =================================================================== --- trunk/doc/Manual/ManualCreatingNewSystem.html 2012-02-02 03:30:56 UTC (rev 4862) +++ trunk/doc/Manual/ManualCreatingNewSystem.html 2012-02-02 09:51:09 UTC (rev 4863) @@ -317,11 +317,11 @@ <font size="+1"><b>Sales Ledger - Accounts Receivable Integration to General Ledger Issues</b></font> <br /><br /> Some flexibility is provided in how sales transactions are posted to the general ledger. Different sales accounts can be used depending on any combination of the sales area of the customer, the sales type and the stock category of the item sold. Before entering any sales it is important to defined the posting schema under setup - Sales GL Interface Postings. The same flexibility is also afforded to the posting of cost of goods sold (COGS)- of course these journals are only created if the stock GL interface is activated. If it is then again it is critical to ensure the proper set up of the posting schema for COGS under the setup tab - COGS GL Interface posting - +<br /><br /> <font size="+1"><b>Tax</b></font> <br /><br /> Taxes must be setup. In Setup there are Tax Group Maintenance, Dispatch Tax Province Maintenance, Tax Categories Maintenance and Tax Authorities and Rates Maintenance. Before you set up customer branches the tax group that relates the branch must be defined - the tax group specifies the tax authorities to which taxes must be charged on sales to the branch. The system allows any number of tax authorities to be included in a tax group. The tax category must be specified on the setup of items - some items attract tax at higher rates and these must be flagged as such. As many tax categories as necessary can be defined. There is a more detailed section in the manual for further details on tax. - +<br /><br /> <font size="+1"><b>Setting Up Customers</b></font> <br /><br /> As many branches as required can be set up, it is recommended that branches be used liberally for all customer contacts even though the branch may not be invoiced. Thus all contacts can be kept against the customer they belong with. Each branch requires a sales area and a salesperson. Sales Areas are the areas defined for analysis purposes. Both Sales Areas and Salespeople are set up from the System Setup tab of the main menu. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-02-02 22:35:38
|
Revision: 4864 http://web-erp.svn.sourceforge.net/web-erp/?rev=4864&view=rev Author: vvs2012 Date: 2012-02-02 22:35:31 +0000 (Thu, 02 Feb 2012) Log Message: ----------- xhtml cleanup Modified Paths: -------------- trunk/Logout.php trunk/includes/Login.php trunk/includes/header.inc Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/Logout.php 2012-02-02 22:35:31 UTC (rev 4864) @@ -7,32 +7,33 @@ include('includes/session.inc'); ?> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $_SESSION['CompanyRecord']['coyname'];?> - <?php echo _('Log Off'); ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/<?php echo $theme;?>/login.css" type="text/css" /> </head> -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> +<body> <div id="container"> <div id="login_logo"></div> <div id="login_box"> - <form action=" <?php echo $rootpath;?>/index.php" name="loginform" method="post"> + <form action="<?php echo $rootpath;?>/index.php" id="loginform" method="post"> + <p> <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> <span><?php echo _('Thank you for using webERP'); ?></span> - <br /> - <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> + </p> + <p><input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /></p> </form> </div> </div> -</body> -</html> - <?php // Cleanup session_unset(); Modified: trunk/includes/Login.php =================================================================== --- trunk/includes/Login.php 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/includes/Login.php 2012-02-02 22:35:31 UTC (rev 4864) @@ -10,8 +10,10 @@ $demo_text = _('Please login here'); } ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>webERP Login screen</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> @@ -31,9 +33,10 @@ <div id="container"> <div id="login_logo"></div> <div id="login_box"> - <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" name="loginform" method="post"> - <input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> + <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" id="loginform" method="post"> + <p><input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> <span><?php echo _('Company'); ?>:</span> + <?php if ($AllowCompanySelectionBox == true){ echo '<select name="CompanyNameField">'; @@ -42,7 +45,7 @@ foreach ($Companies as $CompanyEntry){ if (is_dir('companies/' . $CompanyEntry) AND $CompanyEntry != '..' AND $CompanyEntry != '' AND $CompanyEntry!='.svn' AND $CompanyEntry!='.'){ if ($CompanyEntry==$DefaultCompany) { - echo '<option selected value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; + echo '<option selected="selected" value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; } else { echo '<option value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; } @@ -53,13 +56,13 @@ echo '<input type="text" name="CompanyNameField" value="' . $DefaultCompany . '" />'; } ?> - <br /> - <span><?php echo _('User name'); ?>:</span><br /> - <input type="text" name="UserNameEntryField"/><br /> - <span><?php echo _('Password'); ?>:</span><br /> - <input type="password" name="Password"><br /> + + <span><?php echo _('User name'); ?>:</span> + <input type="text" name="UserNameEntryField" /> + <span><?php echo _('Password'); ?>:</span> + <input type="password" name="Password" /></p> <div id="demo_text"><?php echo $demo_text;?></div> - <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> + <p><input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /></p> </form> </div> </div> Modified: trunk/includes/header.inc =================================================================== --- trunk/includes/header.inc 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/includes/header.inc 2012-02-02 22:35:31 UTC (rev 4864) @@ -52,9 +52,9 @@ echo '<td align="left" style="width:100%;" class="quick_menu_left">'; // Use icons for company and user data, saves screen realestate, use ALT tag in case theme icon not avail. echo '<img src="'.$rootpath.'/css/'.$theme.'/images/company.png" title="' . _('Company') . '" alt="' . _('Company') . '"></img>'; - echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '"> </img>' . stripslashes($_SESSION['UsersRealName']) . '</a>'; + echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '"></img>' . stripslashes($_SESSION['UsersRealName']) . '</a>'; // Make the title text a class, can be set to display:none is some themes - echo '<br /><font class="header_title"> ' . $title . '</font></td>'; + echo '<br /><p class="header_title"> ' . $title . '</p></td>'; echo '<td class="quick_menu_tabs">'; echo '<table cellpadding="0" cellspacing="0" class="quick_menu_tabs"><tr>'; echo '<td class="quick_menu_tab" align="center"><a accesskey="1" href="' . $rootpath . '/index.php"><span style="text-decoration:underline;">1</span> ' . _('Main Menu') . '</a></td>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-02-02 22:35:38
|
Revision: 4864 http://web-erp.svn.sourceforge.net/web-erp/?rev=4864&view=rev Author: vvs2012 Date: 2012-02-02 22:35:31 +0000 (Thu, 02 Feb 2012) Log Message: ----------- xhtml cleanup Modified Paths: -------------- trunk/Logout.php trunk/includes/Login.php trunk/includes/header.inc Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/Logout.php 2012-02-02 22:35:31 UTC (rev 4864) @@ -7,32 +7,33 @@ include('includes/session.inc'); ?> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $_SESSION['CompanyRecord']['coyname'];?> - <?php echo _('Log Off'); ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="css/<?php echo $theme;?>/login.css" type="text/css" /> </head> -<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> +<body> <div id="container"> <div id="login_logo"></div> <div id="login_box"> - <form action=" <?php echo $rootpath;?>/index.php" name="loginform" method="post"> + <form action="<?php echo $rootpath;?>/index.php" id="loginform" method="post"> + <p> <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> <span><?php echo _('Thank you for using webERP'); ?></span> - <br /> - <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> + </p> + <p><input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /></p> </form> </div> </div> -</body> -</html> - <?php // Cleanup session_unset(); Modified: trunk/includes/Login.php =================================================================== --- trunk/includes/Login.php 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/includes/Login.php 2012-02-02 22:35:31 UTC (rev 4864) @@ -10,8 +10,10 @@ $demo_text = _('Please login here'); } ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>webERP Login screen</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> @@ -31,9 +33,10 @@ <div id="container"> <div id="login_logo"></div> <div id="login_box"> - <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" name="loginform" method="post"> - <input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> + <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" id="loginform" method="post"> + <p><input type="hidden" name="FormID" value="<?php echo $_SESSION['FormID']; ?>" /> <span><?php echo _('Company'); ?>:</span> + <?php if ($AllowCompanySelectionBox == true){ echo '<select name="CompanyNameField">'; @@ -42,7 +45,7 @@ foreach ($Companies as $CompanyEntry){ if (is_dir('companies/' . $CompanyEntry) AND $CompanyEntry != '..' AND $CompanyEntry != '' AND $CompanyEntry!='.svn' AND $CompanyEntry!='.'){ if ($CompanyEntry==$DefaultCompany) { - echo '<option selected value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; + echo '<option selected="selected" value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; } else { echo '<option value="' . $CompanyEntry . '">' . $CompanyEntry . '</option>'; } @@ -53,13 +56,13 @@ echo '<input type="text" name="CompanyNameField" value="' . $DefaultCompany . '" />'; } ?> - <br /> - <span><?php echo _('User name'); ?>:</span><br /> - <input type="text" name="UserNameEntryField"/><br /> - <span><?php echo _('Password'); ?>:</span><br /> - <input type="password" name="Password"><br /> + + <span><?php echo _('User name'); ?>:</span> + <input type="text" name="UserNameEntryField" /> + <span><?php echo _('Password'); ?>:</span> + <input type="password" name="Password" /></p> <div id="demo_text"><?php echo $demo_text;?></div> - <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> + <p><input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /></p> </form> </div> </div> Modified: trunk/includes/header.inc =================================================================== --- trunk/includes/header.inc 2012-02-02 09:51:09 UTC (rev 4863) +++ trunk/includes/header.inc 2012-02-02 22:35:31 UTC (rev 4864) @@ -52,9 +52,9 @@ echo '<td align="left" style="width:100%;" class="quick_menu_left">'; // Use icons for company and user data, saves screen realestate, use ALT tag in case theme icon not avail. echo '<img src="'.$rootpath.'/css/'.$theme.'/images/company.png" title="' . _('Company') . '" alt="' . _('Company') . '"></img>'; - echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '"> </img>' . stripslashes($_SESSION['UsersRealName']) . '</a>'; + echo ' ' . stripslashes($_SESSION['CompanyRecord']['coyname']) . ' <a href="' . $rootpath . '/UserSettings.php"><img src="'.$rootpath.'/css/'.$theme.'/images/user.png" title="User" alt="' . _('User') . '"></img>' . stripslashes($_SESSION['UsersRealName']) . '</a>'; // Make the title text a class, can be set to display:none is some themes - echo '<br /><font class="header_title"> ' . $title . '</font></td>'; + echo '<br /><p class="header_title"> ' . $title . '</p></td>'; echo '<td class="quick_menu_tabs">'; echo '<table cellpadding="0" cellspacing="0" class="quick_menu_tabs"><tr>'; echo '<td class="quick_menu_tab" align="center"><a accesskey="1" href="' . $rootpath . '/index.php"><span style="text-decoration:underline;">1</span> ' . _('Main Menu') . '</a></td>'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-03 09:57:58
|
Revision: 4865 http://web-erp.svn.sourceforge.net/web-erp/?rev=4865&view=rev Author: daintree Date: 2012-02-03 09:57:52 +0000 (Fri, 03 Feb 2012) Log Message: ----------- fix delete po lines bug Modified Paths: -------------- trunk/doc/Change.log trunk/includes/DefinePOClass.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-02-02 22:35:31 UTC (rev 4864) +++ trunk/doc/Change.log 2012-02-03 09:57:52 UTC (rev 4865) @@ -1,5 +1,6 @@ webERP Change Log +3/2/12 Vitaly:Fixed bug that was not allowing PO lines to be deleted in OrderValue method of PO class was testing using asignment operator not comparison operator 31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2012-02-02 22:35:31 UTC (rev 4864) +++ trunk/includes/DefinePOClass.php 2012-02-03 09:57:52 UTC (rev 4865) @@ -178,7 +178,7 @@ function Order_Value() { $TotalValue=0; foreach ($this->LineItems as $OrderedItems) { - if ($OrderedItems->Deleted = False){ + if ($OrderedItems->Deleted == False){ $TotalValue += ($OrderedItems->Price)*($OrderedItems->Quantity); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-03 09:58:01
|
Revision: 4865 http://web-erp.svn.sourceforge.net/web-erp/?rev=4865&view=rev Author: daintree Date: 2012-02-03 09:57:52 +0000 (Fri, 03 Feb 2012) Log Message: ----------- fix delete po lines bug Modified Paths: -------------- trunk/doc/Change.log trunk/includes/DefinePOClass.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-02-02 22:35:31 UTC (rev 4864) +++ trunk/doc/Change.log 2012-02-03 09:57:52 UTC (rev 4865) @@ -1,5 +1,6 @@ webERP Change Log +3/2/12 Vitaly:Fixed bug that was not allowing PO lines to be deleted in OrderValue method of PO class was testing using asignment operator not comparison operator 31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. 31/1/12 Phil: Stocks.php error on changing a stock category the journal between the stock GL accounts was not working because $NewStockAccount should have been $NewStockAct 31/1/12 Phil: PO_Items.php removed $Maximum_Number_Of_Parts_To_Show should exist when we are already limiting the output of the query based on the configuraiton option $_SESSION['DefaultDisplayRecordsMax']; Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2012-02-02 22:35:31 UTC (rev 4864) +++ trunk/includes/DefinePOClass.php 2012-02-03 09:57:52 UTC (rev 4865) @@ -178,7 +178,7 @@ function Order_Value() { $TotalValue=0; foreach ($this->LineItems as $OrderedItems) { - if ($OrderedItems->Deleted = False){ + if ($OrderedItems->Deleted == False){ $TotalValue += ($OrderedItems->Price)*($OrderedItems->Quantity); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-04 06:13:23
|
Revision: 4866 http://web-erp.svn.sourceforge.net/web-erp/?rev=4866&view=rev Author: daintree Date: 2012-02-04 06:13:15 +0000 (Sat, 04 Feb 2012) Log Message: ----------- Added new API function CreateCreditNote Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/api/api_session.inc trunk/doc/Manual/ManualContents.php Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_debtortransactions.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -263,10 +263,42 @@ return $myrow[0]; } -/* Retrieves the next transaction number for the given type + /* + This function inserts a debtors receipts into a bank account/GL Postings and does the allocation and journals for difference on exchange + + $Receipt contains an associative array in the format: + * $Receipt['debtorno'] - the customer code + * $Receipt['branchcode'] - the branch code + * $Receipt['trandate'] - the date of the receipt + * $Receipt['amountfx'] - the amount in FX + * $Receipt['paymentmethod'] - the payment method of the receipt e.g. cash/EFTPOS/credit card + * $Receipt['bankaccount'] - the webERP bank account + * $Receipt['allocto_transid'] - the invoice to allocate against + + */ + + function InsertDebtorReceipt($Receipt, $User, $Password) { + + $Errors = array(); + $db = db($User, $Password); + if (gettype($db)=='integer') { + $Errors[0]=NoAuthorisation; + return $Errors; + } + $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); + + + + + + } +/* Retrieves the next transaction number for the given type * This function is already included from SQL_CommonFunctions.php???? Isn't it?? - + function GetNextTransactionNo($type, $db) { $sql="SELECT typeno FROM systypes WHERE typeid='" . $type . "'"; $result=DB_query($sql, $db); @@ -277,25 +309,25 @@ */ /* Create a customer credit note in webERP. - * Needs an associative array for the Header + * Needs an associative array for the Header * and an array of assocative arrays for the $LineDetails */ function CreateCreditNote($Header,$LineDetails, $User, $Password) { - + /* $Header contains an associative array in the format: - * Header['debtorno'] - * Header['branchcode'] - * Header['trandate'] - * Header['tpe'] - * Header['fromstkloc'] - * Header['customerref'] - * Header['shipvia'] - * + * Header['debtorno'] - the customer code + * Header['branchcode'] - the branch code + * Header['trandate'] - the date of the credit note + * Header['tpe'] - the sales type + * Header['fromstkloc'] - the inventory location where the stock is put back into + * Header['customerref'] - the customer's reference + * Header['shipvia'] - the shipper required by webERP + * * and $LineDetails contains an array of associative arrays of the format: - * + * * $LineDetails[0]['stockid'] * $LineDetails[0]['price'] - * $LineDetails[0]['qty'] + * $LineDetails[0]['qty'] - expected to be a negative quantity (a negative sale) * $LineDetails[0]['discountpercent'] */ $Errors = array(); @@ -304,11 +336,11 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); - + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); - /*Does not deal with assembly items or serialise/lot track items - for use by POS */ + /*Does not deal with serialised/lot track items - for use by POS */ /*Get Company Defaults */ $ReadCoyResult = api_DB_query("SELECT debtorsact, freightact, @@ -320,7 +352,7 @@ $CompanyRecord = DB_fetch_array($ReadCoyResult); if (DB_error_no($db) != 0) { $Errors[] = NoCompanyRecord; - } + } $HeaderSQL = "SELECT custbranch.area, custbranch.taxgroupid, @@ -335,13 +367,13 @@ WHERE custbranch.debtorno = '" . $Header['debtorno'] . "' AND custbranch.branchcode='" . $Header['branchcode'] . "'"; - $HeaderResult = api_DB_query($OrderHeaderSQL,$db); + $HeaderResult = api_DB_query($HeaderSQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoReadCustomerBranch; - } - + } + $CN_Header = DB_fetch_array($HeaderResult); - + $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $Header['fromstkloc'] ."'",$db); if (DB_error_no($db) != 0) { $Errors[] = NoTaxProvince; @@ -357,10 +389,12 @@ $TotalFXNetCredit = 0; $TotalFXTax = 0; + + $TaxTotals =array(); $LineCounter =0; - foreach ($LineItems as $CN_Line) { - + foreach ($LineDetails as $CN_Line) { + $LineSQL = "SELECT taxcatid, mbflag, materialcost+labourcost+overheadcost AS standardcost @@ -373,7 +407,7 @@ return $Errors; } $LineRow = DB_fetch_array($LineResult); - + $StandardCost = $LineRow['standardcost']; $LocalCurrencyPrice= ($CN_Line['price'] *(1- floatval($CN_Line['discountpercent'])))/ $CN_Header['rate']; $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); @@ -393,18 +427,17 @@ taxauthrates.taxauthority=taxauthorities.taxid WHERE taxgrouptaxes.taxgroupid='" . $CN_Header['taxgroupid'] . "' AND taxauthrates.dispatchtaxprovince='" . $DispTaxProvinceID . "' - AND taxauthrates.taxcatid = '" . $CN_Line['taxcatid'] . "' + AND taxauthrates.taxcatid = '" . $LineRow['taxcatid'] . "' ORDER BY taxgrouptaxes.calculationorder"; $GetTaxRatesResult = api_DB_query($SQL,$db); - + if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; - } + } + + $LineTaxAmount = 0; - $LineTaxAmount = 0; - $TaxTotals =array(); - while ($myrow = DB_fetch_array($GetTaxRatesResult)){ if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; @@ -416,12 +449,11 @@ if ($myrow['taxontax'] ==1){ $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; } else { $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; } - + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $TaxAuthAmount; + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], @@ -434,8 +466,6 @@ }//end loop around Taxes - $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); - $TotalFXNetCredit += $LineNetAmount; $TotalFXTax += $LineTaxAmount; @@ -463,8 +493,9 @@ SET quantity = locstock.quantity - " . $CN_Line['qty'] . " WHERE locstock.stockid = '" . $CN_Line['stockid'] . "' AND loccode = '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL,$db,'','',true); - + $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -493,9 +524,9 @@ '" . $CN_Line['discountpercent'] . "', '" . $StandardCost . "', '" . ($QtyOnHandPrior - $CN_Line['qty']) . "' )"; - + $Result = api_DB_query($SQL,$db,'','',true); - + } else if ($LineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ @@ -554,7 +585,7 @@ '" . $Header['debtorno'] . "', '" . $Header['branchcode'] . "', '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $CN_Line['stkcode'] . ' ' . $Header['customerref'] . "', + '" . _('Assembly') . ': ' . $CN_Line['stockid'] . ' ' . $Header['customerref'] . "', '" . (-$AssParts['quantity'] * $CN_Line['qty']) . "', '" . $AssParts['standard'] . "', 0, @@ -571,9 +602,9 @@ } /* end of assembly explosion and updates */ } /* end of its an assembly */ - - if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ - /*it's a Dummy/Service item or an Assembly item - still need stock movement record + + if ($LineRow['mbflag']=='A' OR $LineRow['mbflag']=='D'){ + /*it's a Dummy/Service item or an Assembly item - still need stock movement record * but quantites on hand are always nil */ $SQL = "INSERT INTO stockmoves (stockid, type, @@ -603,7 +634,7 @@ '" . $CN_Line['discountpercent'] . "', '" . $StandardCost . "', '0' )"; - + $Result = api_DB_query($SQL,$db,'','',true); } /*Get the ID of the StockMove... */ @@ -624,7 +655,7 @@ $Result = DB_query($SQL,$db,'','',true); } - + /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), @@ -660,12 +691,10 @@ salesanalysis.typeabbrev, salesanalysis.salesperson"; - $ErrMsg = _('The count of existing Sales analysis records could not run because'); - $DbgMsg = _('SQL to count the no of sales analysis records'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $Result = api_DB_query($SQL,$db,'','',true); $myrow = DB_fetch_row($Result); - + if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis @@ -681,7 +710,7 @@ AND stockid " . LIKE . " '" . $CN_Line['stockid'] . "' AND salesanalysis.stkcategory ='" . $myrow[1] . "' AND budgetoractual='1'"; - + } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis ( typeabbrev, @@ -714,9 +743,9 @@ WHERE stockmaster.stockid = '" . $CN_Line['stockid'] . "' AND custbranch.debtorno = '" . $Header['debtorno'] . "' AND custbranch.branchcode='" . $Header['branchcode'] . "'"; - + } - + $Result = api_DB_query($SQL,$db,'','',true); if ($CompanyRecord['gllink_stock']==1 AND $StandardCost !=0){ @@ -739,7 +768,7 @@ '" . ($StandardCost * $CN_Line['qty']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ $StockGLCode = GetStockGLCode($CN_Line['stockid'],$db); @@ -759,7 +788,7 @@ '" . (-$StandardCost * $CN_Line['qty']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ if ($CompanyRecord['gllink_debtors']==1 AND $CN_Line['price'] !=0){ @@ -783,7 +812,7 @@ '" . (-$CN_Line['price'] * $CN_Line['qty']/$CN_Header['rate']) . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - + if ($CN_Line['discountpercent'] !=0){ $SQL = "INSERT INTO gltrans (type, @@ -799,7 +828,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " @ " . ($CN_Line['discountpercent'] * 100) . "%', - '" . ($CN_Line['price'] * $CN_Line['quantity'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; + '" . ($CN_Line['price'] * $CN_Line['qty'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; $Result = DB_query($SQL,$db,'','',true); } /*end of if discount !=0 */ @@ -809,18 +838,13 @@ $LineCounter++; //needed for the array of taxes by line } /*end of OrderLine loop */ - $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$OrderHeader['rate']; + $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$CN_Header['rate']; - -//To here - - if ($CompanyRecord['gllink_debtors']==1){ /*Now post the tax to the GL at local currency equivalent */ if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { - /*Loop through the tax authorities array to post each total to the taxauth glcode */ foreach ($TaxTotals as $Tax){ $SQL = "INSERT INTO gltrans (type, @@ -830,19 +854,19 @@ account, narrative, amount ) - VALUES (10, - '" . $InvoiceNo . "', - '" . $OrderHeader['orddate']. "', + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate']. "', '" . $PeriodNo . "', '" . $Tax['GLCode'] . "', - '" . $OrderHeader['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', - '" . -$Tax['FXAmount']/$OrderHeader['rate'] . "' )"; + '" . $Header['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', + '" . -$Tax['FXAmount']/$CN_Header['rate'] . "' )"; $Result = api_DB_query($SQL,$db,'','',true); } } - /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ + /*Post debtors transaction to GL credit debtors, and debit sales */ if (($TotalCreditLocalCurr) !=0) { $SQL = "INSERT INTO gltrans (type, typeno, @@ -851,24 +875,20 @@ account, narrative, amount) - VALUES ('10', - '" . $InvoiceNo . "', - '" . $OrderHeader['orddate'] . "', + VALUES ('11', + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', '" . $PeriodNo . "', '" . $CompanyRecord['debtorsact'] . "', - '" . $OrderHeader['debtorno'] . "', + '" . $Header['debtorno'] . "', '" . $TotalCreditLocalCurr . "')"; $Result = api_DB_query($SQL,$db,'','',true); } - EnsureGLEntriesBalance(10,$InvoiceNo,$db); - + EnsureGLEntriesBalance(11,$CreditNoteNo,$db); + } /*end of if Sales and GL integrated */ - /*Update order header for invoice charged on */ - $SQL = "UPDATE salesorders SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') WHERE orderno= '" . $OrderNo . "'"; - $Result = api_DB_query($SQL,$db,'','',true); - /*Now insert the DebtorTrans */ $SQL = "INSERT INTO debtortrans (transno, @@ -880,51 +900,48 @@ prd, reference, tpe, - order_, ovamount, ovgst, rate, shipvia) VALUES ( - '". $InvoiceNo . "', - 10, - '" . $OrderHeader['debtorno'] . "', - '" . $OrderHeader['branchcode'] . "', - '" . $OrderHeader['orddate'] . "', + '". $CreditNoteNo . "', + 11, + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $Header['trandate'] . "', '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', - '" . $OrderHeader['customerref'] . "', - '" . $OrderHeader['sales_type'] . "', - '" . $OrderNo . "', + '" . $Header['customerref'] . "', + '" . $Header['tpe'] . "', '" . $TotalFXNetCredit . "', '" . $TotalFXTax . "', - '" . $OrderHeader['rate'] . "', - '" . $OrderHeader['shipvia'] . "')"; - + '" . $CN_Header['rate'] . "', + '" . $Header['shipvia'] . "')"; + $Result = api_DB_query($SQL,$db,'','',true); - + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); - + /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { - + $SQL = "INSERT INTO debtortranstaxes (debtortransid, taxauthid, taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; + '" . $Tax['FXAmount']/$CN_Header['rate'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); } - + if (sizeof($Errors)==0) { - $Result = DB_Txn_Commit($db); $Errors[0]=0; - $Errors[1]=$InvoiceNo; + $Errors[1]=$CreditNoteNo; } else { $Result = DB_Txn_Rollback($db); - } + } return $Errors; } /*End of CreateCreditNote method */ @@ -932,9 +949,11 @@ /* Create a customer invoice in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. - * There are no stock updates no accounting for assemblies no updates + + * NB: There are no stock updates no accounting for assemblies no updates * to sales analysis records - no cost of sales entries in GL - * USE WITH CAUTION + + ************ USE ONLY WITH CAUTION******************** */ function InsertSalesInvoice($InvoiceDetails, $user, $password) { $Errors = array(); @@ -1062,9 +1081,12 @@ /* Create a customer credit note in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. All values should be sent as negatives. - * stock is not updated and the method cannot deal with assembly items + + + * NB: Stock is not updated and the method cannot deal with assembly items * the sales analysis is not updated either - * USE WITH CAUTION!! + + ****************** USE WITH CAUTION!! ********************** */ function InsertSalesCredit($CreditDetails, $user, $password) { $Errors = array(); Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_salesorders.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -634,7 +634,12 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { - + + +$fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + + $Errors = array(); $db = db($User, $Password); if (gettype($db)=='integer') { @@ -706,7 +711,7 @@ mbflag, materialcost+labourcost+overheadcost AS standardcost FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid + ON salesorderdetails.stkcode = stockmaster.stockid WHERE orderno ='" . $OrderNo . "' AND completed=0"; @@ -721,7 +726,9 @@ /*Now Get the next invoice number - function in SQL_CommonFunctions*/ $InvoiceNo = GetNextTransNo(10, $db); $PeriodNo = GetCurrentPeriod($db); - + + $TaxTotals =array(); + $TotalFXNetInvoice = 0; $TotalFXTax = 0; $LineCounter =0; @@ -755,11 +762,9 @@ if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; } - $LineTaxAmount = 0; - $TaxTotals =array(); + while ($myrow = DB_fetch_array($GetTaxRatesResult)){ - while ($myrow = DB_fetch_array($GetTaxRatesResult)){ if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; } @@ -769,13 +774,12 @@ $TaxTotals[$myrow['taxauthid']]['TaxAuthDescription'] = $myrow['description']; if ($myrow['taxontax'] ==1){ - $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; } else { $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; } - + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $TaxAuthAmount; + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], @@ -788,8 +792,6 @@ }//end loop around Taxes - $LineNetAmount = $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] *(1- floatval($OrderLineRow['discountpercent'])); - $TotalFXNetInvoice += $LineNetAmount; $TotalFXTax += $LineTaxAmount; @@ -1180,7 +1182,6 @@ /*Now post the tax to the GL at local currency equivalent */ if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { - /*Loop through the tax authorities array to post each total to the taxauth glcode */ foreach ($TaxTotals as $Tax){ $SQL = "INSERT INTO gltrans (type, Modified: trunk/api/api_session.inc =================================================================== --- trunk/api/api_session.inc 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_session.inc 2012-02-04 06:13:15 UTC (rev 4866) @@ -64,7 +64,7 @@ // query function, and will remember any error message in the session // data. - $result = DB_query($sql, $db, $Emsg, $Dmsg, $Transaction, $TrapErrors); + $result = DB_query($sql, $db, $EMsg, $DMsg, $Transaction, $TrapErrors); if (DB_error_no($db) != 0) { $_SESSION['db_err_msg'] = "SQL: " . $sql . "\nDB error message: " . DB_error_msg($db) . "\n"; } else { Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/doc/Manual/ManualContents.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -87,793 +87,793 @@ <?php } ?> - <UL> - <LI>Hardware Requirements</LI> - <LI>Software Requirements</LI> - <LI>Using webERP with a Wiki</LI> + <ul> + <li>Hardware Requirements</li> + <li>Software Requirements</li> + <li>Using webERP with a Wiki</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectGettingStarted"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GettingStarted'; ?>">Getting Started</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GettingStarted'; ?>">Getting Started</a> <?php } else { ?> - <A HREF="#GettingStarted">Getting Started</A> + <a HREF="#GettingStarted">Getting Started</a> <?php } ?> - <UL> - <LI>Prerequisites</LI> - <LI>Copying the PHP Scripts</LI> - <LI>Creating the Database</LI> - <LI>Editing config.php</LI> - <LI>Logging In For the First Time</LI> - <LI>Themes and GUI Modification</LI> - <LI>Setting Up Users</LI> + <ul> + <li>Prerequisites</li> + <li>Copying the PHP Scripts</li> + <li>Creating the Database</li> + <li>Editing config.php</li> + <li>Logging In For the First Time</li> + <li>Themes and GUI Modification</li> + <li>Setting Up Users</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSecuritySchema"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SecuritySchema'; ?>">Security Schema</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SecuritySchema'; ?>">Security Schema</a> <?php } else { ?> - <A HREF="#SecuritySchema">Security Schema</A> + <a HREF="#SecuritySchema">Security Schema</a> <?php } ?> - </LI> + </li> <br /><br /> - <LI> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCreatingNewSystem"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreatingNewSystem'; ?>">Creating a New System</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreatingNewSystem'; ?>">Creating a New System</a> <?php } else { ?> - <A HREF="#CreatingNewSystem">Creating a New System</A> + <a HREF="#CreatingNewSystem">Creating a New System</a> <?php } ?> - <UL> - <LI>Running the Demonstration Database</LI> - <LI>Setting Up A System</LI> - <LI>Setting Up Inventory Items</LI> - <LI>Entering Inventory Balances</LI> - <LI>Inventory Ledger Integration to General Ledger Issues</LI> - <LI>Setting Up Customers</LI> - <LI>Entering Customer Balances</LI> - <LI>Reconciling the Debtors Ledger Control Account</LI> - <LI>Finally</LI> + <ul> + <li>Running the Demonstration Database</li> + <li>Setting Up A System</li> + <li>Setting Up Inventory Items</li> + <li>Entering Inventory Balances</li> + <li>Inventory Ledger Integration to General Ledger Issues</li> + <li>Setting Up Customers</li> + <li>Entering Customer Balances</li> + <li>Reconciling the Debtors Ledger Control Account</li> + <li>Finally</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSystemConventions"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SystemConventions'; ?>">System Conventions</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SystemConventions'; ?>">System Conventions</a> <?php } else { ?> - <A HREF="#SystemConventions">System Conventions</A> + <a HREF="#SystemConventions">System Conventions</a> <?php } ?> - <UL> - <LI>Navigating the Menu</LI> - <LI>Reporting</LI> + <ul> + <li>Navigating the Menu</li> + <li>Reporting</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectInventory"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Inventory'; ?>">Inventory (aka "Stock")</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Inventory'; ?>">Inventory (aka "Stock")</a> <?php } else { ?> - <A HREF="#Inventory">Inventory (aka "Stock")</A> + <a HREF="#Inventory">Inventory (aka "Stock")</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Inventory System Features</LI> - <LI>Inventory Categories</LI> - <LI>Adding Inventory Items</LI> - <LI>Item Code</LI> - <LI>Part Descriptions</LI> - <LI>Categories</LI> - <LI>Unit of Measurement</LI> - <LI>Economic Order Quantity</LI> - <LI>Packaged Volume</LI> - <LI>Packaged Weight</LI> - <LI>Units of Measure</LI> - <LI>Current or Obsolete</LI> - <LI>Make Or Buy</LI> - <LI>Setting Up Assembly Items</LI> - <LI>Controlled</LI> - <LI>Serialised</LI> - <LI>Bar Code</LI> - <LI>Discount Category</LI> - <LI>Decimal Places</LI> - <LI>Inventory Costing</LI> - <LI>Material Cost</LI> - <LI>Labour Cost</LI> - <LI>Overhead Cost</LI> - <LI>Standard Costing Considerations</LI> - <LI>Actual Cost</LI> - <LI>Alterations To Labour Cost, Material Cost or Overhead Cost</LI> - <LI>Selecting Inventory Items</LI> - <LI>Amending Inventory Items</LI> - <LI>Changing a Category</LI> - <LI>Alterations to the Make or Buy Flag</LI> - <LI>Inventory Categories</LI> - <LI>Inventory Category Code</LI> - <LI>Inventory Category Description</LI> - <LI>Balance Sheet Inventory GL Account</LI> - <LI>Inventory Adjustments GL Posting Account</LI> - <LI>Purchase Price Variance Account</LI> - <LI>Material Usage Variance Account</LI> - <LI>Type of Resource</LI> - <LI>Inventory Location Maintenance</LI> - <LI>Inventory Adjustments</LI> - <LI>Inventory Location Transfers</LI> - <LI>Inventory Reports and Inquiries</LI> - <LI>Inventory Status inquiries</LI> - <LI>Inventory Movement inquiries</LI> - <LI>Inventory Usage inquiries</LI> - <LI>Inventory Valuation Report</LI> - <LI>Inventory Planning Report</LI> - <LI>Inventory Checks</LI> + <ul> + <li>Overview</li> + <li>Inventory System Features</li> + <li>Inventory Categories</li> + <li>Adding Inventory Items</li> + <li>Item Code</li> + <li>Part Descriptions</li> + <li>Categories</li> + <li>Unit of Measurement</li> + <li>Economic Order Quantity</li> + <li>Packaged Volume</li> + <li>Packaged Weight</li> + <li>Units of Measure</li> + <li>Current or Obsolete</li> + <li>Make Or Buy</li> + <li>Setting Up Assembly Items</li> + <li>Controlled</li> + <li>Serialised</li> + <li>Bar Code</li> + <li>Discount Category</li> + <li>Decimal Places</li> + <li>Inventory Costing</li> + <li>Material Cost</li> + <li>Labour Cost</li> + <li>Overhead Cost</li> + <li>Standard Costing Considerations</li> + <li>Actual Cost</li> + <li>Alterations To Labour Cost, Material Cost or Overhead Cost</li> + <li>Selecting Inventory Items</li> + <li>Amending Inventory Items</li> + <li>Changing a Category</li> + <li>Alterations to the Make or Buy Flag</li> + <li>Inventory Categories</li> + <li>Inventory Category Code</li> + <li>Inventory Category Description</li> + <li>Balance Sheet Inventory GL Account</li> + <li>Inventory Adjustments GL Posting Account</li> + <li>Purchase Price Variance Account</li> + <li>Material Usage Variance Account</li> + <li>Type of Resource</li> + <li>Inventory Location Maintenance</li> + <li>Inventory Adjustments</li> + <li>Inventory Location Transfers</li> + <li>Inventory Reports and Inquiries</li> + <li>Inventory Status inquiries</li> + <li>Inventory Movement inquiries</li> + <li>Inventory Usage inquiries</li> + <li>Inventory Valuation Report</li> + <li>Inventory Planning Report</li> + <li>Inventory Checks</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectAccountsReceivable"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsReceivable'; ?>">Accounts Receivable</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsReceivable'; ?>">Accounts Receivable</a> <?php } else { ?> - <A HREF="#AccountsReceivable">Accounts Receivable</A> + <a HREF="#AccountsReceivable">Accounts Receivable</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Features</LI> - <LI>Entering New Customers</LI> - <LI>Customer Code</LI> - <LI>Customer Name</LI> - <LI>Address Line 1, 2, 3 and 4</LI> - <LI>Currency</LI> - <LI>Invoice Discount</LI> - <LI>Prompt Payment Discount</LI> - <LI>Customer Since</LI> - <LI>Payment Terms</LI> - <LI>Credit Status or Rating</LI> - <LI>Credit Limit</LI> - <LI>Invoice Addressing</LI> - <LI>Entering Customer Branches</LI> - <LI>Branch Name</LI> - <LI>Branch Code</LI> - <LI>Branch Contact / Phone / Fax / Address</LI> - <LI>Sales Person</LI> - <LI>Draw Stock From</LI> - <LI>Forward Date From A Day In The Month</LI> - <LI>Delivery Days</LI> - <LI>Phone/Fax/Email</LI> - <LI>Tax Authority</LI> - <LI>Disable Transactions</LI> - <LI>Default Freight Company</LI> - <LI>Postal Address 1, 2, 3 and 4</LI> - <LI>Amending Customer Details</LI> - <LI>Shippers</LI> + <ul> + <li>Overview</li> + <li>Features</li> + <li>Entering New Customers</li> + <li>Customer Code</li> + <li>Customer Name</li> + <li>Address Line 1, 2, 3 and 4</li> + <li>Currency</li> + <li>Invoice Discount</li> + <li>Prompt Payment Discount</li> + <li>Customer Since</li> + <li>Payment Terms</li> + <li>Credit Status or Rating</li> + <li>Credit Limit</li> + <li>Invoice Addressing</li> + <li>Entering Customer Branches</li> + <li>Branch Name</li> + <li>Branch Code</li> + <li>Branch Contact / Phone / Fax / Address</li> + <li>Sales Person</li> + <li>Draw Stock From</li> + <li>Forward Date From A Day In The Month</li> + <li>Delivery Days</li> + <li>Phone/Fax/Email</li> + <li>Tax Authority</li> + <li>Disable Transactions</li> + <li>Default Freight Company</li> + <li>Postal Address 1, 2, 3 and 4</li> + <li>Amending Customer Details</li> + <li>Shippers</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectAccountsPayable"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsPayable'; ?>">Accounts Payable</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsPayable'; ?>">Accounts Payable</a> <?php } else { ?> - <A HREF="#AccountsPayable">Accounts Payable</A> + <a HREF="#AccountsPayable">Accounts Payable</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Features</LI> - <LI>Entering New Suppliers</LI> - <LI>Supplier Code</LI> - <LI>Supplier Name</LI> - <LI>Address Line 1, 2, 3 and 4</LI> - <LI>Supplier Since</LI> - <LI>Payment Terms</LI> - <LI>Bank Particulars/Reference</LI> - <LI>Bank Account Number</LI> - <LI>Currency</LI> - <LI>Remittance Advice</LI> + <ul> + <li>Overview</li> + <li>Features</li> + <li>Entering New Suppliers</li> + <li>Supplier Code</li> + <li>Supplier Name</li> + <li>Address Line 1, 2, 3 and 4</li> + <li>Supplier Since</li> + <li>Payment Terms</li> + <li>Bank Particulars/Reference</li> + <li>Bank Account Number</li> + <li>Currency</li> + <li>Remittance Advice</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesPeople"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesPeople'; ?>">Sales People</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesPeople'; ?>">Sales People</a> <?php } else { ?> - <A HREF="#SalesPeople">Sales People</A> + <a HREF="#SalesPeople">Sales People</a> <?php } ?> - <UL> - <LI>Salesperson Records</LI> - <LI>Salespeople Code</LI> - <LI>Salesperson Name, Telephone and Fax Numbers</LI> - <LI>Salesperson Commission Rates and Breakpoint</LI> + <ul> + <li>Salesperson Records</li> + <li>Salespeople Code</li> + <li>Salesperson Name, Telephone and Fax Numbers</li> + <li>Salesperson Commission Rates and Breakpoint</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCurrencies"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Currencies'; ?>">Currencies</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Currencies'; ?>">Currencies</a> <?php } else { ?> - <A HREF="#Currencies">Currencies</A> + <a HREF="#Currencies">Currencies</a> <?php } ?> - <UL> - <LI>Currency Abbreviation</LI> - <LI>Currency Name</LI> - <LI>Country of Currency</LI> - <LI>Hundredths Name</LI> - <LI>Exchange Rates</LI> + <ul> + <li>Currency Abbreviation</li> + <li>Currency Name</li> + <li>Country of Currency</li> + <li>Hundredths Name</li> + <li>Exchange Rates</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesTypes"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesTypes'; ?>">Sales Types / Price Lists</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesTypes'; ?>">Sales Types / Price Lists</a> <?php } else { ?> - <A HREF="#SalesTypes">Sales Types / Price Lists</A> + <a HREF="#SalesTypes">Sales Types / Price Lists</a> <?php } ?> - <UL> - <LI>Sales Types / Price Lists</LI> - <LI>Sales Type Code</LI> - <LI>Sales Type Description</LI> + <ul> + <li>Sales Types / Price Lists</li> + <li>Sales Type Code</li> + <li>Sales Type Description</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectPaymentTerms"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PaymentTerms'; ?>">Payment Terms</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PaymentTerms'; ?>">Payment Terms</a> <?php } else { ?> - <A HREF="#PaymentTerms">Payment Terms</A> + <a HREF="#PaymentTerms">Payment Terms</a> <?php } ?> - <UL> - <LI>Payment Terms</LI> - <LI>Payment Terms Code</LI> - <LI>Payment Terms Description</LI> - <LI>Days Before Due / Day In Following Month When Due</LI> + <ul> + <li>Payment Terms</li> + <li>Payment Terms Code</li> + <li>Payment Terms Description</li> + <li>Days Before Due / Day In Following Month When Due</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCreditStatus"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreditStatus'; ?>">Credit Status</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreditStatus'; ?>">Credit Status</a> <?php } else { ?> - <A HREF="#CreditStatus">Credit Status</A> + <a HREF="#CreditStatus">Credit Status</a> <?php } ?> - <UL> - <LI>Credit Status Ratings</LI> - <LI>Status Code</LI> - <LI>Status Description</LI> - <LI>Disallow Invoices</LI> + <ul> + <li>Credit Status Ratings</li> + <li>Status Code</li> + <li>Status Description</li> + <li>Disallow Invoices</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectTax"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Tax'; ?>">Tax</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Tax'; ?>">Tax</a> <?php } else { ?> - <A HREF="#Tax">Tax</A> + <a HREF="#Tax">Tax</a> <?php } ?> - <UL> - <LI>Tax Calculations</LI> - <LI>Overview</LI> - <LI>Setting up Taxes</LI> - <LI>Sales only within one Tax Authority Example - 2 Tax Levels:</LI> - <LI>Sales only within one Tax Authority Example - 3 Tax Levels:</LI> - <LI>Sales Within Two Tax Authorities Example - 3 Tax Levels:</LI> + <ul> + <li>Tax Calculations</li> + <li>Overview</li> + <li>Setting up Taxes</li> + <li>Sales only within one Tax Authority Example - 2 Tax Levels:</li> + <li>Sales only within one Tax Authority Example - 3 Tax Levels:</li> + <li>Sales Within Two Tax Authorities Example - 3 Tax Levels:</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectPrices"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Prices'; ?>">Prices and Discounts</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Prices'; ?>">Prices and Discounts</a> <?php } else { ?> - <A HREF="#Prices">Prices and Discounts</A> + <a HREF="#Prices">Prices and Discounts</a> <?php } ?> - <UL> - <LI>Prices and Discounts</LI> - <LI>Pricing Overview</LI> - <LI>Maintaining Prices</LI> - <LI>Discount Matrix</LI> + <ul> + <li>Prices and Discounts</li> + <li>Pricing Overview</li> + <li>Maintaining Prices</li> + <li>Discount Matrix</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARTransactions"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARTransactions'; ?>">Accounts Receivable Transactions</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARTransactions'; ?>">Accounts Receivable Transactions</a> <?php } else { ?> - <A HREF="#ARTransactions">Accounts Receivable Transactions</A> + <a HREF="#ARTransactions">Accounts Receivable Transactions</a> <?php } ?> - <UL> - <LI>Invoicing An Order</LI> - <LI>Selecting an Order To Invoice</LI> - <LI>Producing An Invoice From A Selected Order</LI> - <LI>Credit Notes</LI> - <LI>Entry Of Receipts</LI> - <LI>Receipts - Customer</LI> - <LI>Receipts - Date</LI> - <LI>Receipts - Currency and Exchange Rate</LI> - <LI>Receipts - Payment Method</LI> - <LI>Receipts - Amount</LI> - <LI>Receipts - Discount</LI> - <LI>Receipts - Allocating to Invoices</LI> - <LI>Differences on Exchange</LI> - <LI>Receipts Processing</LI> - <LI>Deposits Listing</LI> - <LI>Allocate Credits To A Customer's Account</LI> + <ul> + <li>Invoicing An Order</li> + <li>Selecting an Order To Invoice</li> + <li>Producing An Invoice From A Selected Order</li> + <li>Credit Notes</li> + <li>Entry Of Receipts</li> + <li>Receipts - Customer</li> + <li>Receipts - Date</li> + <li>Receipts - Currency and Exchange Rate</li> + <li>Receipts - Payment Method</li> + <li>Receipts - Amount</li> + <li>Receipts - Discount</li> + <li>Receipts - Allocating to Invoices</li> + <li>Differences on Exchange</li> + <li>Receipts Processing</li> + <li>Deposits Listing</li> + <li>Allocate Credits To A Customer's Account</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARInquiries"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARInquiries'; ?>">Accounts Receivable Inquiries</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARInquiries'; ?>">Accounts Receivable Inquiries</a> <?php } else { ?> - <A HREF="#ARInquiries">Accounts Receivable Inquiries</A> + <a HREF="#ARInquiries">Accounts Receivable Inquiries</a> <?php } ?> - <UL> - <LI>Customer Inquiries</LI> - <LI>Customer Account inquiries</LI> - <LI>Transaction Detail inquiries</LI> + <ul> + <li>Customer Inquiries</li> + <li>Customer Account inquiries</li> + <li>Transaction Detail inquiries</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARReports"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARReports'; ?>">Accounts Receivable Reports</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARReports'; ?>">Accounts Receivable Reports</a> <?php } else { ?> - <A HREF="#ARReports">Accounts Receivable Reports</A> + <a HREF="#ARReports">Accounts Receivable Reports</a> <?php } ?> - <UL> - <LI>Customers - Reporting</LI> - <LI>Aged Customer Balance Listing</LI> - <LI>Customer Statements</LI> - <LI>Customer Transaction Listing Options</LI> - <LI>Printing Invoices Or Credit Notes</LI> + <ul> + <li>Customers - Reporting</li> + <li>Aged Customer Balance Listing</li> + <li>Customer Statements</li> + <li>Customer Transaction Listing Options</li> + <li>Printing Invoices Or Credit Notes</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesAnalysis"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesAnalysis'; ?>">Sales Analysis</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesAnalysis'; ?>">Sales Analysis</a> <?php } else { ?> - <A HREF="#SalesAnalysis">Sales Analysis</A> + <a HREF="#SalesAnalysis">Sales Analysis</a> <?php } ?> - <UL> - <LI>Sales Analysis</LI> - <LI>Sales Analysis Report Headers</LI> - <LI>Sales Analysis Report Columns</LI> - <LI>Automating Sales Reports</LI> + <ul> + <li>Sales Analysis</li> + <li>Sales Analysis Report Headers</li> + <li>Sales Analysis Report Columns</li> + <li>Automating Sales Reports</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesOrders"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesOrders'; ?>">Sales Orders</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesOrders'; ?>">Sales Orders</a> <?php } else { ?> - <A HREF="#SalesOrders">Sales Orders</A> + <a HREF="#SalesOrders">Sales Orders</a> <?php } ?> - <UL> - <LI>Sales Orders</LI> - <LI>Sales Order Functionality</LI> - <LI>Entry of Sales Orders</LI> - <LI>Sales Orders - Selection of the Customer and Branch</LI> - <LI>Selection of Order Line Items</LI> - <LI>Delivery Details</LI> - <LI>Modfiying An Order</LI> - <LI>Quotations</LI> - <LI>Recurring Orders</LI> - <LI>Counter Sales - Entering Sales Directly</LI> - <LI>Managing Discounts by product group and customer group (Matrix)</LI> + <ul> + <li>Sales Orders</li> + <li>Sales Order Functionality</li> + <li>Entry of Sales Orders</li> + <li>Sales Orders - Selection of the Customer and Branch</li> + <li>Selection of Order Line Items</li> + <li>Delivery Details</li> + <li>Modfiying An Order</li> + <li>Quotations</li> + <li>Recurring Orders</li> + <li>Counter Sales - Entering Sales Directly</li> + <li>Managing Discounts by product group and customer group (Matrix)</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="PurchaseOrdering"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PurchaseOrdering'; ?>">Purchase Ordering</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PurchaseOrdering'; ?>">Purchase Ordering</a> <?php } else { ?> - <A HREF="#Shipments">Purchase Orders</A> + <a HREF="#Shipments">Purchase Orders</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Purchase Orders</LI> - <LI>Adding a New Purchase Order</LI> - <LI>Authorising Purchase Orders </LI> - <LI>Recieving Purchase Orders</LI> + <ul> + <li>Overview</li> + <li>Purchase Orders</li> + <li>Adding a New Purchase Order</li> + <li>Authorising Purchase Orders </li> + <li>Recieving Purchase Orders</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectShipments"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Shipments'; ?>">Shipments</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Shipments'; ?>">Shipments</a> <?php } else { ?> - <A HREF="#Shipments">Shipments</A> + <a HREF="#Shipments">Shipments</a> <?php } ?> - <UL> - <LI>Shipments</LI> - <LI>Shipment General Ledger Posting</LI> - <LI>Creating Shipments</LI> - <LI>Shipment Costings</LI> - <LI>Closing a Shipment</LI> + <ul> + <li>Shipments</li> + <li>Shipment General Ledger Posting</li> + <li>Creating Shipments</li> + <li>Shipment Costings</li> + <li>Closing a Shipment</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectContractCosting"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Contracts'; ?>">Contract Costing</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Contracts'; ?>">Contract Costing</a> <?php } else { ?> - <A HREF="#Contracts">Contract Costing</A> + <a HREF="#Contracts">Contract Costing</a> <?php } ?> - <UL> - <LI>Contract Costing Overview</LI> - <LI>Creating A New Contract</LI> - <LI>Selecting A Contract</LI> - <LI>Charging Against Contracts</LI> + <ul> + <li>Contract Costing Overview</li> + <li>Creating A New Contract</li> + <li>Selecting A Contract</li> + <li>Charging Against Contracts</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectManufacturing"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Manufacturing'; ?>">Manufacturing</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Manufacturing'; ?>">Manufacturing</a> <?php } else { ?> - <A HREF="#Manufacturing">Manufacturing</A> + <a HREF="#Manufacturing">Manufacturing</a> <?php } ?> - <UL> - <LI>Manufacturing Overview</LI> - <LI>General Ledger Implications</LI> - <LI>Work Order Entry</LI> - <LI>Work Order Receipts</LI> - <LI>Work Order Issues</LI> - <LI>Closing Work Orders</LI> + <ul> + <li>Manufacturing Overview</li> + <li>General Ledger Implications</li> + <li>Work Order Entry</li> + <li>Work Order Receipts</li> + <li>Work Order Issues</li> + <li>Closing Work Orders</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectMRP"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=MRP'; ?>"> - Material Requirements Planning</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=MRP'; ?>"> + Material Requirements Planning</a> <?php } else { ?> - <A HREF="#MRP">Material Requirements Planning</A> + <a HREF="#MRP">Material Requirements Planning</a> <?php } ?> - <UL> - <LI>MRP Overview</LI> - <LI>Base Data Required</LI> - <LI>Production Calendar</LI> - <LI>Master (Production) Schedule</LI> - <LI>Running The MRP Calculation</LI> - <LI>How It Works</LI> - <LI>MRP Reports</LI> + <ul> + <li>MRP Overview</li> + <li>Base Data Required</li> + <li>Production Calendar</li> + <li>Master (Production) Schedule</li> + <li>Running The MRP Calculation</li> + <li>How It Works</li> + <li>MRP Reports</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectGeneralLedger"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GeneralLedger'; ?>">General Ledger</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GeneralLedger'; ?>">General Ledger</a> <?php } else { ?> - <A HREF="#GeneralLedger">General Ledger</A> + <a HREF="#GeneralLedger">General Ledger</a> <?php } ?> - <UL> - <LI>General Ledger Overview</LI> - <LI>Account Groups</LI> - <LI>Bank Accounts</LI> - <LI>Bank Account Payments</LI> - <LI>General Ledger Integration Setup</LI> - <LI>Sales Journals</LI> - <LI>Stock Journals</LI> - <LI>EDI</LI> - <LI>EDI Setup</LI> - <LI>Sending EDI Invoices</LI> + <ul> + <li>General Ledger Overview</li> + <li>Account Groups</li> + <li>Bank Accounts</li> + <li>Bank Account Payments</li> + <li>General Ledger Integration Setup</li> + <li>Sales Journals</li> + <li>Stock Journals</li> + <li>EDI</li> + <li>EDI Setup</li> + <li>Sending EDI Invoices</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectFixedAssets"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=FixedAssets'; ?>">Fixed Assets</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=FixedAssets'; ?>">Fixed Assets</a> <?php } else { ?> - <A HREF="#Fixed Assets">Fixed Assets</A> + <a HREF="#Fixed Assets">Fixed Assets</a> <?php } ?> - <UL> - <LI>Fixed Assets Overview</LI> - <LI>Creating a Fixed Asset</LI> - <LI>Selecting Fixe... [truncated message content] |
From: <dai...@us...> - 2012-02-04 06:13:23
|
Revision: 4866 http://web-erp.svn.sourceforge.net/web-erp/?rev=4866&view=rev Author: daintree Date: 2012-02-04 06:13:15 +0000 (Sat, 04 Feb 2012) Log Message: ----------- Added new API function CreateCreditNote Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/api/api_session.inc trunk/doc/Manual/ManualContents.php Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_debtortransactions.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -263,10 +263,42 @@ return $myrow[0]; } -/* Retrieves the next transaction number for the given type + /* + This function inserts a debtors receipts into a bank account/GL Postings and does the allocation and journals for difference on exchange + + $Receipt contains an associative array in the format: + * $Receipt['debtorno'] - the customer code + * $Receipt['branchcode'] - the branch code + * $Receipt['trandate'] - the date of the receipt + * $Receipt['amountfx'] - the amount in FX + * $Receipt['paymentmethod'] - the payment method of the receipt e.g. cash/EFTPOS/credit card + * $Receipt['bankaccount'] - the webERP bank account + * $Receipt['allocto_transid'] - the invoice to allocate against + + */ + + function InsertDebtorReceipt($Receipt, $User, $Password) { + + $Errors = array(); + $db = db($User, $Password); + if (gettype($db)=='integer') { + $Errors[0]=NoAuthorisation; + return $Errors; + } + $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); + + + + + + } +/* Retrieves the next transaction number for the given type * This function is already included from SQL_CommonFunctions.php???? Isn't it?? - + function GetNextTransactionNo($type, $db) { $sql="SELECT typeno FROM systypes WHERE typeid='" . $type . "'"; $result=DB_query($sql, $db); @@ -277,25 +309,25 @@ */ /* Create a customer credit note in webERP. - * Needs an associative array for the Header + * Needs an associative array for the Header * and an array of assocative arrays for the $LineDetails */ function CreateCreditNote($Header,$LineDetails, $User, $Password) { - + /* $Header contains an associative array in the format: - * Header['debtorno'] - * Header['branchcode'] - * Header['trandate'] - * Header['tpe'] - * Header['fromstkloc'] - * Header['customerref'] - * Header['shipvia'] - * + * Header['debtorno'] - the customer code + * Header['branchcode'] - the branch code + * Header['trandate'] - the date of the credit note + * Header['tpe'] - the sales type + * Header['fromstkloc'] - the inventory location where the stock is put back into + * Header['customerref'] - the customer's reference + * Header['shipvia'] - the shipper required by webERP + * * and $LineDetails contains an array of associative arrays of the format: - * + * * $LineDetails[0]['stockid'] * $LineDetails[0]['price'] - * $LineDetails[0]['qty'] + * $LineDetails[0]['qty'] - expected to be a negative quantity (a negative sale) * $LineDetails[0]['discountpercent'] */ $Errors = array(); @@ -304,11 +336,11 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); - + + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); - /*Does not deal with assembly items or serialise/lot track items - for use by POS */ + /*Does not deal with serialised/lot track items - for use by POS */ /*Get Company Defaults */ $ReadCoyResult = api_DB_query("SELECT debtorsact, freightact, @@ -320,7 +352,7 @@ $CompanyRecord = DB_fetch_array($ReadCoyResult); if (DB_error_no($db) != 0) { $Errors[] = NoCompanyRecord; - } + } $HeaderSQL = "SELECT custbranch.area, custbranch.taxgroupid, @@ -335,13 +367,13 @@ WHERE custbranch.debtorno = '" . $Header['debtorno'] . "' AND custbranch.branchcode='" . $Header['branchcode'] . "'"; - $HeaderResult = api_DB_query($OrderHeaderSQL,$db); + $HeaderResult = api_DB_query($HeaderSQL,$db); if (DB_error_no($db) != 0) { $Errors[] = NoReadCustomerBranch; - } - + } + $CN_Header = DB_fetch_array($HeaderResult); - + $TaxProvResult = api_DB_query("SELECT taxprovinceid FROM locations WHERE loccode='" . $Header['fromstkloc'] ."'",$db); if (DB_error_no($db) != 0) { $Errors[] = NoTaxProvince; @@ -357,10 +389,12 @@ $TotalFXNetCredit = 0; $TotalFXTax = 0; + + $TaxTotals =array(); $LineCounter =0; - foreach ($LineItems as $CN_Line) { - + foreach ($LineDetails as $CN_Line) { + $LineSQL = "SELECT taxcatid, mbflag, materialcost+labourcost+overheadcost AS standardcost @@ -373,7 +407,7 @@ return $Errors; } $LineRow = DB_fetch_array($LineResult); - + $StandardCost = $LineRow['standardcost']; $LocalCurrencyPrice= ($CN_Line['price'] *(1- floatval($CN_Line['discountpercent'])))/ $CN_Header['rate']; $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); @@ -393,18 +427,17 @@ taxauthrates.taxauthority=taxauthorities.taxid WHERE taxgrouptaxes.taxgroupid='" . $CN_Header['taxgroupid'] . "' AND taxauthrates.dispatchtaxprovince='" . $DispTaxProvinceID . "' - AND taxauthrates.taxcatid = '" . $CN_Line['taxcatid'] . "' + AND taxauthrates.taxcatid = '" . $LineRow['taxcatid'] . "' ORDER BY taxgrouptaxes.calculationorder"; $GetTaxRatesResult = api_DB_query($SQL,$db); - + if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; - } + } + + $LineTaxAmount = 0; - $LineTaxAmount = 0; - $TaxTotals =array(); - while ($myrow = DB_fetch_array($GetTaxRatesResult)){ if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; @@ -416,12 +449,11 @@ if ($myrow['taxontax'] ==1){ $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; } else { $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; } - + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $TaxAuthAmount; + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], @@ -434,8 +466,6 @@ }//end loop around Taxes - $LineNetAmount = $CN_Line['price'] * $CN_Line['qty'] *(1- floatval($CN_Line['discountpercent'])); - $TotalFXNetCredit += $LineNetAmount; $TotalFXTax += $LineTaxAmount; @@ -463,8 +493,9 @@ SET quantity = locstock.quantity - " . $CN_Line['qty'] . " WHERE locstock.stockid = '" . $CN_Line['stockid'] . "' AND loccode = '" . $Header['fromstkloc'] . "'"; + $Result = api_DB_query($SQL,$db,'','',true); - + $SQL = "INSERT INTO stockmoves (stockid, type, transno, @@ -493,9 +524,9 @@ '" . $CN_Line['discountpercent'] . "', '" . $StandardCost . "', '" . ($QtyOnHandPrior - $CN_Line['qty']) . "' )"; - + $Result = api_DB_query($SQL,$db,'','',true); - + } else if ($LineRow['mbflag']=='A'){ /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ @@ -554,7 +585,7 @@ '" . $Header['debtorno'] . "', '" . $Header['branchcode'] . "', '" . $PeriodNo . "', - '" . _('Assembly') . ': ' . $CN_Line['stkcode'] . ' ' . $Header['customerref'] . "', + '" . _('Assembly') . ': ' . $CN_Line['stockid'] . ' ' . $Header['customerref'] . "', '" . (-$AssParts['quantity'] * $CN_Line['qty']) . "', '" . $AssParts['standard'] . "', 0, @@ -571,9 +602,9 @@ } /* end of assembly explosion and updates */ } /* end of its an assembly */ - - if ($OrderLineRow['mbflag']=='A' OR $OrderLineRow['mbflag']=='D'){ - /*it's a Dummy/Service item or an Assembly item - still need stock movement record + + if ($LineRow['mbflag']=='A' OR $LineRow['mbflag']=='D'){ + /*it's a Dummy/Service item or an Assembly item - still need stock movement record * but quantites on hand are always nil */ $SQL = "INSERT INTO stockmoves (stockid, type, @@ -603,7 +634,7 @@ '" . $CN_Line['discountpercent'] . "', '" . $StandardCost . "', '0' )"; - + $Result = api_DB_query($SQL,$db,'','',true); } /*Get the ID of the StockMove... */ @@ -624,7 +655,7 @@ $Result = DB_query($SQL,$db,'','',true); } - + /*Insert Sales Analysis records */ $SQL="SELECT COUNT(*), @@ -660,12 +691,10 @@ salesanalysis.typeabbrev, salesanalysis.salesperson"; - $ErrMsg = _('The count of existing Sales analysis records could not run because'); - $DbgMsg = _('SQL to count the no of sales analysis records'); - $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); + $Result = api_DB_query($SQL,$db,'','',true); $myrow = DB_fetch_row($Result); - + if ($myrow[0]>0){ /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis @@ -681,7 +710,7 @@ AND stockid " . LIKE . " '" . $CN_Line['stockid'] . "' AND salesanalysis.stkcategory ='" . $myrow[1] . "' AND budgetoractual='1'"; - + } else { /* insert a new sales analysis record */ $SQL = "INSERT INTO salesanalysis ( typeabbrev, @@ -714,9 +743,9 @@ WHERE stockmaster.stockid = '" . $CN_Line['stockid'] . "' AND custbranch.debtorno = '" . $Header['debtorno'] . "' AND custbranch.branchcode='" . $Header['branchcode'] . "'"; - + } - + $Result = api_DB_query($SQL,$db,'','',true); if ($CompanyRecord['gllink_stock']==1 AND $StandardCost !=0){ @@ -739,7 +768,7 @@ '" . ($StandardCost * $CN_Line['qty']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ $StockGLCode = GetStockGLCode($CN_Line['stockid'],$db); @@ -759,7 +788,7 @@ '" . (-$StandardCost * $CN_Line['qty']) . "')"; $Result = api_DB_query($SQL,$db,'','',true); - + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ if ($CompanyRecord['gllink_debtors']==1 AND $CN_Line['price'] !=0){ @@ -783,7 +812,7 @@ '" . (-$CN_Line['price'] * $CN_Line['qty']/$CN_Header['rate']) . "' )"; $Result = api_DB_query($SQL,$db,'','',true); - + if ($CN_Line['discountpercent'] !=0){ $SQL = "INSERT INTO gltrans (type, @@ -799,7 +828,7 @@ '" . $PeriodNo . "', '" . $SalesGLAccounts['discountglcode'] . "', '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " @ " . ($CN_Line['discountpercent'] * 100) . "%', - '" . ($CN_Line['price'] * $CN_Line['quantity'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; + '" . ($CN_Line['price'] * $CN_Line['qty'] * $CN_Line['discountpercent']/$CN_Header['rate']) . "')"; $Result = DB_query($SQL,$db,'','',true); } /*end of if discount !=0 */ @@ -809,18 +838,13 @@ $LineCounter++; //needed for the array of taxes by line } /*end of OrderLine loop */ - $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$OrderHeader['rate']; + $TotalCreditLocalCurr = ($TotalFXNetCredit + $TotalFXTax)/$CN_Header['rate']; - -//To here - - if ($CompanyRecord['gllink_debtors']==1){ /*Now post the tax to the GL at local currency equivalent */ if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { - /*Loop through the tax authorities array to post each total to the taxauth glcode */ foreach ($TaxTotals as $Tax){ $SQL = "INSERT INTO gltrans (type, @@ -830,19 +854,19 @@ account, narrative, amount ) - VALUES (10, - '" . $InvoiceNo . "', - '" . $OrderHeader['orddate']. "', + VALUES (11, + '" . $CreditNoteNo . "', + '" . $Header['trandate']. "', '" . $PeriodNo . "', '" . $Tax['GLCode'] . "', - '" . $OrderHeader['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', - '" . -$Tax['FXAmount']/$OrderHeader['rate'] . "' )"; + '" . $Header['debtorno'] . "-" . $Tax['TaxAuthDescription'] . "', + '" . -$Tax['FXAmount']/$CN_Header['rate'] . "' )"; $Result = api_DB_query($SQL,$db,'','',true); } } - /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ + /*Post debtors transaction to GL credit debtors, and debit sales */ if (($TotalCreditLocalCurr) !=0) { $SQL = "INSERT INTO gltrans (type, typeno, @@ -851,24 +875,20 @@ account, narrative, amount) - VALUES ('10', - '" . $InvoiceNo . "', - '" . $OrderHeader['orddate'] . "', + VALUES ('11', + '" . $CreditNoteNo . "', + '" . $Header['trandate'] . "', '" . $PeriodNo . "', '" . $CompanyRecord['debtorsact'] . "', - '" . $OrderHeader['debtorno'] . "', + '" . $Header['debtorno'] . "', '" . $TotalCreditLocalCurr . "')"; $Result = api_DB_query($SQL,$db,'','',true); } - EnsureGLEntriesBalance(10,$InvoiceNo,$db); - + EnsureGLEntriesBalance(11,$CreditNoteNo,$db); + } /*end of if Sales and GL integrated */ - /*Update order header for invoice charged on */ - $SQL = "UPDATE salesorders SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') WHERE orderno= '" . $OrderNo . "'"; - $Result = api_DB_query($SQL,$db,'','',true); - /*Now insert the DebtorTrans */ $SQL = "INSERT INTO debtortrans (transno, @@ -880,51 +900,48 @@ prd, reference, tpe, - order_, ovamount, ovgst, rate, shipvia) VALUES ( - '". $InvoiceNo . "', - 10, - '" . $OrderHeader['debtorno'] . "', - '" . $OrderHeader['branchcode'] . "', - '" . $OrderHeader['orddate'] . "', + '". $CreditNoteNo . "', + 11, + '" . $Header['debtorno'] . "', + '" . $Header['branchcode'] . "', + '" . $Header['trandate'] . "', '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', - '" . $OrderHeader['customerref'] . "', - '" . $OrderHeader['sales_type'] . "', - '" . $OrderNo . "', + '" . $Header['customerref'] . "', + '" . $Header['tpe'] . "', '" . $TotalFXNetCredit . "', '" . $TotalFXTax . "', - '" . $OrderHeader['rate'] . "', - '" . $OrderHeader['shipvia'] . "')"; - + '" . $CN_Header['rate'] . "', + '" . $Header['shipvia'] . "')"; + $Result = api_DB_query($SQL,$db,'','',true); - + $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); - + /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { - + $SQL = "INSERT INTO debtortranstaxes (debtortransid, taxauthid, taxamount) VALUES ('" . $DebtorTransID . "', '" . $TaxAuthID . "', - '" . $Tax['FXAmount']/$OrderHeader['rate'] . "')"; + '" . $Tax['FXAmount']/$CN_Header['rate'] . "')"; $Result = api_DB_query($SQL,$db,'','',true); } - + if (sizeof($Errors)==0) { - $Result = DB_Txn_Commit($db); $Errors[0]=0; - $Errors[1]=$InvoiceNo; + $Errors[1]=$CreditNoteNo; } else { $Result = DB_Txn_Rollback($db); - } + } return $Errors; } /*End of CreateCreditNote method */ @@ -932,9 +949,11 @@ /* Create a customer invoice in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. - * There are no stock updates no accounting for assemblies no updates + + * NB: There are no stock updates no accounting for assemblies no updates * to sales analysis records - no cost of sales entries in GL - * USE WITH CAUTION + + ************ USE ONLY WITH CAUTION******************** */ function InsertSalesInvoice($InvoiceDetails, $user, $password) { $Errors = array(); @@ -1062,9 +1081,12 @@ /* Create a customer credit note in webERP. This function will bypass the * normal procedure in webERP for creating a sales order first, and then * delivering it. All values should be sent as negatives. - * stock is not updated and the method cannot deal with assembly items + + + * NB: Stock is not updated and the method cannot deal with assembly items * the sales analysis is not updated either - * USE WITH CAUTION!! + + ****************** USE WITH CAUTION!! ********************** */ function InsertSalesCredit($CreditDetails, $user, $password) { $Errors = array(); Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_salesorders.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -634,7 +634,12 @@ function InvoiceSalesOrder($OrderNo, $User, $Password) { - + + +$fp = fopen( "/root/Web-Server/apidebug/DebugInfo.txt", "w"); + + + $Errors = array(); $db = db($User, $Password); if (gettype($db)=='integer') { @@ -706,7 +711,7 @@ mbflag, materialcost+labourcost+overheadcost AS standardcost FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid + ON salesorderdetails.stkcode = stockmaster.stockid WHERE orderno ='" . $OrderNo . "' AND completed=0"; @@ -721,7 +726,9 @@ /*Now Get the next invoice number - function in SQL_CommonFunctions*/ $InvoiceNo = GetNextTransNo(10, $db); $PeriodNo = GetCurrentPeriod($db); - + + $TaxTotals =array(); + $TotalFXNetInvoice = 0; $TotalFXTax = 0; $LineCounter =0; @@ -755,11 +762,9 @@ if (DB_error_no($db) != 0) { $Errors[] = TaxRatesFailed; } - $LineTaxAmount = 0; - $TaxTotals =array(); + while ($myrow = DB_fetch_array($GetTaxRatesResult)){ - while ($myrow = DB_fetch_array($GetTaxRatesResult)){ if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) { $TaxTotals[$myrow['taxauthid']]['FXAmount']=0; } @@ -769,13 +774,12 @@ $TaxTotals[$myrow['taxauthid']]['TaxAuthDescription'] = $myrow['description']; if ($myrow['taxontax'] ==1){ - $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; + $TaxAuthAmount = ($LineNetAmount+$LineTaxAmount) * $myrow['taxrate']; } else { $TaxAuthAmount = $LineNetAmount * $myrow['taxrate']; - $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $LineNetAmount * $myrow['taxrate']; } - + $TaxTotals[$myrow['taxauthid']]['FXAmount'] += $TaxAuthAmount; + /*Make an array of the taxes and amounts including GLcodes for later posting - need debtortransid so can only post once the debtor trans is posted - can only post debtor trans when all tax is calculated */ $LineTaxes[$LineCounter][$myrow['calculationorder']] = array('TaxCalculationOrder' =>$myrow['calculationorder'], @@ -788,8 +792,6 @@ }//end loop around Taxes - $LineNetAmount = $OrderLineRow['unitprice'] * $OrderLineRow['quantity'] *(1- floatval($OrderLineRow['discountpercent'])); - $TotalFXNetInvoice += $LineNetAmount; $TotalFXTax += $LineTaxAmount; @@ -1180,7 +1182,6 @@ /*Now post the tax to the GL at local currency equivalent */ if ($CompanyRecord['gllink_debtors']==1 AND $TaxAuthAmount !=0) { - /*Loop through the tax authorities array to post each total to the taxauth glcode */ foreach ($TaxTotals as $Tax){ $SQL = "INSERT INTO gltrans (type, Modified: trunk/api/api_session.inc =================================================================== --- trunk/api/api_session.inc 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/api/api_session.inc 2012-02-04 06:13:15 UTC (rev 4866) @@ -64,7 +64,7 @@ // query function, and will remember any error message in the session // data. - $result = DB_query($sql, $db, $Emsg, $Dmsg, $Transaction, $TrapErrors); + $result = DB_query($sql, $db, $EMsg, $DMsg, $Transaction, $TrapErrors); if (DB_error_no($db) != 0) { $_SESSION['db_err_msg'] = "SQL: " . $sql . "\nDB error message: " . DB_error_msg($db) . "\n"; } else { Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2012-02-03 09:57:52 UTC (rev 4865) +++ trunk/doc/Manual/ManualContents.php 2012-02-04 06:13:15 UTC (rev 4866) @@ -87,793 +87,793 @@ <?php } ?> - <UL> - <LI>Hardware Requirements</LI> - <LI>Software Requirements</LI> - <LI>Using webERP with a Wiki</LI> + <ul> + <li>Hardware Requirements</li> + <li>Software Requirements</li> + <li>Using webERP with a Wiki</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectGettingStarted"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GettingStarted'; ?>">Getting Started</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GettingStarted'; ?>">Getting Started</a> <?php } else { ?> - <A HREF="#GettingStarted">Getting Started</A> + <a HREF="#GettingStarted">Getting Started</a> <?php } ?> - <UL> - <LI>Prerequisites</LI> - <LI>Copying the PHP Scripts</LI> - <LI>Creating the Database</LI> - <LI>Editing config.php</LI> - <LI>Logging In For the First Time</LI> - <LI>Themes and GUI Modification</LI> - <LI>Setting Up Users</LI> + <ul> + <li>Prerequisites</li> + <li>Copying the PHP Scripts</li> + <li>Creating the Database</li> + <li>Editing config.php</li> + <li>Logging In For the First Time</li> + <li>Themes and GUI Modification</li> + <li>Setting Up Users</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSecuritySchema"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SecuritySchema'; ?>">Security Schema</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SecuritySchema'; ?>">Security Schema</a> <?php } else { ?> - <A HREF="#SecuritySchema">Security Schema</A> + <a HREF="#SecuritySchema">Security Schema</a> <?php } ?> - </LI> + </li> <br /><br /> - <LI> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCreatingNewSystem"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreatingNewSystem'; ?>">Creating a New System</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreatingNewSystem'; ?>">Creating a New System</a> <?php } else { ?> - <A HREF="#CreatingNewSystem">Creating a New System</A> + <a HREF="#CreatingNewSystem">Creating a New System</a> <?php } ?> - <UL> - <LI>Running the Demonstration Database</LI> - <LI>Setting Up A System</LI> - <LI>Setting Up Inventory Items</LI> - <LI>Entering Inventory Balances</LI> - <LI>Inventory Ledger Integration to General Ledger Issues</LI> - <LI>Setting Up Customers</LI> - <LI>Entering Customer Balances</LI> - <LI>Reconciling the Debtors Ledger Control Account</LI> - <LI>Finally</LI> + <ul> + <li>Running the Demonstration Database</li> + <li>Setting Up A System</li> + <li>Setting Up Inventory Items</li> + <li>Entering Inventory Balances</li> + <li>Inventory Ledger Integration to General Ledger Issues</li> + <li>Setting Up Customers</li> + <li>Entering Customer Balances</li> + <li>Reconciling the Debtors Ledger Control Account</li> + <li>Finally</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSystemConventions"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SystemConventions'; ?>">System Conventions</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SystemConventions'; ?>">System Conventions</a> <?php } else { ?> - <A HREF="#SystemConventions">System Conventions</A> + <a HREF="#SystemConventions">System Conventions</a> <?php } ?> - <UL> - <LI>Navigating the Menu</LI> - <LI>Reporting</LI> + <ul> + <li>Navigating the Menu</li> + <li>Reporting</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectInventory"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Inventory'; ?>">Inventory (aka "Stock")</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Inventory'; ?>">Inventory (aka "Stock")</a> <?php } else { ?> - <A HREF="#Inventory">Inventory (aka "Stock")</A> + <a HREF="#Inventory">Inventory (aka "Stock")</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Inventory System Features</LI> - <LI>Inventory Categories</LI> - <LI>Adding Inventory Items</LI> - <LI>Item Code</LI> - <LI>Part Descriptions</LI> - <LI>Categories</LI> - <LI>Unit of Measurement</LI> - <LI>Economic Order Quantity</LI> - <LI>Packaged Volume</LI> - <LI>Packaged Weight</LI> - <LI>Units of Measure</LI> - <LI>Current or Obsolete</LI> - <LI>Make Or Buy</LI> - <LI>Setting Up Assembly Items</LI> - <LI>Controlled</LI> - <LI>Serialised</LI> - <LI>Bar Code</LI> - <LI>Discount Category</LI> - <LI>Decimal Places</LI> - <LI>Inventory Costing</LI> - <LI>Material Cost</LI> - <LI>Labour Cost</LI> - <LI>Overhead Cost</LI> - <LI>Standard Costing Considerations</LI> - <LI>Actual Cost</LI> - <LI>Alterations To Labour Cost, Material Cost or Overhead Cost</LI> - <LI>Selecting Inventory Items</LI> - <LI>Amending Inventory Items</LI> - <LI>Changing a Category</LI> - <LI>Alterations to the Make or Buy Flag</LI> - <LI>Inventory Categories</LI> - <LI>Inventory Category Code</LI> - <LI>Inventory Category Description</LI> - <LI>Balance Sheet Inventory GL Account</LI> - <LI>Inventory Adjustments GL Posting Account</LI> - <LI>Purchase Price Variance Account</LI> - <LI>Material Usage Variance Account</LI> - <LI>Type of Resource</LI> - <LI>Inventory Location Maintenance</LI> - <LI>Inventory Adjustments</LI> - <LI>Inventory Location Transfers</LI> - <LI>Inventory Reports and Inquiries</LI> - <LI>Inventory Status inquiries</LI> - <LI>Inventory Movement inquiries</LI> - <LI>Inventory Usage inquiries</LI> - <LI>Inventory Valuation Report</LI> - <LI>Inventory Planning Report</LI> - <LI>Inventory Checks</LI> + <ul> + <li>Overview</li> + <li>Inventory System Features</li> + <li>Inventory Categories</li> + <li>Adding Inventory Items</li> + <li>Item Code</li> + <li>Part Descriptions</li> + <li>Categories</li> + <li>Unit of Measurement</li> + <li>Economic Order Quantity</li> + <li>Packaged Volume</li> + <li>Packaged Weight</li> + <li>Units of Measure</li> + <li>Current or Obsolete</li> + <li>Make Or Buy</li> + <li>Setting Up Assembly Items</li> + <li>Controlled</li> + <li>Serialised</li> + <li>Bar Code</li> + <li>Discount Category</li> + <li>Decimal Places</li> + <li>Inventory Costing</li> + <li>Material Cost</li> + <li>Labour Cost</li> + <li>Overhead Cost</li> + <li>Standard Costing Considerations</li> + <li>Actual Cost</li> + <li>Alterations To Labour Cost, Material Cost or Overhead Cost</li> + <li>Selecting Inventory Items</li> + <li>Amending Inventory Items</li> + <li>Changing a Category</li> + <li>Alterations to the Make or Buy Flag</li> + <li>Inventory Categories</li> + <li>Inventory Category Code</li> + <li>Inventory Category Description</li> + <li>Balance Sheet Inventory GL Account</li> + <li>Inventory Adjustments GL Posting Account</li> + <li>Purchase Price Variance Account</li> + <li>Material Usage Variance Account</li> + <li>Type of Resource</li> + <li>Inventory Location Maintenance</li> + <li>Inventory Adjustments</li> + <li>Inventory Location Transfers</li> + <li>Inventory Reports and Inquiries</li> + <li>Inventory Status inquiries</li> + <li>Inventory Movement inquiries</li> + <li>Inventory Usage inquiries</li> + <li>Inventory Valuation Report</li> + <li>Inventory Planning Report</li> + <li>Inventory Checks</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectAccountsReceivable"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsReceivable'; ?>">Accounts Receivable</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsReceivable'; ?>">Accounts Receivable</a> <?php } else { ?> - <A HREF="#AccountsReceivable">Accounts Receivable</A> + <a HREF="#AccountsReceivable">Accounts Receivable</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Features</LI> - <LI>Entering New Customers</LI> - <LI>Customer Code</LI> - <LI>Customer Name</LI> - <LI>Address Line 1, 2, 3 and 4</LI> - <LI>Currency</LI> - <LI>Invoice Discount</LI> - <LI>Prompt Payment Discount</LI> - <LI>Customer Since</LI> - <LI>Payment Terms</LI> - <LI>Credit Status or Rating</LI> - <LI>Credit Limit</LI> - <LI>Invoice Addressing</LI> - <LI>Entering Customer Branches</LI> - <LI>Branch Name</LI> - <LI>Branch Code</LI> - <LI>Branch Contact / Phone / Fax / Address</LI> - <LI>Sales Person</LI> - <LI>Draw Stock From</LI> - <LI>Forward Date From A Day In The Month</LI> - <LI>Delivery Days</LI> - <LI>Phone/Fax/Email</LI> - <LI>Tax Authority</LI> - <LI>Disable Transactions</LI> - <LI>Default Freight Company</LI> - <LI>Postal Address 1, 2, 3 and 4</LI> - <LI>Amending Customer Details</LI> - <LI>Shippers</LI> + <ul> + <li>Overview</li> + <li>Features</li> + <li>Entering New Customers</li> + <li>Customer Code</li> + <li>Customer Name</li> + <li>Address Line 1, 2, 3 and 4</li> + <li>Currency</li> + <li>Invoice Discount</li> + <li>Prompt Payment Discount</li> + <li>Customer Since</li> + <li>Payment Terms</li> + <li>Credit Status or Rating</li> + <li>Credit Limit</li> + <li>Invoice Addressing</li> + <li>Entering Customer Branches</li> + <li>Branch Name</li> + <li>Branch Code</li> + <li>Branch Contact / Phone / Fax / Address</li> + <li>Sales Person</li> + <li>Draw Stock From</li> + <li>Forward Date From A Day In The Month</li> + <li>Delivery Days</li> + <li>Phone/Fax/Email</li> + <li>Tax Authority</li> + <li>Disable Transactions</li> + <li>Default Freight Company</li> + <li>Postal Address 1, 2, 3 and 4</li> + <li>Amending Customer Details</li> + <li>Shippers</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectAccountsPayable"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsPayable'; ?>">Accounts Payable</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=AccountsPayable'; ?>">Accounts Payable</a> <?php } else { ?> - <A HREF="#AccountsPayable">Accounts Payable</A> + <a HREF="#AccountsPayable">Accounts Payable</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Features</LI> - <LI>Entering New Suppliers</LI> - <LI>Supplier Code</LI> - <LI>Supplier Name</LI> - <LI>Address Line 1, 2, 3 and 4</LI> - <LI>Supplier Since</LI> - <LI>Payment Terms</LI> - <LI>Bank Particulars/Reference</LI> - <LI>Bank Account Number</LI> - <LI>Currency</LI> - <LI>Remittance Advice</LI> + <ul> + <li>Overview</li> + <li>Features</li> + <li>Entering New Suppliers</li> + <li>Supplier Code</li> + <li>Supplier Name</li> + <li>Address Line 1, 2, 3 and 4</li> + <li>Supplier Since</li> + <li>Payment Terms</li> + <li>Bank Particulars/Reference</li> + <li>Bank Account Number</li> + <li>Currency</li> + <li>Remittance Advice</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesPeople"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesPeople'; ?>">Sales People</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesPeople'; ?>">Sales People</a> <?php } else { ?> - <A HREF="#SalesPeople">Sales People</A> + <a HREF="#SalesPeople">Sales People</a> <?php } ?> - <UL> - <LI>Salesperson Records</LI> - <LI>Salespeople Code</LI> - <LI>Salesperson Name, Telephone and Fax Numbers</LI> - <LI>Salesperson Commission Rates and Breakpoint</LI> + <ul> + <li>Salesperson Records</li> + <li>Salespeople Code</li> + <li>Salesperson Name, Telephone and Fax Numbers</li> + <li>Salesperson Commission Rates and Breakpoint</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCurrencies"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Currencies'; ?>">Currencies</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Currencies'; ?>">Currencies</a> <?php } else { ?> - <A HREF="#Currencies">Currencies</A> + <a HREF="#Currencies">Currencies</a> <?php } ?> - <UL> - <LI>Currency Abbreviation</LI> - <LI>Currency Name</LI> - <LI>Country of Currency</LI> - <LI>Hundredths Name</LI> - <LI>Exchange Rates</LI> + <ul> + <li>Currency Abbreviation</li> + <li>Currency Name</li> + <li>Country of Currency</li> + <li>Hundredths Name</li> + <li>Exchange Rates</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesTypes"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesTypes'; ?>">Sales Types / Price Lists</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesTypes'; ?>">Sales Types / Price Lists</a> <?php } else { ?> - <A HREF="#SalesTypes">Sales Types / Price Lists</A> + <a HREF="#SalesTypes">Sales Types / Price Lists</a> <?php } ?> - <UL> - <LI>Sales Types / Price Lists</LI> - <LI>Sales Type Code</LI> - <LI>Sales Type Description</LI> + <ul> + <li>Sales Types / Price Lists</li> + <li>Sales Type Code</li> + <li>Sales Type Description</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectPaymentTerms"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PaymentTerms'; ?>">Payment Terms</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PaymentTerms'; ?>">Payment Terms</a> <?php } else { ?> - <A HREF="#PaymentTerms">Payment Terms</A> + <a HREF="#PaymentTerms">Payment Terms</a> <?php } ?> - <UL> - <LI>Payment Terms</LI> - <LI>Payment Terms Code</LI> - <LI>Payment Terms Description</LI> - <LI>Days Before Due / Day In Following Month When Due</LI> + <ul> + <li>Payment Terms</li> + <li>Payment Terms Code</li> + <li>Payment Terms Description</li> + <li>Days Before Due / Day In Following Month When Due</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectCreditStatus"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreditStatus'; ?>">Credit Status</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=CreditStatus'; ?>">Credit Status</a> <?php } else { ?> - <A HREF="#CreditStatus">Credit Status</A> + <a HREF="#CreditStatus">Credit Status</a> <?php } ?> - <UL> - <LI>Credit Status Ratings</LI> - <LI>Status Code</LI> - <LI>Status Description</LI> - <LI>Disallow Invoices</LI> + <ul> + <li>Credit Status Ratings</li> + <li>Status Code</li> + <li>Status Description</li> + <li>Disallow Invoices</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectTax"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Tax'; ?>">Tax</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Tax'; ?>">Tax</a> <?php } else { ?> - <A HREF="#Tax">Tax</A> + <a HREF="#Tax">Tax</a> <?php } ?> - <UL> - <LI>Tax Calculations</LI> - <LI>Overview</LI> - <LI>Setting up Taxes</LI> - <LI>Sales only within one Tax Authority Example - 2 Tax Levels:</LI> - <LI>Sales only within one Tax Authority Example - 3 Tax Levels:</LI> - <LI>Sales Within Two Tax Authorities Example - 3 Tax Levels:</LI> + <ul> + <li>Tax Calculations</li> + <li>Overview</li> + <li>Setting up Taxes</li> + <li>Sales only within one Tax Authority Example - 2 Tax Levels:</li> + <li>Sales only within one Tax Authority Example - 3 Tax Levels:</li> + <li>Sales Within Two Tax Authorities Example - 3 Tax Levels:</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectPrices"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Prices'; ?>">Prices and Discounts</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Prices'; ?>">Prices and Discounts</a> <?php } else { ?> - <A HREF="#Prices">Prices and Discounts</A> + <a HREF="#Prices">Prices and Discounts</a> <?php } ?> - <UL> - <LI>Prices and Discounts</LI> - <LI>Pricing Overview</LI> - <LI>Maintaining Prices</LI> - <LI>Discount Matrix</LI> + <ul> + <li>Prices and Discounts</li> + <li>Pricing Overview</li> + <li>Maintaining Prices</li> + <li>Discount Matrix</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARTransactions"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARTransactions'; ?>">Accounts Receivable Transactions</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARTransactions'; ?>">Accounts Receivable Transactions</a> <?php } else { ?> - <A HREF="#ARTransactions">Accounts Receivable Transactions</A> + <a HREF="#ARTransactions">Accounts Receivable Transactions</a> <?php } ?> - <UL> - <LI>Invoicing An Order</LI> - <LI>Selecting an Order To Invoice</LI> - <LI>Producing An Invoice From A Selected Order</LI> - <LI>Credit Notes</LI> - <LI>Entry Of Receipts</LI> - <LI>Receipts - Customer</LI> - <LI>Receipts - Date</LI> - <LI>Receipts - Currency and Exchange Rate</LI> - <LI>Receipts - Payment Method</LI> - <LI>Receipts - Amount</LI> - <LI>Receipts - Discount</LI> - <LI>Receipts - Allocating to Invoices</LI> - <LI>Differences on Exchange</LI> - <LI>Receipts Processing</LI> - <LI>Deposits Listing</LI> - <LI>Allocate Credits To A Customer's Account</LI> + <ul> + <li>Invoicing An Order</li> + <li>Selecting an Order To Invoice</li> + <li>Producing An Invoice From A Selected Order</li> + <li>Credit Notes</li> + <li>Entry Of Receipts</li> + <li>Receipts - Customer</li> + <li>Receipts - Date</li> + <li>Receipts - Currency and Exchange Rate</li> + <li>Receipts - Payment Method</li> + <li>Receipts - Amount</li> + <li>Receipts - Discount</li> + <li>Receipts - Allocating to Invoices</li> + <li>Differences on Exchange</li> + <li>Receipts Processing</li> + <li>Deposits Listing</li> + <li>Allocate Credits To A Customer's Account</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARInquiries"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARInquiries'; ?>">Accounts Receivable Inquiries</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARInquiries'; ?>">Accounts Receivable Inquiries</a> <?php } else { ?> - <A HREF="#ARInquiries">Accounts Receivable Inquiries</A> + <a HREF="#ARInquiries">Accounts Receivable Inquiries</a> <?php } ?> - <UL> - <LI>Customer Inquiries</LI> - <LI>Customer Account inquiries</LI> - <LI>Transaction Detail inquiries</LI> + <ul> + <li>Customer Inquiries</li> + <li>Customer Account inquiries</li> + <li>Transaction Detail inquiries</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectARReports"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARReports'; ?>">Accounts Receivable Reports</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=ARReports'; ?>">Accounts Receivable Reports</a> <?php } else { ?> - <A HREF="#ARReports">Accounts Receivable Reports</A> + <a HREF="#ARReports">Accounts Receivable Reports</a> <?php } ?> - <UL> - <LI>Customers - Reporting</LI> - <LI>Aged Customer Balance Listing</LI> - <LI>Customer Statements</LI> - <LI>Customer Transaction Listing Options</LI> - <LI>Printing Invoices Or Credit Notes</LI> + <ul> + <li>Customers - Reporting</li> + <li>Aged Customer Balance Listing</li> + <li>Customer Statements</li> + <li>Customer Transaction Listing Options</li> + <li>Printing Invoices Or Credit Notes</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesAnalysis"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesAnalysis'; ?>">Sales Analysis</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesAnalysis'; ?>">Sales Analysis</a> <?php } else { ?> - <A HREF="#SalesAnalysis">Sales Analysis</A> + <a HREF="#SalesAnalysis">Sales Analysis</a> <?php } ?> - <UL> - <LI>Sales Analysis</LI> - <LI>Sales Analysis Report Headers</LI> - <LI>Sales Analysis Report Columns</LI> - <LI>Automating Sales Reports</LI> + <ul> + <li>Sales Analysis</li> + <li>Sales Analysis Report Headers</li> + <li>Sales Analysis Report Columns</li> + <li>Automating Sales Reports</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectSalesOrders"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesOrders'; ?>">Sales Orders</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=SalesOrders'; ?>">Sales Orders</a> <?php } else { ?> - <A HREF="#SalesOrders">Sales Orders</A> + <a HREF="#SalesOrders">Sales Orders</a> <?php } ?> - <UL> - <LI>Sales Orders</LI> - <LI>Sales Order Functionality</LI> - <LI>Entry of Sales Orders</LI> - <LI>Sales Orders - Selection of the Customer and Branch</LI> - <LI>Selection of Order Line Items</LI> - <LI>Delivery Details</LI> - <LI>Modfiying An Order</LI> - <LI>Quotations</LI> - <LI>Recurring Orders</LI> - <LI>Counter Sales - Entering Sales Directly</LI> - <LI>Managing Discounts by product group and customer group (Matrix)</LI> + <ul> + <li>Sales Orders</li> + <li>Sales Order Functionality</li> + <li>Entry of Sales Orders</li> + <li>Sales Orders - Selection of the Customer and Branch</li> + <li>Selection of Order Line Items</li> + <li>Delivery Details</li> + <li>Modfiying An Order</li> + <li>Quotations</li> + <li>Recurring Orders</li> + <li>Counter Sales - Entering Sales Directly</li> + <li>Managing Discounts by product group and customer group (Matrix)</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="PurchaseOrdering"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PurchaseOrdering'; ?>">Purchase Ordering</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=PurchaseOrdering'; ?>">Purchase Ordering</a> <?php } else { ?> - <A HREF="#Shipments">Purchase Orders</A> + <a HREF="#Shipments">Purchase Orders</a> <?php } ?> - <UL> - <LI>Overview</LI> - <LI>Purchase Orders</LI> - <LI>Adding a New Purchase Order</LI> - <LI>Authorising Purchase Orders </LI> - <LI>Recieving Purchase Orders</LI> + <ul> + <li>Overview</li> + <li>Purchase Orders</li> + <li>Adding a New Purchase Order</li> + <li>Authorising Purchase Orders </li> + <li>Recieving Purchase Orders</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectShipments"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Shipments'; ?>">Shipments</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Shipments'; ?>">Shipments</a> <?php } else { ?> - <A HREF="#Shipments">Shipments</A> + <a HREF="#Shipments">Shipments</a> <?php } ?> - <UL> - <LI>Shipments</LI> - <LI>Shipment General Ledger Posting</LI> - <LI>Creating Shipments</LI> - <LI>Shipment Costings</LI> - <LI>Closing a Shipment</LI> + <ul> + <li>Shipments</li> + <li>Shipment General Ledger Posting</li> + <li>Creating Shipments</li> + <li>Shipment Costings</li> + <li>Closing a Shipment</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectContractCosting"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Contracts'; ?>">Contract Costing</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Contracts'; ?>">Contract Costing</a> <?php } else { ?> - <A HREF="#Contracts">Contract Costing</A> + <a HREF="#Contracts">Contract Costing</a> <?php } ?> - <UL> - <LI>Contract Costing Overview</LI> - <LI>Creating A New Contract</LI> - <LI>Selecting A Contract</LI> - <LI>Charging Against Contracts</LI> + <ul> + <li>Contract Costing Overview</li> + <li>Creating A New Contract</li> + <li>Selecting A Contract</li> + <li>Charging Against Contracts</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectManufacturing"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Manufacturing'; ?>">Manufacturing</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=Manufacturing'; ?>">Manufacturing</a> <?php } else { ?> - <A HREF="#Manufacturing">Manufacturing</A> + <a HREF="#Manufacturing">Manufacturing</a> <?php } ?> - <UL> - <LI>Manufacturing Overview</LI> - <LI>General Ledger Implications</LI> - <LI>Work Order Entry</LI> - <LI>Work Order Receipts</LI> - <LI>Work Order Issues</LI> - <LI>Closing Work Orders</LI> + <ul> + <li>Manufacturing Overview</li> + <li>General Ledger Implications</li> + <li>Work Order Entry</li> + <li>Work Order Receipts</li> + <li>Work Order Issues</li> + <li>Closing Work Orders</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectMRP"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=MRP'; ?>"> - Material Requirements Planning</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=MRP'; ?>"> + Material Requirements Planning</a> <?php } else { ?> - <A HREF="#MRP">Material Requirements Planning</A> + <a HREF="#MRP">Material Requirements Planning</a> <?php } ?> - <UL> - <LI>MRP Overview</LI> - <LI>Base Data Required</LI> - <LI>Production Calendar</LI> - <LI>Master (Production) Schedule</LI> - <LI>Running The MRP Calculation</LI> - <LI>How It Works</LI> - <LI>MRP Reports</LI> + <ul> + <li>MRP Overview</li> + <li>Base Data Required</li> + <li>Production Calendar</li> + <li>Master (Production) Schedule</li> + <li>Running The MRP Calculation</li> + <li>How It Works</li> + <li>MRP Reports</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectGeneralLedger"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GeneralLedger'; ?>">General Ledger</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=GeneralLedger'; ?>">General Ledger</a> <?php } else { ?> - <A HREF="#GeneralLedger">General Ledger</A> + <a HREF="#GeneralLedger">General Ledger</a> <?php } ?> - <UL> - <LI>General Ledger Overview</LI> - <LI>Account Groups</LI> - <LI>Bank Accounts</LI> - <LI>Bank Account Payments</LI> - <LI>General Ledger Integration Setup</LI> - <LI>Sales Journals</LI> - <LI>Stock Journals</LI> - <LI>EDI</LI> - <LI>EDI Setup</LI> - <LI>Sending EDI Invoices</LI> + <ul> + <li>General Ledger Overview</li> + <li>Account Groups</li> + <li>Bank Accounts</li> + <li>Bank Account Payments</li> + <li>General Ledger Integration Setup</li> + <li>Sales Journals</li> + <li>Stock Journals</li> + <li>EDI</li> + <li>EDI Setup</li> + <li>Sending EDI Invoices</li> </UL> <br /> - </LI> - <LI> + </li> + <li> <?php if (!isset($_POST['Submit'])) { ?> <input type="checkbox" name="SelectFixedAssets"> - <A HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=FixedAssets'; ?>">Fixed Assets</A> + <a HREF="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) . '?ViewTopic=FixedAssets'; ?>">Fixed Assets</a> <?php } else { ?> - <A HREF="#Fixed Assets">Fixed Assets</A> + <a HREF="#Fixed Assets">Fixed Assets</a> <?php } ?> - <UL> - <LI>Fixed Assets Overview</LI> - <LI>Creating a Fixed Asset</LI> - <LI>Selecting Fixe... [truncated message content] |
From: <vv...@us...> - 2012-02-05 02:35:08
|
Revision: 4868 http://web-erp.svn.sourceforge.net/web-erp/?rev=4868&view=rev Author: vvs2012 Date: 2012-02-05 02:35:01 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Fixed addTextWrap() in class.pdf.php. The length of the string was not calculated properly, causing long strings to print beyond the cell boundaries. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/class.pdf.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-02-04 06:21:54 UTC (rev 4867) +++ trunk/doc/Change.log 2012-02-05 02:35:01 UTC (rev 4868) @@ -1,5 +1,6 @@ webERP Change Log +4/2/12 Vitaly: Fixed addTextWrap() in class.pdf.php. The length of the string was not calculated properly, causing long strings to print beyond the cell boundaries. 4/2/12 Phil: Added new API function CreateCreditNote in api_debtortransactions.php 3/2/12 Vitaly:Fixed bug that was not allowing PO lines to be deleted in OrderValue method of PO class was testing using asignment operator not comparison operator 31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2012-02-04 06:21:54 UTC (rev 4867) +++ trunk/includes/class.pdf.php 2012-02-05 02:35:01 UTC (rev 4868) @@ -265,11 +265,11 @@ } $this->SetFontSize($Height); - $cw=&$this->CurrentFont['cw']; + if($Width==0) { $Width=$this->w-$this->rMargin-$this->x; } - $wmax=($Width-2*$this->cMargin)*1000/$this->FontSize; + $wmax=($Width-2*$this->cMargin); $s=str_replace("\r",'',$Text); $s=str_replace("\n",' ',$s); $s = trim($s).' '; @@ -295,6 +295,7 @@ $i=0; $l= $ls=0; $ns=0; + $cw = $this->GetStringWidth($s, '', '', 0, true); while($i<$nb) { $c=$s{$i}; if($c==' ' AND $i>0) { @@ -321,7 +322,7 @@ $sep = $i; } else { if($Align=='J') { - $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->ws=($ns>1) ? ($wmax-$ls)/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <vv...@us...> - 2012-02-05 02:35:08
|
Revision: 4868 http://web-erp.svn.sourceforge.net/web-erp/?rev=4868&view=rev Author: vvs2012 Date: 2012-02-05 02:35:01 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Fixed addTextWrap() in class.pdf.php. The length of the string was not calculated properly, causing long strings to print beyond the cell boundaries. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/class.pdf.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-02-04 06:21:54 UTC (rev 4867) +++ trunk/doc/Change.log 2012-02-05 02:35:01 UTC (rev 4868) @@ -1,5 +1,6 @@ webERP Change Log +4/2/12 Vitaly: Fixed addTextWrap() in class.pdf.php. The length of the string was not calculated properly, causing long strings to print beyond the cell boundaries. 4/2/12 Phil: Added new API function CreateCreditNote in api_debtortransactions.php 3/2/12 Vitaly:Fixed bug that was not allowing PO lines to be deleted in OrderValue method of PO class was testing using asignment operator not comparison operator 31/1/12 Vitaly: Added DB_escape_string before ItemDescription and SupplierName in GoodsReceived.php to prevent problems with '. Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2012-02-04 06:21:54 UTC (rev 4867) +++ trunk/includes/class.pdf.php 2012-02-05 02:35:01 UTC (rev 4868) @@ -265,11 +265,11 @@ } $this->SetFontSize($Height); - $cw=&$this->CurrentFont['cw']; + if($Width==0) { $Width=$this->w-$this->rMargin-$this->x; } - $wmax=($Width-2*$this->cMargin)*1000/$this->FontSize; + $wmax=($Width-2*$this->cMargin); $s=str_replace("\r",'',$Text); $s=str_replace("\n",' ',$s); $s = trim($s).' '; @@ -295,6 +295,7 @@ $i=0; $l= $ls=0; $ns=0; + $cw = $this->GetStringWidth($s, '', '', 0, true); while($i<$nb) { $c=$s{$i}; if($c==' ' AND $i>0) { @@ -321,7 +322,7 @@ $sep = $i; } else { if($Align=='J') { - $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->ws=($ns>1) ? ($wmax-$ls)/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-05 03:40:02
|
Revision: 4870 http://web-erp.svn.sourceforge.net/web-erp/?rev=4870&view=rev Author: daintree Date: 2012-02-05 03:39:56 +0000 (Sun, 05 Feb 2012) Log Message: ----------- not sure Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/doc/Manual/ManualAPITutorial.html Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/api/api_debtortransactions.php 2012-02-05 03:39:56 UTC (rev 4870) @@ -935,6 +935,63 @@ $Result = api_DB_query($SQL,$db,'','',true); } + #Now figure out if there was an invoice in the same POS transaction to allocate against? + + $SQL = "SELECT id, + ovamount+ovgst AS total, + alloc + FROM debtortrans + WHERE customerref='" . $Header['customerref'] . "' + AND type=10 + AND settled=0"; + $Result = api_DB_query($SQL,$db,'','',true); + + $TotalCreditFX = $TotalFXNetCredit + $TotalFXTax; #Should be negative number + $Allocated = 0; + if (DB_num_rows($Result)>0){ + while ($InvoiceRow = DB_fetch_array($Result) AND $Allocated > $TotalCreditFX){ + if ($InvoiceRow['total'] - $InvoiceRow['alloc'] + $TotalCreditFX - $Allocated>0) { + /*Then we can allocate all of the (remaining) credit against this invoice */ + $AllocateAmount = $InvoiceRow['total'] - $InvoiceRow['alloc'] + $TotalCreditFX - $Allocated; + } elseif ($InvoiceRow['total'] - $InvoiceRow['alloc'] - $Allocated > 0){ + $AllocateAmount = $InvoiceRow['total'] - $InvoiceRow['alloc'] - $Allocated; + } else { + $AllocateAmount = 0; + } + if ($AllocateAmount > 0) { + $SQL = "INSERT INTO custallocns (datealloc, + amt, + transid_allocfrom, + transid_allocto) + VALUES ('" . date('Y-m-d') . "', + '" . $AllocateAmount . "', + '" . $DebtorTransID . "', + '" . $InvoiceRow['id'] . "')"; + $InsertAllocResult = api_DB_query($SQL,$db,'','',true); + } + if (abs($InvoiceRow['total'] - $InvoiceRow['alloc'] - $AllocateAmount)<0.005){ + $Settled = 1; + } else { + $Settled =0; + } + $SQL = "UPDATE debtortrans SET alloc = alloc + " . $AllocateAmount . ", + settled = '" . $Settled . "' + WHERE id = '" . $InvoiceRow['id'] ."'"; + $UpdateAllocResult = api_DB_query($SQL,$db,'','',true); + + $Allocated -= $AllocateAmount; + } + if (abs($TotalCreditFX - $Allocated)<0.005){ + $Settled = 1; + } else { + $Settled =0; + } + $SQL = "UPDATE debtortrans SET alloc = alloc + " . $Allocated . ", + settled = '" . $Settled . "' + WHERE id = '" . $DebtorTransID ."'"; + $UpdateAllocResult = api_DB_query($SQL,$db,'','',true); + } + if (sizeof($Errors)==0) { $Result = DB_Txn_Commit($db); $Errors[0]=0; @@ -943,7 +1000,6 @@ $Result = DB_Txn_Rollback($db); } return $Errors; - } /*End of CreateCreditNote method */ /* Create a customer invoice in webERP. This function will bypass the Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/api/api_salesorders.php 2012-02-05 03:39:56 UTC (rev 4870) @@ -1255,7 +1255,7 @@ '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', '" . $OrderHeader['customerref'] . "', - '" . $OrderHeader['sales_type'] . "', + '" . $OrderHeader['ordertype'] . "', '" . $OrderNo . "', '" . $TotalFXNetInvoice . "', '" . $TotalFXTax . "', @@ -1292,7 +1292,7 @@ function GetCurrentPeriod (&$db) { - $TransDate = mktime(); //The current date to find the period for + $TransDate = time(); //The current date to find the period for /* Find the unix timestamp of the last period end date in periods table */ $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); Modified: trunk/doc/Manual/ManualAPITutorial.html =================================================================== --- trunk/doc/Manual/ManualAPITutorial.html 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/doc/Manual/ManualAPITutorial.html 2012-02-05 03:39:56 UTC (rev 4870) @@ -37,7 +37,9 @@ include ("xmlrpc/lib/xmlrpc.inc"); <br /><br /> //if your webERP install is on a server at http://www.yourdomain.com/webERP +<br /><br /> $ServerURL = "http://www.yourdomain.com/webERP/api/api_xml-rpc.php"; +<br /><br /> $DebugLevel = 0; //Set to 0,1, or 2 with 2 being the highest level of debug info <br /><br /> $Parameters = array(); @@ -46,26 +48,39 @@ if one of the parameters required is an array then it needs to be processing into xml for the rpc call through php_xmlrpc_encode()*/ <br /><br /> $Parameters['StockID'] = xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for +<br /><br /> //assuming the demo username and password will work ! +<br /><br /> $Parameters['Username'] = xmlrpcval('admin'); +<br /><br /> $Parameters['Password'] = xmlrpcval('weberp'); <br /><br /> $msg = new xmlrpcmsg("weberp.xmlrpc_GetStockBalance", $Parameters); <br /><br /> $client = new xmlrpc_client($ServerURL); +<br /><br /> $client->setDebug($DebugLevel); +<br /><br /> $response = $client->send($msg); +<br /><br /> $answer = php_xmlrpc_decode($response->value()); +<br /><br /> if ($answer[0]!=0){ //then the API returned some errors need to figure out what went wrong <br /><br /> //need to figure out how to return all the error descriptions associated with the codes <br /><br /> } else { //all went well the returned data is in $answer[1] +<br /><br /> //answer will be an array of the locations and quantity on hand for DVD_TOPGUN so we need to run through the array to print out +<br /><br /> for ($i=0; $i < sizeof($answer[1]);$i++) { +<br /><br /> echo '<br>' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand'; + <br /><br /> } +<br /><br /> echo "</body></html>"; +<br /><br /> </i> <hr /> <br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-05 03:40:02
|
Revision: 4870 http://web-erp.svn.sourceforge.net/web-erp/?rev=4870&view=rev Author: daintree Date: 2012-02-05 03:39:56 +0000 (Sun, 05 Feb 2012) Log Message: ----------- not sure Modified Paths: -------------- trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/doc/Manual/ManualAPITutorial.html Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/api/api_debtortransactions.php 2012-02-05 03:39:56 UTC (rev 4870) @@ -935,6 +935,63 @@ $Result = api_DB_query($SQL,$db,'','',true); } + #Now figure out if there was an invoice in the same POS transaction to allocate against? + + $SQL = "SELECT id, + ovamount+ovgst AS total, + alloc + FROM debtortrans + WHERE customerref='" . $Header['customerref'] . "' + AND type=10 + AND settled=0"; + $Result = api_DB_query($SQL,$db,'','',true); + + $TotalCreditFX = $TotalFXNetCredit + $TotalFXTax; #Should be negative number + $Allocated = 0; + if (DB_num_rows($Result)>0){ + while ($InvoiceRow = DB_fetch_array($Result) AND $Allocated > $TotalCreditFX){ + if ($InvoiceRow['total'] - $InvoiceRow['alloc'] + $TotalCreditFX - $Allocated>0) { + /*Then we can allocate all of the (remaining) credit against this invoice */ + $AllocateAmount = $InvoiceRow['total'] - $InvoiceRow['alloc'] + $TotalCreditFX - $Allocated; + } elseif ($InvoiceRow['total'] - $InvoiceRow['alloc'] - $Allocated > 0){ + $AllocateAmount = $InvoiceRow['total'] - $InvoiceRow['alloc'] - $Allocated; + } else { + $AllocateAmount = 0; + } + if ($AllocateAmount > 0) { + $SQL = "INSERT INTO custallocns (datealloc, + amt, + transid_allocfrom, + transid_allocto) + VALUES ('" . date('Y-m-d') . "', + '" . $AllocateAmount . "', + '" . $DebtorTransID . "', + '" . $InvoiceRow['id'] . "')"; + $InsertAllocResult = api_DB_query($SQL,$db,'','',true); + } + if (abs($InvoiceRow['total'] - $InvoiceRow['alloc'] - $AllocateAmount)<0.005){ + $Settled = 1; + } else { + $Settled =0; + } + $SQL = "UPDATE debtortrans SET alloc = alloc + " . $AllocateAmount . ", + settled = '" . $Settled . "' + WHERE id = '" . $InvoiceRow['id'] ."'"; + $UpdateAllocResult = api_DB_query($SQL,$db,'','',true); + + $Allocated -= $AllocateAmount; + } + if (abs($TotalCreditFX - $Allocated)<0.005){ + $Settled = 1; + } else { + $Settled =0; + } + $SQL = "UPDATE debtortrans SET alloc = alloc + " . $Allocated . ", + settled = '" . $Settled . "' + WHERE id = '" . $DebtorTransID ."'"; + $UpdateAllocResult = api_DB_query($SQL,$db,'','',true); + } + if (sizeof($Errors)==0) { $Result = DB_Txn_Commit($db); $Errors[0]=0; @@ -943,7 +1000,6 @@ $Result = DB_Txn_Rollback($db); } return $Errors; - } /*End of CreateCreditNote method */ /* Create a customer invoice in webERP. This function will bypass the Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/api/api_salesorders.php 2012-02-05 03:39:56 UTC (rev 4870) @@ -1255,7 +1255,7 @@ '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', '" . $OrderHeader['customerref'] . "', - '" . $OrderHeader['sales_type'] . "', + '" . $OrderHeader['ordertype'] . "', '" . $OrderNo . "', '" . $TotalFXNetInvoice . "', '" . $TotalFXTax . "', @@ -1292,7 +1292,7 @@ function GetCurrentPeriod (&$db) { - $TransDate = mktime(); //The current date to find the period for + $TransDate = time(); //The current date to find the period for /* Find the unix timestamp of the last period end date in periods table */ $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods"; $result = DB_query($sql, $db); Modified: trunk/doc/Manual/ManualAPITutorial.html =================================================================== --- trunk/doc/Manual/ManualAPITutorial.html 2012-02-05 03:21:26 UTC (rev 4869) +++ trunk/doc/Manual/ManualAPITutorial.html 2012-02-05 03:39:56 UTC (rev 4870) @@ -37,7 +37,9 @@ include ("xmlrpc/lib/xmlrpc.inc"); <br /><br /> //if your webERP install is on a server at http://www.yourdomain.com/webERP +<br /><br /> $ServerURL = "http://www.yourdomain.com/webERP/api/api_xml-rpc.php"; +<br /><br /> $DebugLevel = 0; //Set to 0,1, or 2 with 2 being the highest level of debug info <br /><br /> $Parameters = array(); @@ -46,26 +48,39 @@ if one of the parameters required is an array then it needs to be processing into xml for the rpc call through php_xmlrpc_encode()*/ <br /><br /> $Parameters['StockID'] = xmlrpcval('DVD-TOPGUN'); //the stockid of the item we wish to know the balance for +<br /><br /> //assuming the demo username and password will work ! +<br /><br /> $Parameters['Username'] = xmlrpcval('admin'); +<br /><br /> $Parameters['Password'] = xmlrpcval('weberp'); <br /><br /> $msg = new xmlrpcmsg("weberp.xmlrpc_GetStockBalance", $Parameters); <br /><br /> $client = new xmlrpc_client($ServerURL); +<br /><br /> $client->setDebug($DebugLevel); +<br /><br /> $response = $client->send($msg); +<br /><br /> $answer = php_xmlrpc_decode($response->value()); +<br /><br /> if ($answer[0]!=0){ //then the API returned some errors need to figure out what went wrong <br /><br /> //need to figure out how to return all the error descriptions associated with the codes <br /><br /> } else { //all went well the returned data is in $answer[1] +<br /><br /> //answer will be an array of the locations and quantity on hand for DVD_TOPGUN so we need to run through the array to print out +<br /><br /> for ($i=0; $i < sizeof($answer[1]);$i++) { +<br /><br /> echo '<br>' . $answer[1][$i]['loccode'] . ' has ' . $answer[1][$i]['quantity'] . ' on hand'; + <br /><br /> } +<br /><br /> echo "</body></html>"; +<br /><br /> </i> <hr /> <br /><br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-02-05 22:00:54
|
Revision: 4874 http://web-erp.svn.sourceforge.net/web-erp/?rev=4874&view=rev Author: daintree Date: 2012-02-05 22:00:48 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Modified Paths: -------------- trunk/PricesBasedOnMarkUp.php trunk/doc/README.txt trunk/doc/UPGRADING.txt Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2012-02-05 16:15:00 UTC (rev 4873) +++ trunk/PricesBasedOnMarkUp.php 2012-02-05 22:00:48 UTC (rev 4874) @@ -35,13 +35,13 @@ echo '</select></td></tr>'; -$SQL = 'SELECT currency, currabrev FROM currencies'; +$SQL = "SELECT currency, currabrev FROM currencies"; $result = DB_query($SQL,$db); echo '<tr> - <td>' . _('Select the price list currency to update') . ':</td> - <td><select name="CurrCode">'; + <td>' . _('Select the price list currency to update') . ':</td> + <td><select name="CurrCode">'; if (!isset($_POST['CurrCode'])){ echo '<option selected="selected" value="0">' . _('No Price List Currency Selected') . '</option>'; @@ -102,7 +102,7 @@ echo '<tr><td>' . _('Stock Category From') . ':</td> <td><select name="StkCatFrom">'; -$sql = 'SELECT categoryid, categorydescription FROM stockcategory'; +$sql = "SELECT categoryid, categorydescription FROM stockcategory"; $ErrMsg = _('The stock categories could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve stock categories and failed was'); @@ -119,8 +119,9 @@ DB_data_seek($result,0); -echo '<tr><td>' . _('Stock Category To') . ':</td> - <td><select name="StkCatTo">'; +echo '<tr> + <td>' . _('Stock Category To') . ':</td> + <td><select name="StkCatTo">'; while ($myrow=DB_fetch_array($result)){ if (isset($_POST['StkCatFrom']) and $myrow['categoryid']==$_POST['StkCatTo']){ Modified: trunk/doc/README.txt =================================================================== --- trunk/doc/README.txt 2012-02-05 16:15:00 UTC (rev 4873) +++ trunk/doc/README.txt 2012-02-05 22:00:48 UTC (rev 4874) @@ -32,7 +32,7 @@ SUPPORT -The primary means of support queries is through the user mailing list. +The primary means of support queries is through the forum at http://www.weberp.org/forum or the user mailing list. Please join the list at: http://lists.sourceforge.net/lists/listinfo/web-erp-users if you have queries. The archives of the mailing lists on sourceforge and the FAQ (see http://www.weberp.org/wikidocs/FrequentlyAskedQuestionsInstallation) contain the most common issues with respect to installation. Modified: trunk/doc/UPGRADING.txt =================================================================== --- trunk/doc/UPGRADING.txt 2012-02-05 16:15:00 UTC (rev 4873) +++ trunk/doc/UPGRADING.txt 2012-02-05 22:00:48 UTC (rev 4874) @@ -2,19 +2,11 @@ /* $Id$*/ -From version 4.01 database upgrades are now automatically processed if the version number of the code is different to the version number of the database. The first login will require the system administrator to allow the system to upgrade it's own database. A backup of the database prior to the running the upgrade is advisable. The new upgrade system will not be able to identify versions prior to 3.11 so it is necessary to select the version being upgraded from manaully. It can process database upgrades from version 3.00 onwards. +From versions 4.01 database upgrades are now automatically processed if the version number of the code is different to the version number of the database. The first login will require the system administrator to allow the system to upgrade it's own database. A backup of the database prior to the running the upgrade is advisable and a link is provided to download a backup of the database. The new upgrade system will not be able to identify versions prior to 3.11 so it is necessary to select the version being upgraded from manaully. It can process database upgrades from version 3.00 onwards. -From version 3.05 an upgrade script will be provided that applies the database modifications automatically and does any data conversions required for the new scripts to work. +The instructions to complete upgrades the old way are provided below if for some reason it becomes necessary: -The upgrade script to convert a 3.05 database to work with 3.06 scripts is: -Z_Upgrade_3.05-3.06.php - -Once the new scripts have been loaded onto the web-server and a backup of the old database taken this script should be opened in a URL - there are no links to this URL so it will need to be typed manually into the browser. - -Previous to version 3.05, the database conversion had to be done manually - the instructions to complete upgrades from older versions are provided below: - - CONVERTING THE DATABASE MANUALY - THE DETAIL As each new version is released the new php scripts will use new database fields or changed field names. A a consequence, the new scripts will most likely not work unless the database structure has been converted to the new database structure. Normally the changes to the database between versions are small. However, between 2.9b and 3.0 the changes were significant and the upgrade script may take some time to run. It should not be run from a phpMyAdmin window since PHP will time out long before the upgrade script will have finished. @@ -27,13 +19,12 @@ where XX.XX is the old version number and YY.YY is the new version number. -No other users should be using the database. The upgrade script will need to be edited to use the name of the database that your webERP installation was created with - by default this is weberp. If the default has not been changed then the following line will need to be added to the upgrade script - right at the beginning: +No other users should be using the database. The upgrade script will need to be edited to use the name of the database that your webERP installation was created with - by default this is weberpdemo. If the default has not been changed then the following line (or modified for your database name) will need to be added to the upgrade script - right at the beginning: - use weberp; + use weberpdemo; A similar line will be required but substituting the name of the database that your installation uses where the default database name has been changed. - Upgrading a mysql installation, the script should then be run through mysql from the command line: /usr/local/mysql/bin/mysql -u weberp_db_user -p weberp_db_pwd < path_to_upgraded_webERP_install/sql/mysql/upgradeXX.X-YY.Y.sql @@ -55,14 +46,12 @@ You will need to remove this yourself - otherwise you will not be able to create shipment charges. Using the new db scripts will of course generate dbs without this foreign key. - NOTES ON UPGRADING FROM 2.9B TO 3.0 There are extensive changes to the database and the upgrade2.9b-3.0.sql may take some time to run depending on how much data there is in the system. A backup of the 2.9b database dump should be taken prior to attempting to run the upgrade script. -IMPORTANT: Note that version of mysql 4.1.8 or greater is required because from the mysql change log: - "Fix two hangs: FOREIGN KEY constraints treated table and database names as case-insensitive. RENAME TABLE t TO T would hang in an endless loop if t had a foreign key constraint defined on it. Fix also a hang over the dictionary mutex that would occur if one tried in ALTER TABLE or RENAME TABLE to create a foreign key constraint name that collided with another existing name. (Bug -#3478)" +IMPORTANT: Note that mysql version 4.1.8 or greater is required because from the mysql change log: + "Fix two hangs: FOREIGN KEY constraints treated table and database names as case-insensitive. RENAME TABLE t TO T would hang in an endless loop if t had a foreign key constraint defined on it. Fix also a hang over the dictionary mutex that would occur if one tried in ALTER TABLE or RENAME TABLE to create a foreign key constraint name that collided with another existing name. (Bug #3478)" NOTES ON UPGRADING FROM 3.01 to 3.02 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |