This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 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: <Ex...@us...> - 2012-02-02 03:31:02
|
Revision: 4862 http://web-erp.svn.sourceforge.net/web-erp/?rev=4862&view=rev Author: ExsonQu Date: 2012-02-02 03:30:56 +0000 (Thu, 02 Feb 2012) Log Message: ----------- Fix bug 'GL entries created not balance' Modified Paths: -------------- trunk/Credit_Invoice.php Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2012-01-31 21:48:58 UTC (rev 4861) +++ trunk/Credit_Invoice.php 2012-02-02 03:30:56 UTC (rev 4862) @@ -1354,7 +1354,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['CreditItems']->DebtorNo . "', - '" . -round($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' + '" . -round(($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting for the credit note could not be inserted because'); @@ -1516,4 +1516,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-02-02 03:31:02
|
Revision: 4862 http://web-erp.svn.sourceforge.net/web-erp/?rev=4862&view=rev Author: ExsonQu Date: 2012-02-02 03:30:56 +0000 (Thu, 02 Feb 2012) Log Message: ----------- Fix bug 'GL entries created not balance' Modified Paths: -------------- trunk/Credit_Invoice.php Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2012-01-31 21:48:58 UTC (rev 4861) +++ trunk/Credit_Invoice.php 2012-02-02 03:30:56 UTC (rev 4862) @@ -1354,7 +1354,7 @@ '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['CreditItems']->DebtorNo . "', - '" . -round($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' + '" . -round(($_SESSION['CreditItems']->total + $_SESSION['CreditItems']->FreightCost + $TaxTotal)/$_SESSION['CurrencyRate'],$_SESSION['CompanyRecord']['decimalplaces']) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting for the credit note could not be inserted because'); @@ -1516,4 +1516,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <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: <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: <dai...@us...> - 2012-01-31 18:46:21
|
Revision: 4860 http://web-erp.svn.sourceforge.net/web-erp/?rev=4860&view=rev Author: daintree Date: 2012-01-31 18:46:10 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fix Modified Paths: -------------- trunk/PO_Items.php Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-01-31 09:26:48 UTC (rev 4859) +++ trunk/PO_Items.php 2012-01-31 18:46:10 UTC (rev 4860) @@ -1126,11 +1126,6 @@ } #end of while loop echo '</table>'; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ - /*$Maximum_Number_Of_Parts_To_Show defined in config.php */ - prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . - _('Please restrict your search to only the parts required'),'info'); - } echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some" /></div>'; }#end if SearchResults to show This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2012-01-31 18:46:21
|
Revision: 4860 http://web-erp.svn.sourceforge.net/web-erp/?rev=4860&view=rev Author: daintree Date: 2012-01-31 18:46:10 +0000 (Tue, 31 Jan 2012) Log Message: ----------- bug fix Modified Paths: -------------- trunk/PO_Items.php Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2012-01-31 09:26:48 UTC (rev 4859) +++ trunk/PO_Items.php 2012-01-31 18:46:10 UTC (rev 4860) @@ -1126,11 +1126,6 @@ } #end of while loop echo '</table>'; - if ($PartsDisplayed == $Maximum_Number_Of_Parts_To_Show){ - /*$Maximum_Number_Of_Parts_To_Show defined in config.php */ - prnMsg( _('Only the first') . ' ' . $Maximum_Number_Of_Parts_To_Show . ' ' . _('can be displayed') . '. ' . - _('Please restrict your search to only the parts required'),'info'); - } echo '<a name="end"></a><br /><div class="centre"><input type="submit" name="NewItem" value="Order some" /></div>'; }#end if SearchResults to show 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: <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 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: <Ex...@us...> - 2012-01-31 04:18:47
|
Revision: 4857 http://web-erp.svn.sourceforge.net/web-erp/?rev=4857&view=rev Author: ExsonQu Date: 2012-01-31 04:18:41 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Bug fix change ?Delete to &Delete Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 21:03:38 UTC (rev 4856) +++ trunk/Payments.php 2012-01-31 04:18:41 UTC (rev 4857) @@ -1070,7 +1070,7 @@ <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->Tag . ' - ' . $TagName . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '&Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> </tr>'; $PaymentTotal += $PaymentItem->Amount; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-31 04:18:47
|
Revision: 4857 http://web-erp.svn.sourceforge.net/web-erp/?rev=4857&view=rev Author: ExsonQu Date: 2012-01-31 04:18:41 +0000 (Tue, 31 Jan 2012) Log Message: ----------- Bug fix change ?Delete to &Delete Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 21:03:38 UTC (rev 4856) +++ trunk/Payments.php 2012-01-31 04:18:41 UTC (rev 4857) @@ -1070,7 +1070,7 @@ <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->Tag . ' - ' . $TagName . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '&Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> </tr>'; $PaymentTotal += $PaymentItem->Amount; } 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-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: <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: <tim...@us...> - 2012-01-30 13:41:02
|
Revision: 4854 http://web-erp.svn.sourceforge.net/web-erp/?rev=4854&view=rev Author: tim_schofield Date: 2012-01-30 13:40:51 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fix incorrectly spelt language name Modified Paths: -------------- trunk/includes/LanguagesArray.php Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2012-01-30 05:02:46 UTC (rev 4853) +++ trunk/includes/LanguagesArray.php 2012-01-30 13:40:51 UTC (rev 4854) @@ -61,7 +61,7 @@ $LanguagesArray['hr_HR.utf8']['DecimalPoint'] = ','; $LanguagesArray['hr_HR.utf8']['ThousandsSeparator'] = ' '; -$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonisian'); +$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonesian'); $LanguagesArray['id_ID.utf8']['WindowsLocale'] = 'indonesian'; $LanguagesArray['id_ID.utf8']['DecimalPoint'] = ','; $LanguagesArray['id_ID.utf8']['ThousandsSeparator'] = '.'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2012-01-30 13:40:57
|
Revision: 4854 http://web-erp.svn.sourceforge.net/web-erp/?rev=4854&view=rev Author: tim_schofield Date: 2012-01-30 13:40:51 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fix incorrectly spelt language name Modified Paths: -------------- trunk/includes/LanguagesArray.php Modified: trunk/includes/LanguagesArray.php =================================================================== --- trunk/includes/LanguagesArray.php 2012-01-30 05:02:46 UTC (rev 4853) +++ trunk/includes/LanguagesArray.php 2012-01-30 13:40:51 UTC (rev 4854) @@ -61,7 +61,7 @@ $LanguagesArray['hr_HR.utf8']['DecimalPoint'] = ','; $LanguagesArray['hr_HR.utf8']['ThousandsSeparator'] = ' '; -$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonisian'); +$LanguagesArray['id_ID.utf8']['LanguageName'] = _('Indonesian'); $LanguagesArray['id_ID.utf8']['WindowsLocale'] = 'indonesian'; $LanguagesArray['id_ID.utf8']['DecimalPoint'] = ','; $LanguagesArray['id_ID.utf8']['ThousandsSeparator'] = '.'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 05:02:52
|
Revision: 4853 http://web-erp.svn.sourceforge.net/web-erp/?rev=4853&view=rev Author: ExsonQu Date: 2012-01-30 05:02:46 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fixed for $_SESSION overwritten Modified Paths: -------------- trunk/PrintCheque.php Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2012-01-30 05:01:35 UTC (rev 4852) +++ trunk/PrintCheque.php 2012-01-30 05:02:46 UTC (rev 4853) @@ -7,7 +7,13 @@ include('includes/DefinePaymentClass.php'); include('includes/session.inc'); - +if (isset($_GET['identifier'])){ + $identifier = $_GET['identifier']; +}else{ + prnMsg(_('Something was wrong without an identifier, please ask administrator for help'),'error'); + include('includes/footer.inc'); + exit; +} include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Print Cheque')); $pdf->addInfo('Subject', _('Print Cheque')); @@ -19,7 +25,7 @@ decimalplaces, currency FROM currencies - WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); @@ -38,8 +44,8 @@ $LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,100,$FontSize,$_GET['ChequeNum'], 'left'); $YPos -= 3*$line_height; -$AmountWords = number_to_words($_SESSION['PaymentDetail']->Amount) . ' ' . $CurrencyName; -$Cents = intval(round(($_SESSION['PaymentDetail']->Amount - intval($_SESSION['PaymentDetail']->Amount))*100,0)); +$AmountWords = number_to_words($_SESSION['PaymentDetail' . $identifier]->Amount) . ' ' . $CurrencyName; +$Cents = intval(round(($_SESSION['PaymentDetail' . $identifier]->Amount - intval($_SESSION['PaymentDetail' . $identifier]->Amount))*100,0)); if ($Cents > 0){ $AmountWords .= ' ' . _('and') . ' ' . strval($Cents) . ' ' . $HundredsName; } else { @@ -48,23 +54,23 @@ $LeftOvers = $pdf->addTextWrap(75,$YPos,475,$FontSize,$AmountWords, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->SuppName, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SuppName, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->Address1, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->Address1, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->Address2, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->Address2, 'left'); $YPos -= 1*$line_height; -$Address3 = $_SESSION['PaymentDetail']->Address3 . ' ' . $_SESSION['PaymentDetail']->Address4 . ' ' . $_SESSION['PaymentDetail']->Address5 . ' ' . $_SESSION['PaymentDetail']->Address6; +$Address3 = $_SESSION['PaymentDetail' . $identifier]->Address3 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address4 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address5 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address6; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $Address3, 'left'); $YPos -= 2*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $AmountWords, 'left'); -$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'right'); +$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'right'); // remittance advice 1 @@ -76,10 +82,10 @@ $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,_('Cheque No.'), 'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,_('Amount'), 'left'); $YPos -= 2*$line_height; -$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); +$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); // remittance advice 2 $YPos -= 15*$line_height; @@ -90,10 +96,10 @@ $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,_('Cheque No.'), 'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,_('Amount'), 'left'); $YPos -= 2*$line_height; -$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); +$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); $pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf'); $pdf->__destruct(); @@ -187,4 +193,4 @@ return $NumberInWords; } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 05:02:52
|
Revision: 4853 http://web-erp.svn.sourceforge.net/web-erp/?rev=4853&view=rev Author: ExsonQu Date: 2012-01-30 05:02:46 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fixed for $_SESSION overwritten Modified Paths: -------------- trunk/PrintCheque.php Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2012-01-30 05:01:35 UTC (rev 4852) +++ trunk/PrintCheque.php 2012-01-30 05:02:46 UTC (rev 4853) @@ -7,7 +7,13 @@ include('includes/DefinePaymentClass.php'); include('includes/session.inc'); - +if (isset($_GET['identifier'])){ + $identifier = $_GET['identifier']; +}else{ + prnMsg(_('Something was wrong without an identifier, please ask administrator for help'),'error'); + include('includes/footer.inc'); + exit; +} include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Print Cheque')); $pdf->addInfo('Subject', _('Print Cheque')); @@ -19,7 +25,7 @@ decimalplaces, currency FROM currencies - WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); If (DB_num_rows($result) == 0){ include ('includes/header.inc'); @@ -38,8 +44,8 @@ $LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,100,$FontSize,$_GET['ChequeNum'], 'left'); $YPos -= 3*$line_height; -$AmountWords = number_to_words($_SESSION['PaymentDetail']->Amount) . ' ' . $CurrencyName; -$Cents = intval(round(($_SESSION['PaymentDetail']->Amount - intval($_SESSION['PaymentDetail']->Amount))*100,0)); +$AmountWords = number_to_words($_SESSION['PaymentDetail' . $identifier]->Amount) . ' ' . $CurrencyName; +$Cents = intval(round(($_SESSION['PaymentDetail' . $identifier]->Amount - intval($_SESSION['PaymentDetail' . $identifier]->Amount))*100,0)); if ($Cents > 0){ $AmountWords .= ' ' . _('and') . ' ' . strval($Cents) . ' ' . $HundredsName; } else { @@ -48,23 +54,23 @@ $LeftOvers = $pdf->addTextWrap(75,$YPos,475,$FontSize,$AmountWords, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-225,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap($Page_Width-75,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->SuppName, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SuppName, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->Address1, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->Address1, 'left'); $YPos -= 1*$line_height; -$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail']->Address2, 'left'); +$LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize,$_SESSION['PaymentDetail' . $identifier]->Address2, 'left'); $YPos -= 1*$line_height; -$Address3 = $_SESSION['PaymentDetail']->Address3 . ' ' . $_SESSION['PaymentDetail']->Address4 . ' ' . $_SESSION['PaymentDetail']->Address5 . ' ' . $_SESSION['PaymentDetail']->Address6; +$Address3 = $_SESSION['PaymentDetail' . $identifier]->Address3 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address4 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address5 . ' ' . $_SESSION['PaymentDetail' . $identifier]->Address6; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $Address3, 'left'); $YPos -= 2*$line_height; $LeftOvers = $pdf->addTextWrap(75,$YPos,300,$FontSize, $AmountWords, 'left'); -$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'right'); +$LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'right'); // remittance advice 1 @@ -76,10 +82,10 @@ $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,_('Cheque No.'), 'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,_('Amount'), 'left'); $YPos -= 2*$line_height; -$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); +$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); // remittance advice 2 $YPos -= 15*$line_height; @@ -90,10 +96,10 @@ $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,_('Cheque No.'), 'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,_('Amount'), 'left'); $YPos -= 2*$line_height; -$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail']->DatePaid, 'left'); -$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); +$LeftOvers = $pdf->addTextWrap(25,$YPos,75,$FontSize,$_SESSION['PaymentDetail' . $identifier]->DatePaid, 'left'); +$LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail' . $identifier]->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail']->Amount,$CurrDecimalPlaces), 'left'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,locale_number_format($_SESSION['PaymentDetail' . $identifier]->Amount,$CurrDecimalPlaces), 'left'); $pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf'); $pdf->__destruct(); @@ -187,4 +193,4 @@ return $NumberInWords; } -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 05:01:41
|
Revision: 4852 http://web-erp.svn.sourceforge.net/web-erp/?rev=4852&view=rev Author: ExsonQu Date: 2012-01-30 05:01:35 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fixed for $_SESSION overwritten to print Cheque Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 01:15:22 UTC (rev 4851) +++ trunk/Payments.php 2012-01-30 05:01:35 UTC (rev 4852) @@ -278,7 +278,7 @@ // it is a supplier payment by cheque and haven't printed yet so print cheque echo '<br /> - <a href="' . $rootpath . '/PrintCheque.php?ChequeNum=' . $_POST['ChequeNum'] . '">' . _('Print Cheque using pre-printed stationery') . '</a> + <a href="' . $rootpath . '/PrintCheque.php?ChequeNum=' . $_POST['ChequeNum'] . '&identifier=' . $identifier . '">' . _('Print Cheque using pre-printed stationery') . '</a> <br /> <br />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 05:01:41
|
Revision: 4852 http://web-erp.svn.sourceforge.net/web-erp/?rev=4852&view=rev Author: ExsonQu Date: 2012-01-30 05:01:35 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fixed for $_SESSION overwritten to print Cheque Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-30 01:15:22 UTC (rev 4851) +++ trunk/Payments.php 2012-01-30 05:01:35 UTC (rev 4852) @@ -278,7 +278,7 @@ // it is a supplier payment by cheque and haven't printed yet so print cheque echo '<br /> - <a href="' . $rootpath . '/PrintCheque.php?ChequeNum=' . $_POST['ChequeNum'] . '">' . _('Print Cheque using pre-printed stationery') . '</a> + <a href="' . $rootpath . '/PrintCheque.php?ChequeNum=' . $_POST['ChequeNum'] . '&identifier=' . $identifier . '">' . _('Print Cheque using pre-printed stationery') . '</a> <br /> <br />'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 01:15:30
|
Revision: 4851 http://web-erp.svn.sourceforge.net/web-erp/?rev=4851&view=rev Author: ExsonQu Date: 2012-01-30 01:15:22 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fix for $_SESSION overwritten problem with $identifier variable and minor html modification Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-29 09:42:44 UTC (rev 4850) +++ trunk/Payments.php 2012-01-30 01:15:22 UTC (rev 4851) @@ -16,15 +16,20 @@ include('includes/footer.inc'); exit(); } - +if (empty($_GET['identifier'])){ + /*unique session identifier to ensure that there is no conflict with other order enty session on the same machine */ + $identifier=date('U'); +}else{ + $identifier=$_GET['identifier'];//edit GLItems +} if (isset($_GET['NewPayment']) AND $_GET['NewPayment']=='Yes'){ - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); } -if (!isset($_SESSION['PaymentDetail'])){ - $_SESSION['PaymentDetail'] = new Payment; - $_SESSION['PaymentDetail']->GLItemCounter = 1; +if (!isset($_SESSION['PaymentDetail' . $identifier])){ + $_SESSION['PaymentDetail' . $identifier] = new Payment; + $_SESSION['PaymentDetail' . $identifier]->GLItemCounter = 1; } if ((isset($_POST['UpdateHeader']) @@ -49,10 +54,10 @@ if (isset($_GET['SupplierID'])){ /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); - $_SESSION['PaymentDetail'] = new Payment; - $_SESSION['PaymentDetail']->GLItemCounter = 1; + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); + $_SESSION['PaymentDetail' . $identifier] = new Payment; + $_SESSION['PaymentDetail' . $identifier]->GLItemCounter = 1; $SQL= "SELECT suppname, @@ -75,16 +80,16 @@ } else { $myrow = DB_fetch_array($Result); if ($myrow['factorcompanyid'] == 0) { - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname']; - $_SESSION['PaymentDetail']->Address1 = $myrow['address1']; - $_SESSION['PaymentDetail']->Address2 = $myrow['address2']; - $_SESSION['PaymentDetail']->Address3 = $myrow['address3']; - $_SESSION['PaymentDetail']->Address4 = $myrow['address4']; - $_SESSION['PaymentDetail']->Address5 = $myrow['address5']; - $_SESSION['PaymentDetail']->Address6 = $myrow['address6']; - $_SESSION['PaymentDetail']->SupplierID = $_GET['SupplierID']; - $_SESSION['PaymentDetail']->Currency = $myrow['currcode']; - $_POST['Currency'] = $_SESSION['PaymentDetail']->Currency; + $_SESSION['PaymentDetail' . $identifier]->SuppName = $myrow['suppname']; + $_SESSION['PaymentDetail' . $identifier]->Address1 = $myrow['address1']; + $_SESSION['PaymentDetail' . $identifier]->Address2 = $myrow['address2']; + $_SESSION['PaymentDetail' . $identifier]->Address3 = $myrow['address3']; + $_SESSION['PaymentDetail' . $identifier]->Address4 = $myrow['address4']; + $_SESSION['PaymentDetail' . $identifier]->Address5 = $myrow['address5']; + $_SESSION['PaymentDetail' . $identifier]->Address6 = $myrow['address6']; + $_SESSION['PaymentDetail' . $identifier]->SupplierID = $_GET['SupplierID']; + $_SESSION['PaymentDetail' . $identifier]->Currency = $myrow['currcode']; + $_POST['Currency'] = $_SESSION['PaymentDetail' . $identifier]->Currency; } else { $factorsql= "SELECT coyname, @@ -99,23 +104,23 @@ $FactorResult = DB_query($factorsql, $db); $myfactorrow = DB_fetch_array($FactorResult); - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; - $_SESSION['PaymentDetail']->Address1 = $myfactorrow['address1']; - $_SESSION['PaymentDetail']->Address2 = $myfactorrow['address2']; - $_SESSION['PaymentDetail']->Address3 = $myfactorrow['address3']; - $_SESSION['PaymentDetail']->Address4 = $myfactorrow['address4']; - $_SESSION['PaymentDetail']->Address5 = $myfactorrow['address5']; - $_SESSION['PaymentDetail']->Address6 = $myfactorrow['address6']; - $_SESSION['PaymentDetail']->SupplierID = $_GET['SupplierID']; - $_SESSION['PaymentDetail']->Currency = $myrow['currcode']; - $_POST['Currency'] = $_SESSION['PaymentDetail']->Currency; + $_SESSION['PaymentDetail' . $identifier]->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; + $_SESSION['PaymentDetail' . $identifier]->Address1 = $myfactorrow['address1']; + $_SESSION['PaymentDetail' . $identifier]->Address2 = $myfactorrow['address2']; + $_SESSION['PaymentDetail' . $identifier]->Address3 = $myfactorrow['address3']; + $_SESSION['PaymentDetail' . $identifier]->Address4 = $myfactorrow['address4']; + $_SESSION['PaymentDetail' . $identifier]->Address5 = $myfactorrow['address5']; + $_SESSION['PaymentDetail' . $identifier]->Address6 = $myfactorrow['address6']; + $_SESSION['PaymentDetail' . $identifier]->SupplierID = $_GET['SupplierID']; + $_SESSION['PaymentDetail' . $identifier]->Currency = $myrow['currcode']; + $_POST['Currency'] = $_SESSION['PaymentDetail' . $identifier]->Currency; } } } if (isset($_POST['BankAccount']) AND $_POST['BankAccount']!=''){ - $_SESSION['PaymentDetail']->Account=$_POST['BankAccount']; + $_SESSION['PaymentDetail' . $identifier]->Account=$_POST['BankAccount']; /*Get the bank account currency and set that too */ $ErrMsg = _('Could not get the currency of the bank account'); $result = DB_query("SELECT currcode, @@ -127,41 +132,41 @@ $ErrMsg); $myrow = DB_fetch_array($result); - $_SESSION['PaymentDetail']->AccountCurrency=$myrow['currcode']; - $_SESSION['PaymentDetail']->CurrDecimalPlaces=$myrow['decimalplaces']; + $_SESSION['PaymentDetail' . $identifier]->AccountCurrency=$myrow['currcode']; + $_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces=$myrow['decimalplaces']; } else { - $_SESSION['PaymentDetail']->AccountCurrency =$_SESSION['CompanyRecord']['currencydefault']; - $_SESSION['PaymentDetail']->CurrDecimalPlaces=$_SESSION['CompanyRecord']['decimalplaces']; + $_SESSION['PaymentDetail' . $identifier]->AccountCurrency =$_SESSION['CompanyRecord']['currencydefault']; + $_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces=$_SESSION['CompanyRecord']['decimalplaces']; } if (isset($_POST['DatePaid']) AND $_POST['DatePaid']!='' AND Is_Date($_POST['DatePaid'])){ - $_SESSION['PaymentDetail']->DatePaid=$_POST['DatePaid']; + $_SESSION['PaymentDetail' . $identifier]->DatePaid=$_POST['DatePaid']; } if (isset($_POST['ExRate']) AND $_POST['ExRate']!=''){ - $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency } if (isset($_POST['FunctionalExRate']) AND $_POST['FunctionalExRate']!=''){ - $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between payment currency and account currency } if (isset($_POST['Paymenttype']) AND $_POST['Paymenttype']!=''){ - $_SESSION['PaymentDetail']->Paymenttype = $_POST['Paymenttype']; + $_SESSION['PaymentDetail' . $identifier]->Paymenttype = $_POST['Paymenttype']; } if (isset($_POST['Currency']) AND $_POST['Currency']!=''){ - $_SESSION['PaymentDetail']->Currency=$_POST['Currency']; //payment currency + $_SESSION['PaymentDetail' . $identifier]->Currency=$_POST['Currency']; //payment currency /*Get the exchange rate between the functional currency and the payment currency*/ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); $myrow = DB_fetch_row($result); $tableExRate = $myrow[0]; //this is the rate of exchange between the functional currency and the payment currency - if ($_POST['Currency']==$_SESSION['PaymentDetail']->AccountCurrency){ + if ($_POST['Currency']==$_SESSION['PaymentDetail' . $identifier]->AccountCurrency){ $_POST['ExRate']=1; - $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency $SuggestedExRate=1; } - if ($_SESSION['PaymentDetail']->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ + if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ $_POST['FunctionalExRate']=1; - $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); + $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); $SuggestedExRate = $tableExRate; $SuggestedFunctionalExRate =1; @@ -176,12 +181,12 @@ */ /*Get suggested FunctionalExRate */ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->AccountCurrency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . "'",$db); $myrow = DB_fetch_row($result); $SuggestedFunctionalExRate = $myrow[0]; /*Get the exchange rate between the functional currency and the payment currency*/ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); $myrow = DB_fetch_row($result); $tableExRate = $myrow[0]; //this is the rate of exchange between the functional currency and the payment currency /*Calculate cross rate to suggest appropriate exchange rate between payment currency and account currency */ @@ -192,20 +197,20 @@ if (isset($_POST['Narrative']) AND $_POST['Narrative']!=''){ - $_SESSION['PaymentDetail']->Narrative=$_POST['Narrative']; + $_SESSION['PaymentDetail' . $identifier]->Narrative=$_POST['Narrative']; } if (isset($_POST['Amount']) AND $_POST['Amount']!=''){ - $_SESSION['PaymentDetail']->Amount=filter_number_format($_POST['Amount']); + $_SESSION['PaymentDetail' . $identifier]->Amount=filter_number_format($_POST['Amount']); } else { - if (!isset($_SESSION['PaymentDetail']->Amount)) { - $_SESSION['PaymentDetail']->Amount=0; + if (!isset($_SESSION['PaymentDetail' . $identifier]->Amount)) { + $_SESSION['PaymentDetail' . $identifier]->Amount=0; } } if (isset($_POST['Discount']) AND $_POST['Discount']!=''){ - $_SESSION['PaymentDetail']->Discount=filter_number_format($_POST['Discount']); + $_SESSION['PaymentDetail' . $identifier]->Discount=filter_number_format($_POST['Discount']); } else { - if (!isset($_SESSION['PaymentDetail']->Discount)) { - $_SESSION['PaymentDetail']->Discount=0; + if (!isset($_SESSION['PaymentDetail' . $identifier]->Discount)) { + $_SESSION['PaymentDetail' . $identifier]->Discount=0; } } @@ -227,12 +232,12 @@ /*First off check we have an amount entered as paid ?? */ $TotalAmount =0; - foreach ($_SESSION['PaymentDetail']->GLItems AS $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems AS $PaymentItem) { $TotalAmount += $PaymentItem->Amount; } if ($TotalAmount==0 AND - ($_SESSION['PaymentDetail']->Discount + $_SESSION['PaymentDetail']->Amount)/$_SESSION['PaymentDetail']->ExRate ==0){ + ($_SESSION['PaymentDetail' . $identifier]->Discount + $_SESSION['PaymentDetail' . $identifier]->Amount)/$_SESSION['PaymentDetail' . $identifier]->ExRate ==0){ prnMsg( _('This payment has no amounts entered and will not be processed'),'warn'); include('includes/footer.inc'); exit; @@ -258,11 +263,11 @@ $i++; } - $PeriodNo = GetPeriod($_SESSION['PaymentDetail']->DatePaid,$db); + $PeriodNo = GetPeriod($_SESSION['PaymentDetail' . $identifier]->DatePaid,$db); $sql="SELECT usepreprintedstationery FROM paymentmethods - WHERE paymentname='" . $_SESSION['PaymentDetail']->Paymenttype ."'"; + WHERE paymentname='" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype ."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -277,7 +282,7 @@ <br /> <br />'; - echo '<form method=post action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; + echo '<form method=post action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Has the cheque been printed') . '? <br /> @@ -287,7 +292,7 @@ <input type="submit" name="ChequePrinted" value="' . _('Yes / Continue') . '" /> <input type="submit" name="PaymentCancelled" value="' . _('No / Cancel Payment') . '" />'; - echo '<br />Payment amount = ' . $_SESSION['PaymentDetail']->Amount; + echo '<br />Payment amount = ' . $_SESSION['PaymentDetail' . $identifier]->Amount; } else { @@ -296,7 +301,7 @@ $result = DB_Txn_Begin($db); - if ($_SESSION['PaymentDetail']->SupplierID=='') { + if ($_SESSION['PaymentDetail' . $identifier]->SupplierID=='') { //its a nominal bank transaction type 1 @@ -305,7 +310,7 @@ if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then enter GLTrans */ $TotalAmount=0; - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { /*The functional currency amount will be the payment currenct amount / the bank account currency exchange rate - to get to the bank account currency @@ -322,11 +327,11 @@ tag) "; $SQL= $SQL . "VALUES (1, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $PaymentItem->GLCode . "', '" . $PaymentItem->Narrative . "', - '" . ($PaymentItem->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "', + '" . ($PaymentItem->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "', '". $PaymentItem->Cheque ."', '" . $PaymentItem->Tag . "' )"; @@ -335,13 +340,13 @@ $TotalAmount += $PaymentItem->Amount; } - $_SESSION['PaymentDetail']->Amount = $TotalAmount; - $_SESSION['PaymentDetail']->Discount=0; + $_SESSION['PaymentDetail' . $identifier]->Amount = $TotalAmount; + $_SESSION['PaymentDetail' . $identifier]->Discount=0; } //Run through the GL postings to check to see if there is a posting to another bank account (or the same one) if there is then a receipt needs to be created for this account too - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { if (in_array($PaymentItem->GLCode, $BankAccounts)) { @@ -357,9 +362,9 @@ $TrfToBankCurrCode = $TrfToBankRow['currcode']; $TrfToBankExRate = $TrfToBankRow['rate']; - if ($_SESSION['PaymentDetail']->AccountCurrency == $TrfToBankCurrCode){ + if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency == $TrfToBankCurrCode){ /*Make sure to use the same rate if the transfer is between two bank accounts in the same currency */ - $TrfToBankExRate = $_SESSION['PaymentDetail']->FunctionalExRate; + $TrfToBankExRate = $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate; } /*Consider an example @@ -403,13 +408,13 @@ VALUES ('" . $ReceiptTransNo . "', 2, '" . $PaymentItem->GLCode . "', - '" . _('Act Transfer From ') . $_SESSION['PaymentDetail']->Account . ' - ' . $PaymentItem->Narrative . "', - '" . (($_SESSION['PaymentDetail']->ExRate * $_SESSION['PaymentDetail']->FunctionalExRate)/$TrfToBankExRate). "', + '" . _('Act Transfer From ') . $_SESSION['PaymentDetail' . $identifier]->Account . ' - ' . $PaymentItem->Narrative . "', + '" . (($_SESSION['PaymentDetail' . $identifier]->ExRate * $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate)/$TrfToBankExRate). "', '" . $TrfToBankExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', '" . $PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction with the SQL'); @@ -419,7 +424,7 @@ } } else { /*Its a supplier payment type 22 */ - $CreditorTotal = (($_SESSION['PaymentDetail']->Discount + $_SESSION['PaymentDetail']->Amount)/$_SESSION['PaymentDetail']->ExRate)/$_SESSION['PaymentDetail']->FunctionalExRate; + $CreditorTotal = (($_SESSION['PaymentDetail' . $identifier]->Discount + $_SESSION['PaymentDetail' . $identifier]->Amount)/$_SESSION['PaymentDetail' . $identifier]->ExRate)/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate; $TransNo = GetNextTransNo(22, $db); $TransType = 22; @@ -436,13 +441,13 @@ transtext) "; $SQL = $SQL . "valueS ('" . $TransNo . "', 22, - '" . $_SESSION['PaymentDetail']->SupplierID . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . date('Y-m-d H-i-s') . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . ($_SESSION['PaymentDetail']->FunctionalExRate/$_SESSION['PaymentDetail']->ExRate) . "', - '" . (-$_SESSION['PaymentDetail']->Amount-$_SESSION['PaymentDetail']->Discount) . "', - '" . $_SESSION['PaymentDetail']->Narrative . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', + '" . ($_SESSION['PaymentDetail' . $identifier]->FunctionalExRate/$_SESSION['PaymentDetail' . $identifier]->ExRate) . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Amount-$_SESSION['PaymentDetail' . $identifier]->Discount) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "' )"; $ErrMsg = _('Cannot insert a payment transaction against the supplier because'); @@ -451,9 +456,9 @@ /*Update the supplier master with the date and amount of the last payment made */ $SQL = "UPDATE suppliers - SET lastpaiddate = '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - lastpaid='" . $_SESSION['PaymentDetail']->Amount ."' - WHERE suppliers.supplierid='" . $_SESSION['PaymentDetail']->SupplierID . "'"; + SET lastpaiddate = '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + lastpaid='" . $_SESSION['PaymentDetail' . $identifier]->Amount ."' + WHERE suppliers.supplierid='" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "'"; @@ -461,7 +466,7 @@ $DbgMsg = _('Cannot update the supplier record for the date of the last payment made using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . '-' . $_SESSION['PaymentDetail']->Narrative; + $_SESSION['PaymentDetail' . $identifier]->Narrative = $_SESSION['PaymentDetail' . $identifier]->SupplierID . '-' . $_SESSION['PaymentDetail' . $identifier]->Narrative; if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the supplier control GLTrans */ /* Now debit creditors account with payment + discount */ @@ -475,16 +480,16 @@ amount) "; $SQL=$SQL . "VALUES (22, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['creditorsact'] . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', '" . $CreditorTotal . "')"; $ErrMsg = _('Cannot insert a GL transaction for the creditors account debit because'); $DbgMsg = _('Cannot insert a GL transaction for the creditors account debit using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - if ($_SESSION['PaymentDetail']->Discount !=0){ + if ($_SESSION['PaymentDetail' . $identifier]->Discount !=0){ /* Now credit Discount received account with discounts */ $SQL="INSERT INTO gltrans ( type, typeno, @@ -495,11 +500,11 @@ amount) VALUES (22, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['pytdiscountact'] . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Discount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Discount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "' )"; $ErrMsg = _('Cannot insert a GL transaction for the payment discount credit because'); $DbgMsg = _('Cannot insert a GL transaction for the payment discount credit using the SQL'); @@ -511,7 +516,7 @@ if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the common GLTrans */ - if ($_SESSION['PaymentDetail']->Amount !=0){ + if ($_SESSION['PaymentDetail' . $identifier]->Amount !=0){ /* Bank account entry first */ $SQL = "INSERT INTO gltrans ( type, typeno, @@ -522,11 +527,11 @@ amount) VALUES ('" . $TransType . "', '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "')"; $ErrMsg = _('Cannot insert a GL transaction for the bank account credit because'); $DbgMsg = _('Cannot insert a GL transaction for the bank account credit using the SQL'); @@ -550,21 +555,21 @@ currcode) VALUES ('" . $TransNo . "', '" . $TransType . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . -$_SESSION['PaymentDetail']->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->ExRate . "', + '" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', + '" . -$_SESSION['PaymentDetail' . $identifier]->Amount . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } else { - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { $SQL="INSERT INTO banktrans (transno, type, bankact, @@ -577,14 +582,14 @@ currcode) VALUES ('" . $TransNo . "', '" . $TransType . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->ExRate . "', + '" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', '" . -$PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' )"; + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); @@ -595,7 +600,7 @@ DB_Txn_Commit($db); prnMsg(_('Payment') . ' ' . $TransNo . ' ' . _('has been successfully entered'),'success'); - $LastSupplier = ($_SESSION['PaymentDetail']->SupplierID); + $LastSupplier = ($_SESSION['PaymentDetail' . $identifier]->SupplierID); unset($_POST['BankAccount']); unset($_POST['DatePaid']); @@ -605,8 +610,8 @@ unset($_POST['Narrative']); unset($_POST['Amount']); unset($_POST['Discount']); - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); /*Set up a newy in case user wishes to enter another */ if (isset($LastSupplier) and $LastSupplier!='') { @@ -617,7 +622,7 @@ echo '<br /><a href="' . $rootpath . '/Payments.php?SupplierID=' . $LastSupplier . '">' . _('Enter another Payment for') . ' ' . $myrow['suppname'] . '</a>'; } else { - echo '<br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Enter another General Ledger Payment') . '</a><br />'; + echo '<br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Enter another General Ledger Payment') . '</a><br />'; } } @@ -626,7 +631,7 @@ } elseif (isset($_GET['Delete'])){ /* User hit delete the receipt entry from the batch */ - $_SESSION['PaymentDetail']->Remove_GLItem($_GET['Delete']); + $_SESSION['PaymentDetail' . $identifier]->Remove_GLItem($_GET['Delete']); } elseif (isset($_POST['Process']) AND !$BankAccountEmpty){ //user hit submit a new GL Analysis line into the payment @@ -648,7 +653,7 @@ prnMsg( _('The Cheque/Voucher number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); } else { $myrow = DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], @@ -664,7 +669,7 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], @@ -690,14 +695,14 @@ if (isset($_POST['DatePaid']) AND ($_POST['DatePaid']=='' - OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ + OR !Is_Date($_SESSION['PaymentDetail' . $identifier]->DatePaid))){ $_POST['DatePaid']= Date($_SESSION['DefaultDateFormat']); - $_SESSION['PaymentDetail']->DatePaid = $_POST['DatePaid']; + $_SESSION['PaymentDetail' . $identifier]->DatePaid = $_POST['DatePaid']; } -if ($_SESSION['PaymentDetail']->Currency=='' AND $_SESSION['PaymentDetail']->SupplierID==''){ - $_SESSION['PaymentDetail']->Currency=$_SESSION['CompanyRecord']['currencydefault']; +if ($_SESSION['PaymentDetail' . $identifier]->Currency=='' AND $_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ + $_SESSION['PaymentDetail' . $identifier]->Currency=$_SESSION['CompanyRecord']['currencydefault']; } @@ -715,29 +720,29 @@ if (DB_num_rows($result)==1){ $myrow = DB_fetch_row($result); - $_SESSION['PaymentDetail']->BankAccountName = $myrow[0]; + $_SESSION['PaymentDetail' . $identifier]->BankAccountName = $myrow[0]; unset($result); } elseif (DB_num_rows($result)==0){ prnMsg( _('The bank account number') . ' ' . $_POST['BankAccount'] . ' ' . _('is not set up as a bank account with a valid general ledger account'),'error'); } } -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; echo '<tr><th colspan="4"><font size="3" color="blue">' . _('Payment'); -if ($_SESSION['PaymentDetail']->SupplierID!=''){ - echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail']->SuppName; +if ($_SESSION['PaymentDetail' . $identifier]->SupplierID!=''){ + echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifer]->SuppName; } -if ($_SESSION['PaymentDetail']->BankAccountName!=''){ - echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail']->BankAccountName; +if ($_SESSION['PaymentDetail' . $identifier]->BankAccountName!=''){ + echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail' . $identifier]->BankAccountName; } -echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail']->DatePaid . '</font></th></tr>'; +echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail' . $identifier]->DatePaid . '</font></th></tr>'; $SQL = "SELECT bankaccountname, bankaccounts.accountcode, @@ -777,11 +782,11 @@ echo '<tr> <td>' . _('Date Paid') . ':</td> - <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '" /></td> + <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail' . $identifier]->DatePaid . '" /></td> </tr>'; -if ($_SESSION['PaymentDetail']->SupplierID==''){ +if ($_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ echo '<tr><td>' . _('Currency of Payment') . ':</td> <td><select name="Currency" onChange="ReloadForm(UpdateHeader)">'; $SQL = "SELECT currency, currabrev, rate FROM currencies"; @@ -793,7 +798,7 @@ prnMsg( _('No currencies are defined yet. Payments cannot be entered until a currency is defined'),'error'); } else { while ($myrow=DB_fetch_array($result)){ - if ($_SESSION['PaymentDetail']->Currency==$myrow['currabrev']){ + if ($_SESSION['PaymentDetail' . $identifier]->Currency==$myrow['currabrev']){ echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } else { echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; @@ -806,17 +811,16 @@ } else { /*its a supplier payment so it must be in the suppliers currency */ echo '<tr> <td>' . _('Supplier Currency') . ':</td> - <td>' . $_SESSION['PaymentDetail']->Currency . '</td> + <td>' . $_SESSION['PaymentDetail' . $identifier]->Currency . '</td> </tr>'; - echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '" />'; + echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail' . $identifier]->Currency . '" />'; /*get the default rate from the currency table if it has not been set */ if (!isset($_POST['ExRate']) OR $_POST['ExRate']==''){ - $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency ."'"; + $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency ."'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_row($Result); $_POST['ExRate']=locale_number_format($myrow[0],'Variable'); } - } if (!isset($_POST['ExRate'])){ @@ -826,7 +830,7 @@ if (!isset($_POST['FunctionalExRate'])){ $_POST['FunctionalExRate']=1; } -if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['PaymentDetail']->Currency AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ +if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency!=$_SESSION['PaymentDetail' . $identifier]->Currency AND isset($_SESSION['PaymentDetail' . $identifier]->AccountCurrency)){ if (isset($SuggestedExRate)){ $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,6) . '</b>'; } else { @@ -838,12 +842,12 @@ echo '<tr> <td>' . _('Payment Exchange Rate') . ':</td> <td><input class="number" type="text" name="ExRate" maxlength="10" size="12" value="' . $_POST['ExRate'] . '" /></td> - <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td> + <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail' . $identifier]->Currency . '</i></td> </tr>'; } -if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] - AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ +if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] + AND isset($_SESSION['PaymentDetail' . $identifier]->AccountCurrency)){ if (isset($SuggestedFunctionalExRate)){ $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,6) . '</b>'; } else { @@ -855,7 +859,7 @@ echo '<tr> <td>' . _('Functional Exchange Rate') . ':</td> <td><input type="text" name="FunctionalExRate" maxlength="10" size="12" value="' . $_POST['FunctionalExRate'] . '" /></td> - <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td> + <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . '</i></td> </tr>'; } echo '<tr> @@ -902,7 +906,7 @@ echo '</table><br />'; -if ($_SESSION['CompanyRecord']['gllink_creditors']==1 AND $_SESSION['PaymentDetail']->SupplierID==''){ +if ($_SESSION['CompanyRecord']['gllink_creditors']==1 AND $_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ /* Set upthe form for the transaction entry for a GL Payment Analysis item */ echo '<br /><table class="selection">'; @@ -1023,11 +1027,11 @@ if (isset($_POST['GLAmount'])) { echo '<tr> - <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . '):</td> <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value="' . $_POST['GLAmount'] . '" /></td> </tr>'; } else { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . '):</td> <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" /></td> </tr>'; } @@ -1038,19 +1042,19 @@ <input type="submit" name="Cancel" value="' . _('Cancel') . '" /> </div>'; - if (sizeOf($_SESSION['PaymentDetail']->GLItems)>0) { + if (sizeOf($_SESSION['PaymentDetail' . $identifier]->GLItems)>0) { echo '<br /> <table class="selection"> <tr> <th>' . _('Cheque No').'</th> - <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> + <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . ')</th> <th>' . _('GL Account') . '</th> <th>' . _('Narrative') . '</th> <th>' . _('Tag') . '</th> </tr>'; $PaymentTotal = 0; - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { $Tagsql="SELECT tagdescription from tags where tagref='" . $PaymentItem->Tag . "'"; $TagResult=DB_query($Tagsql, $db); $TagMyrow=DB_fetch_row($TagResult); @@ -1062,17 +1066,17 @@ echo '<tr> <td>' . $PaymentItem->Cheque . '</td> - <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces) . '</td> <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->Tag . ' - ' . $TagName . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> </tr>'; $PaymentTotal += $PaymentItem->Amount; } echo '<tr> <td></td> - <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td> + <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces) . '</b></td> <td></td> <td></td> <td></td> @@ -1088,16 +1092,16 @@ echo '<table class="selection"> <tr> - <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> - <td><input class="number" type="text" name="Amount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Amount . '" /></td> + <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail' . $identifier]->Currency . ':</td> + <td><input class="number" type="text" name="Amount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail' . $identifier]->Amount . '" /></td> </tr>'; - if (isset($_SESSION['PaymentDetail']->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ + if (isset($_SESSION['PaymentDetail' . $identifier]->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ echo '<tr> <td>' . _('Amount of Discount') . ':</td> - <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Discount . '" /></td> + <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail' . $identifier]->Discount . '" /></td> </tr>'; - echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail']->SuppName . '" />'; + echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail' . $identifier]->SuppName . '" />'; } else { echo '<input type="hidden" name="Discount" Value="0" />'; } @@ -1107,4 +1111,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ex...@us...> - 2012-01-30 01:15:30
|
Revision: 4851 http://web-erp.svn.sourceforge.net/web-erp/?rev=4851&view=rev Author: ExsonQu Date: 2012-01-30 01:15:22 +0000 (Mon, 30 Jan 2012) Log Message: ----------- Fix for $_SESSION overwritten problem with $identifier variable and minor html modification Modified Paths: -------------- trunk/Payments.php Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2012-01-29 09:42:44 UTC (rev 4850) +++ trunk/Payments.php 2012-01-30 01:15:22 UTC (rev 4851) @@ -16,15 +16,20 @@ include('includes/footer.inc'); exit(); } - +if (empty($_GET['identifier'])){ + /*unique session identifier to ensure that there is no conflict with other order enty session on the same machine */ + $identifier=date('U'); +}else{ + $identifier=$_GET['identifier'];//edit GLItems +} if (isset($_GET['NewPayment']) AND $_GET['NewPayment']=='Yes'){ - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); } -if (!isset($_SESSION['PaymentDetail'])){ - $_SESSION['PaymentDetail'] = new Payment; - $_SESSION['PaymentDetail']->GLItemCounter = 1; +if (!isset($_SESSION['PaymentDetail' . $identifier])){ + $_SESSION['PaymentDetail' . $identifier] = new Payment; + $_SESSION['PaymentDetail' . $identifier]->GLItemCounter = 1; } if ((isset($_POST['UpdateHeader']) @@ -49,10 +54,10 @@ if (isset($_GET['SupplierID'])){ /*The page was called with a supplierID check it is valid and default the inputs for Supplier Name and currency of payment */ - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); - $_SESSION['PaymentDetail'] = new Payment; - $_SESSION['PaymentDetail']->GLItemCounter = 1; + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); + $_SESSION['PaymentDetail' . $identifier] = new Payment; + $_SESSION['PaymentDetail' . $identifier]->GLItemCounter = 1; $SQL= "SELECT suppname, @@ -75,16 +80,16 @@ } else { $myrow = DB_fetch_array($Result); if ($myrow['factorcompanyid'] == 0) { - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname']; - $_SESSION['PaymentDetail']->Address1 = $myrow['address1']; - $_SESSION['PaymentDetail']->Address2 = $myrow['address2']; - $_SESSION['PaymentDetail']->Address3 = $myrow['address3']; - $_SESSION['PaymentDetail']->Address4 = $myrow['address4']; - $_SESSION['PaymentDetail']->Address5 = $myrow['address5']; - $_SESSION['PaymentDetail']->Address6 = $myrow['address6']; - $_SESSION['PaymentDetail']->SupplierID = $_GET['SupplierID']; - $_SESSION['PaymentDetail']->Currency = $myrow['currcode']; - $_POST['Currency'] = $_SESSION['PaymentDetail']->Currency; + $_SESSION['PaymentDetail' . $identifier]->SuppName = $myrow['suppname']; + $_SESSION['PaymentDetail' . $identifier]->Address1 = $myrow['address1']; + $_SESSION['PaymentDetail' . $identifier]->Address2 = $myrow['address2']; + $_SESSION['PaymentDetail' . $identifier]->Address3 = $myrow['address3']; + $_SESSION['PaymentDetail' . $identifier]->Address4 = $myrow['address4']; + $_SESSION['PaymentDetail' . $identifier]->Address5 = $myrow['address5']; + $_SESSION['PaymentDetail' . $identifier]->Address6 = $myrow['address6']; + $_SESSION['PaymentDetail' . $identifier]->SupplierID = $_GET['SupplierID']; + $_SESSION['PaymentDetail' . $identifier]->Currency = $myrow['currcode']; + $_POST['Currency'] = $_SESSION['PaymentDetail' . $identifier]->Currency; } else { $factorsql= "SELECT coyname, @@ -99,23 +104,23 @@ $FactorResult = DB_query($factorsql, $db); $myfactorrow = DB_fetch_array($FactorResult); - $_SESSION['PaymentDetail']->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; - $_SESSION['PaymentDetail']->Address1 = $myfactorrow['address1']; - $_SESSION['PaymentDetail']->Address2 = $myfactorrow['address2']; - $_SESSION['PaymentDetail']->Address3 = $myfactorrow['address3']; - $_SESSION['PaymentDetail']->Address4 = $myfactorrow['address4']; - $_SESSION['PaymentDetail']->Address5 = $myfactorrow['address5']; - $_SESSION['PaymentDetail']->Address6 = $myfactorrow['address6']; - $_SESSION['PaymentDetail']->SupplierID = $_GET['SupplierID']; - $_SESSION['PaymentDetail']->Currency = $myrow['currcode']; - $_POST['Currency'] = $_SESSION['PaymentDetail']->Currency; + $_SESSION['PaymentDetail' . $identifier]->SuppName = $myrow['suppname'] . ' ' . _('care of') . ' ' . $myfactorrow['coyname']; + $_SESSION['PaymentDetail' . $identifier]->Address1 = $myfactorrow['address1']; + $_SESSION['PaymentDetail' . $identifier]->Address2 = $myfactorrow['address2']; + $_SESSION['PaymentDetail' . $identifier]->Address3 = $myfactorrow['address3']; + $_SESSION['PaymentDetail' . $identifier]->Address4 = $myfactorrow['address4']; + $_SESSION['PaymentDetail' . $identifier]->Address5 = $myfactorrow['address5']; + $_SESSION['PaymentDetail' . $identifier]->Address6 = $myfactorrow['address6']; + $_SESSION['PaymentDetail' . $identifier]->SupplierID = $_GET['SupplierID']; + $_SESSION['PaymentDetail' . $identifier]->Currency = $myrow['currcode']; + $_POST['Currency'] = $_SESSION['PaymentDetail' . $identifier]->Currency; } } } if (isset($_POST['BankAccount']) AND $_POST['BankAccount']!=''){ - $_SESSION['PaymentDetail']->Account=$_POST['BankAccount']; + $_SESSION['PaymentDetail' . $identifier]->Account=$_POST['BankAccount']; /*Get the bank account currency and set that too */ $ErrMsg = _('Could not get the currency of the bank account'); $result = DB_query("SELECT currcode, @@ -127,41 +132,41 @@ $ErrMsg); $myrow = DB_fetch_array($result); - $_SESSION['PaymentDetail']->AccountCurrency=$myrow['currcode']; - $_SESSION['PaymentDetail']->CurrDecimalPlaces=$myrow['decimalplaces']; + $_SESSION['PaymentDetail' . $identifier]->AccountCurrency=$myrow['currcode']; + $_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces=$myrow['decimalplaces']; } else { - $_SESSION['PaymentDetail']->AccountCurrency =$_SESSION['CompanyRecord']['currencydefault']; - $_SESSION['PaymentDetail']->CurrDecimalPlaces=$_SESSION['CompanyRecord']['decimalplaces']; + $_SESSION['PaymentDetail' . $identifier]->AccountCurrency =$_SESSION['CompanyRecord']['currencydefault']; + $_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces=$_SESSION['CompanyRecord']['decimalplaces']; } if (isset($_POST['DatePaid']) AND $_POST['DatePaid']!='' AND Is_Date($_POST['DatePaid'])){ - $_SESSION['PaymentDetail']->DatePaid=$_POST['DatePaid']; + $_SESSION['PaymentDetail' . $identifier]->DatePaid=$_POST['DatePaid']; } if (isset($_POST['ExRate']) AND $_POST['ExRate']!=''){ - $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency } if (isset($_POST['FunctionalExRate']) AND $_POST['FunctionalExRate']!=''){ - $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between payment currency and account currency } if (isset($_POST['Paymenttype']) AND $_POST['Paymenttype']!=''){ - $_SESSION['PaymentDetail']->Paymenttype = $_POST['Paymenttype']; + $_SESSION['PaymentDetail' . $identifier]->Paymenttype = $_POST['Paymenttype']; } if (isset($_POST['Currency']) AND $_POST['Currency']!=''){ - $_SESSION['PaymentDetail']->Currency=$_POST['Currency']; //payment currency + $_SESSION['PaymentDetail' . $identifier]->Currency=$_POST['Currency']; //payment currency /*Get the exchange rate between the functional currency and the payment currency*/ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); $myrow = DB_fetch_row($result); $tableExRate = $myrow[0]; //this is the rate of exchange between the functional currency and the payment currency - if ($_POST['Currency']==$_SESSION['PaymentDetail']->AccountCurrency){ + if ($_POST['Currency']==$_SESSION['PaymentDetail' . $identifier]->AccountCurrency){ $_POST['ExRate']=1; - $_SESSION['PaymentDetail']->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency + $_SESSION['PaymentDetail' . $identifier]->ExRate=filter_number_format($_POST['ExRate']); //ex rate between payment currency and account currency $SuggestedExRate=1; } - if ($_SESSION['PaymentDetail']->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ + if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ $_POST['FunctionalExRate']=1; - $_SESSION['PaymentDetail']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); + $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); $SuggestedExRate = $tableExRate; $SuggestedFunctionalExRate =1; @@ -176,12 +181,12 @@ */ /*Get suggested FunctionalExRate */ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->AccountCurrency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . "'",$db); $myrow = DB_fetch_row($result); $SuggestedFunctionalExRate = $myrow[0]; /*Get the exchange rate between the functional currency and the payment currency*/ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency . "'",$db); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db); $myrow = DB_fetch_row($result); $tableExRate = $myrow[0]; //this is the rate of exchange between the functional currency and the payment currency /*Calculate cross rate to suggest appropriate exchange rate between payment currency and account currency */ @@ -192,20 +197,20 @@ if (isset($_POST['Narrative']) AND $_POST['Narrative']!=''){ - $_SESSION['PaymentDetail']->Narrative=$_POST['Narrative']; + $_SESSION['PaymentDetail' . $identifier]->Narrative=$_POST['Narrative']; } if (isset($_POST['Amount']) AND $_POST['Amount']!=''){ - $_SESSION['PaymentDetail']->Amount=filter_number_format($_POST['Amount']); + $_SESSION['PaymentDetail' . $identifier]->Amount=filter_number_format($_POST['Amount']); } else { - if (!isset($_SESSION['PaymentDetail']->Amount)) { - $_SESSION['PaymentDetail']->Amount=0; + if (!isset($_SESSION['PaymentDetail' . $identifier]->Amount)) { + $_SESSION['PaymentDetail' . $identifier]->Amount=0; } } if (isset($_POST['Discount']) AND $_POST['Discount']!=''){ - $_SESSION['PaymentDetail']->Discount=filter_number_format($_POST['Discount']); + $_SESSION['PaymentDetail' . $identifier]->Discount=filter_number_format($_POST['Discount']); } else { - if (!isset($_SESSION['PaymentDetail']->Discount)) { - $_SESSION['PaymentDetail']->Discount=0; + if (!isset($_SESSION['PaymentDetail' . $identifier]->Discount)) { + $_SESSION['PaymentDetail' . $identifier]->Discount=0; } } @@ -227,12 +232,12 @@ /*First off check we have an amount entered as paid ?? */ $TotalAmount =0; - foreach ($_SESSION['PaymentDetail']->GLItems AS $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems AS $PaymentItem) { $TotalAmount += $PaymentItem->Amount; } if ($TotalAmount==0 AND - ($_SESSION['PaymentDetail']->Discount + $_SESSION['PaymentDetail']->Amount)/$_SESSION['PaymentDetail']->ExRate ==0){ + ($_SESSION['PaymentDetail' . $identifier]->Discount + $_SESSION['PaymentDetail' . $identifier]->Amount)/$_SESSION['PaymentDetail' . $identifier]->ExRate ==0){ prnMsg( _('This payment has no amounts entered and will not be processed'),'warn'); include('includes/footer.inc'); exit; @@ -258,11 +263,11 @@ $i++; } - $PeriodNo = GetPeriod($_SESSION['PaymentDetail']->DatePaid,$db); + $PeriodNo = GetPeriod($_SESSION['PaymentDetail' . $identifier]->DatePaid,$db); $sql="SELECT usepreprintedstationery FROM paymentmethods - WHERE paymentname='" . $_SESSION['PaymentDetail']->Paymenttype ."'"; + WHERE paymentname='" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype ."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); @@ -277,7 +282,7 @@ <br /> <br />'; - echo '<form method=post action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">'; + echo '<form method=post action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo _('Has the cheque been printed') . '? <br /> @@ -287,7 +292,7 @@ <input type="submit" name="ChequePrinted" value="' . _('Yes / Continue') . '" /> <input type="submit" name="PaymentCancelled" value="' . _('No / Cancel Payment') . '" />'; - echo '<br />Payment amount = ' . $_SESSION['PaymentDetail']->Amount; + echo '<br />Payment amount = ' . $_SESSION['PaymentDetail' . $identifier]->Amount; } else { @@ -296,7 +301,7 @@ $result = DB_Txn_Begin($db); - if ($_SESSION['PaymentDetail']->SupplierID=='') { + if ($_SESSION['PaymentDetail' . $identifier]->SupplierID=='') { //its a nominal bank transaction type 1 @@ -305,7 +310,7 @@ if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then enter GLTrans */ $TotalAmount=0; - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { /*The functional currency amount will be the payment currenct amount / the bank account currency exchange rate - to get to the bank account currency @@ -322,11 +327,11 @@ tag) "; $SQL= $SQL . "VALUES (1, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $PaymentItem->GLCode . "', '" . $PaymentItem->Narrative . "', - '" . ($PaymentItem->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "', + '" . ($PaymentItem->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "', '". $PaymentItem->Cheque ."', '" . $PaymentItem->Tag . "' )"; @@ -335,13 +340,13 @@ $TotalAmount += $PaymentItem->Amount; } - $_SESSION['PaymentDetail']->Amount = $TotalAmount; - $_SESSION['PaymentDetail']->Discount=0; + $_SESSION['PaymentDetail' . $identifier]->Amount = $TotalAmount; + $_SESSION['PaymentDetail' . $identifier]->Discount=0; } //Run through the GL postings to check to see if there is a posting to another bank account (or the same one) if there is then a receipt needs to be created for this account too - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { if (in_array($PaymentItem->GLCode, $BankAccounts)) { @@ -357,9 +362,9 @@ $TrfToBankCurrCode = $TrfToBankRow['currcode']; $TrfToBankExRate = $TrfToBankRow['rate']; - if ($_SESSION['PaymentDetail']->AccountCurrency == $TrfToBankCurrCode){ + if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency == $TrfToBankCurrCode){ /*Make sure to use the same rate if the transfer is between two bank accounts in the same currency */ - $TrfToBankExRate = $_SESSION['PaymentDetail']->FunctionalExRate; + $TrfToBankExRate = $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate; } /*Consider an example @@ -403,13 +408,13 @@ VALUES ('" . $ReceiptTransNo . "', 2, '" . $PaymentItem->GLCode . "', - '" . _('Act Transfer From ') . $_SESSION['PaymentDetail']->Account . ' - ' . $PaymentItem->Narrative . "', - '" . (($_SESSION['PaymentDetail']->ExRate * $_SESSION['PaymentDetail']->FunctionalExRate)/$TrfToBankExRate). "', + '" . _('Act Transfer From ') . $_SESSION['PaymentDetail' . $identifier]->Account . ' - ' . $PaymentItem->Narrative . "', + '" . (($_SESSION['PaymentDetail' . $identifier]->ExRate * $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate)/$TrfToBankExRate). "', '" . $TrfToBankExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', '" . $PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction with the SQL'); @@ -419,7 +424,7 @@ } } else { /*Its a supplier payment type 22 */ - $CreditorTotal = (($_SESSION['PaymentDetail']->Discount + $_SESSION['PaymentDetail']->Amount)/$_SESSION['PaymentDetail']->ExRate)/$_SESSION['PaymentDetail']->FunctionalExRate; + $CreditorTotal = (($_SESSION['PaymentDetail' . $identifier]->Discount + $_SESSION['PaymentDetail' . $identifier]->Amount)/$_SESSION['PaymentDetail' . $identifier]->ExRate)/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate; $TransNo = GetNextTransNo(22, $db); $TransType = 22; @@ -436,13 +441,13 @@ transtext) "; $SQL = $SQL . "valueS ('" . $TransNo . "', 22, - '" . $_SESSION['PaymentDetail']->SupplierID . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . date('Y-m-d H-i-s') . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . ($_SESSION['PaymentDetail']->FunctionalExRate/$_SESSION['PaymentDetail']->ExRate) . "', - '" . (-$_SESSION['PaymentDetail']->Amount-$_SESSION['PaymentDetail']->Discount) . "', - '" . $_SESSION['PaymentDetail']->Narrative . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', + '" . ($_SESSION['PaymentDetail' . $identifier]->FunctionalExRate/$_SESSION['PaymentDetail' . $identifier]->ExRate) . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Amount-$_SESSION['PaymentDetail' . $identifier]->Discount) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "' )"; $ErrMsg = _('Cannot insert a payment transaction against the supplier because'); @@ -451,9 +456,9 @@ /*Update the supplier master with the date and amount of the last payment made */ $SQL = "UPDATE suppliers - SET lastpaiddate = '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - lastpaid='" . $_SESSION['PaymentDetail']->Amount ."' - WHERE suppliers.supplierid='" . $_SESSION['PaymentDetail']->SupplierID . "'"; + SET lastpaiddate = '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + lastpaid='" . $_SESSION['PaymentDetail' . $identifier]->Amount ."' + WHERE suppliers.supplierid='" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "'"; @@ -461,7 +466,7 @@ $DbgMsg = _('Cannot update the supplier record for the date of the last payment made using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - $_SESSION['PaymentDetail']->Narrative = $_SESSION['PaymentDetail']->SupplierID . '-' . $_SESSION['PaymentDetail']->Narrative; + $_SESSION['PaymentDetail' . $identifier]->Narrative = $_SESSION['PaymentDetail' . $identifier]->SupplierID . '-' . $_SESSION['PaymentDetail' . $identifier]->Narrative; if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the supplier control GLTrans */ /* Now debit creditors account with payment + discount */ @@ -475,16 +480,16 @@ amount) "; $SQL=$SQL . "VALUES (22, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['creditorsact'] . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', '" . $CreditorTotal . "')"; $ErrMsg = _('Cannot insert a GL transaction for the creditors account debit because'); $DbgMsg = _('Cannot insert a GL transaction for the creditors account debit using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); - if ($_SESSION['PaymentDetail']->Discount !=0){ + if ($_SESSION['PaymentDetail' . $identifier]->Discount !=0){ /* Now credit Discount received account with discounts */ $SQL="INSERT INTO gltrans ( type, typeno, @@ -495,11 +500,11 @@ amount) VALUES (22, '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['pytdiscountact'] . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Discount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Discount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "' )"; $ErrMsg = _('Cannot insert a GL transaction for the payment discount credit because'); $DbgMsg = _('Cannot insert a GL transaction for the payment discount credit using the SQL'); @@ -511,7 +516,7 @@ if ($_SESSION['CompanyRecord']['gllink_creditors']==1){ /* then do the common GLTrans */ - if ($_SESSION['PaymentDetail']->Amount !=0){ + if ($_SESSION['PaymentDetail' . $identifier]->Amount !=0){ /* Bank account entry first */ $SQL = "INSERT INTO gltrans ( type, typeno, @@ -522,11 +527,11 @@ amount) VALUES ('" . $TransType . "', '" . $TransNo . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', '" . $PeriodNo . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . (-$_SESSION['PaymentDetail']->Amount/$_SESSION['PaymentDetail']->ExRate/$_SESSION['PaymentDetail']->FunctionalExRate) . "')"; + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . (-$_SESSION['PaymentDetail' . $identifier]->Amount/$_SESSION['PaymentDetail' . $identifier]->ExRate/$_SESSION['PaymentDetail' . $identifier]->FunctionalExRate) . "')"; $ErrMsg = _('Cannot insert a GL transaction for the bank account credit because'); $DbgMsg = _('Cannot insert a GL transaction for the bank account credit using the SQL'); @@ -550,21 +555,21 @@ currcode) VALUES ('" . $TransNo . "', '" . $TransType . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', - '" . -$_SESSION['PaymentDetail']->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->ExRate . "', + '" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', + '" . -$_SESSION['PaymentDetail' . $identifier]->Amount . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } else { - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { $SQL="INSERT INTO banktrans (transno, type, bankact, @@ -577,14 +582,14 @@ currcode) VALUES ('" . $TransNo . "', '" . $TransType . "', - '" . $_SESSION['PaymentDetail']->Account . "', - '" . $_SESSION['PaymentDetail']->Narrative . "', - '" . $_SESSION['PaymentDetail']->ExRate . "', - '" . $_SESSION['PaymentDetail']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['PaymentDetail']->DatePaid) . "', - '" . $_SESSION['PaymentDetail']->Paymenttype . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Account . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "', + '" . $_SESSION['PaymentDetail' . $identifier]->ExRate . "', + '" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "', + '" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "', '" . -$PaymentItem->Amount . "', - '" . $_SESSION['PaymentDetail']->Currency . "' )"; + '" . $_SESSION['PaymentDetail' . $identifier]->Currency . "' )"; $ErrMsg = _('Cannot insert a bank transaction because'); $DbgMsg = _('Cannot insert a bank transaction using the SQL'); @@ -595,7 +600,7 @@ DB_Txn_Commit($db); prnMsg(_('Payment') . ' ' . $TransNo . ' ' . _('has been successfully entered'),'success'); - $LastSupplier = ($_SESSION['PaymentDetail']->SupplierID); + $LastSupplier = ($_SESSION['PaymentDetail' . $identifier]->SupplierID); unset($_POST['BankAccount']); unset($_POST['DatePaid']); @@ -605,8 +610,8 @@ unset($_POST['Narrative']); unset($_POST['Amount']); unset($_POST['Discount']); - unset($_SESSION['PaymentDetail']->GLItems); - unset($_SESSION['PaymentDetail']); + unset($_SESSION['PaymentDetail' . $identifier]->GLItems); + unset($_SESSION['PaymentDetail' . $identifier]); /*Set up a newy in case user wishes to enter another */ if (isset($LastSupplier) and $LastSupplier!='') { @@ -617,7 +622,7 @@ echo '<br /><a href="' . $rootpath . '/Payments.php?SupplierID=' . $LastSupplier . '">' . _('Enter another Payment for') . ' ' . $myrow['suppname'] . '</a>'; } else { - echo '<br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) .'">' . _('Enter another General Ledger Payment') . '</a><br />'; + echo '<br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '">' . _('Enter another General Ledger Payment') . '</a><br />'; } } @@ -626,7 +631,7 @@ } elseif (isset($_GET['Delete'])){ /* User hit delete the receipt entry from the batch */ - $_SESSION['PaymentDetail']->Remove_GLItem($_GET['Delete']); + $_SESSION['PaymentDetail' . $identifier]->Remove_GLItem($_GET['Delete']); } elseif (isset($_POST['Process']) AND !$BankAccountEmpty){ //user hit submit a new GL Analysis line into the payment @@ -648,7 +653,7 @@ prnMsg( _('The Cheque/Voucher number has already been used') . ' - ' . _('This GL analysis item could not be added'),'error'); } else { $myrow = DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLManualCode'], $myrow['accountname'], @@ -664,7 +669,7 @@ $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); - $_SESSION['PaymentDetail']->add_to_glanalysis(filter_number_format($_POST['GLAmount']), + $_SESSION['PaymentDetail' . $identifier]->add_to_glanalysis(filter_number_format($_POST['GLAmount']), $_POST['GLNarrative'], $_POST['GLCode'], $myrow['accountname'], @@ -690,14 +695,14 @@ if (isset($_POST['DatePaid']) AND ($_POST['DatePaid']=='' - OR !Is_Date($_SESSION['PaymentDetail']->DatePaid))){ + OR !Is_Date($_SESSION['PaymentDetail' . $identifier]->DatePaid))){ $_POST['DatePaid']= Date($_SESSION['DefaultDateFormat']); - $_SESSION['PaymentDetail']->DatePaid = $_POST['DatePaid']; + $_SESSION['PaymentDetail' . $identifier]->DatePaid = $_POST['DatePaid']; } -if ($_SESSION['PaymentDetail']->Currency=='' AND $_SESSION['PaymentDetail']->SupplierID==''){ - $_SESSION['PaymentDetail']->Currency=$_SESSION['CompanyRecord']['currencydefault']; +if ($_SESSION['PaymentDetail' . $identifier]->Currency=='' AND $_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ + $_SESSION['PaymentDetail' . $identifier]->Currency=$_SESSION['CompanyRecord']['currencydefault']; } @@ -715,29 +720,29 @@ if (DB_num_rows($result)==1){ $myrow = DB_fetch_row($result); - $_SESSION['PaymentDetail']->BankAccountName = $myrow[0]; + $_SESSION['PaymentDetail' . $identifier]->BankAccountName = $myrow[0]; unset($result); } elseif (DB_num_rows($result)==0){ prnMsg( _('The bank account number') . ' ' . $_POST['BankAccount'] . ' ' . _('is not set up as a bank account with a valid general ledger account'),'error'); } } -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="post">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; echo '<tr><th colspan="4"><font size="3" color="blue">' . _('Payment'); -if ($_SESSION['PaymentDetail']->SupplierID!=''){ - echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail']->SuppName; +if ($_SESSION['PaymentDetail' . $identifier]->SupplierID!=''){ + echo ' ' . _('to') . ' ' . $_SESSION['PaymentDetail' . $identifer]->SuppName; } -if ($_SESSION['PaymentDetail']->BankAccountName!=''){ - echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail']->BankAccountName; +if ($_SESSION['PaymentDetail' . $identifier]->BankAccountName!=''){ + echo ' ' . _('from the') . ' ' . $_SESSION['PaymentDetail' . $identifier]->BankAccountName; } -echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail']->DatePaid . '</font></th></tr>'; +echo ' ' . _('on') . ' ' . $_SESSION['PaymentDetail' . $identifier]->DatePaid . '</font></th></tr>'; $SQL = "SELECT bankaccountname, bankaccounts.accountcode, @@ -777,11 +782,11 @@ echo '<tr> <td>' . _('Date Paid') . ':</td> - <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail']->DatePaid . '" /></td> + <td><input type="text" name="DatePaid" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['PaymentDetail' . $identifier]->DatePaid . '" /></td> </tr>'; -if ($_SESSION['PaymentDetail']->SupplierID==''){ +if ($_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ echo '<tr><td>' . _('Currency of Payment') . ':</td> <td><select name="Currency" onChange="ReloadForm(UpdateHeader)">'; $SQL = "SELECT currency, currabrev, rate FROM currencies"; @@ -793,7 +798,7 @@ prnMsg( _('No currencies are defined yet. Payments cannot be entered until a currency is defined'),'error'); } else { while ($myrow=DB_fetch_array($result)){ - if ($_SESSION['PaymentDetail']->Currency==$myrow['currabrev']){ + if ($_SESSION['PaymentDetail' . $identifier]->Currency==$myrow['currabrev']){ echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } else { echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; @@ -806,17 +811,16 @@ } else { /*its a supplier payment so it must be in the suppliers currency */ echo '<tr> <td>' . _('Supplier Currency') . ':</td> - <td>' . $_SESSION['PaymentDetail']->Currency . '</td> + <td>' . $_SESSION['PaymentDetail' . $identifier]->Currency . '</td> </tr>'; - echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail']->Currency . '" />'; + echo '<input type="hidden" name="Currency" value="' . $_SESSION['PaymentDetail' . $identifier]->Currency . '" />'; /*get the default rate from the currency table if it has not been set */ if (!isset($_POST['ExRate']) OR $_POST['ExRate']==''){ - $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail']->Currency ."'"; + $SQL = "SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency ."'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_row($Result); $_POST['ExRate']=locale_number_format($myrow[0],'Variable'); } - } if (!isset($_POST['ExRate'])){ @@ -826,7 +830,7 @@ if (!isset($_POST['FunctionalExRate'])){ $_POST['FunctionalExRate']=1; } -if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['PaymentDetail']->Currency AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ +if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency!=$_SESSION['PaymentDetail' . $identifier]->Currency AND isset($_SESSION['PaymentDetail' . $identifier]->AccountCurrency)){ if (isset($SuggestedExRate)){ $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedExRate,6) . '</b>'; } else { @@ -838,12 +842,12 @@ echo '<tr> <td>' . _('Payment Exchange Rate') . ':</td> <td><input class="number" type="text" name="ExRate" maxlength="10" size="12" value="' . $_POST['ExRate'] . '" /></td> - <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail']->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail']->Currency . '</i></td> + <td>' . $SuggestedExRateText . ' <i>' . _('The exchange rate between the currency of the bank account currency and the currency of the payment') . '. 1 ' . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . ' = ? ' . $_SESSION['PaymentDetail' . $identifier]->Currency . '</i></td> </tr>'; } -if ($_SESSION['PaymentDetail']->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] - AND isset($_SESSION['PaymentDetail']->AccountCurrency)){ +if ($_SESSION['PaymentDetail' . $identifier]->AccountCurrency!=$_SESSION['CompanyRecord']['currencydefault'] + AND isset($_SESSION['PaymentDetail' . $identifier]->AccountCurrency)){ if (isset($SuggestedFunctionalExRate)){ $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' ' . locale_number_format($SuggestedFunctionalExRate,6) . '</b>'; } else { @@ -855,7 +859,7 @@ echo '<tr> <td>' . _('Functional Exchange Rate') . ':</td> <td><input type="text" name="FunctionalExRate" maxlength="10" size="12" value="' . $_POST['FunctionalExRate'] . '" /></td> - <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail']->AccountCurrency . '</i></td> + <td>' . ' ' . $SuggestedFunctionalExRateText . ' <i>' . _('The exchange rate between the currency of the business (the functional currency) and the currency of the bank account') . '. 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['PaymentDetail' . $identifier]->AccountCurrency . '</i></td> </tr>'; } echo '<tr> @@ -902,7 +906,7 @@ echo '</table><br />'; -if ($_SESSION['CompanyRecord']['gllink_creditors']==1 AND $_SESSION['PaymentDetail']->SupplierID==''){ +if ($_SESSION['CompanyRecord']['gllink_creditors']==1 AND $_SESSION['PaymentDetail' . $identifier]->SupplierID==''){ /* Set upthe form for the transaction entry for a GL Payment Analysis item */ echo '<br /><table class="selection">'; @@ -1023,11 +1027,11 @@ if (isset($_POST['GLAmount'])) { echo '<tr> - <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + <td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . '):</td> <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" value="' . $_POST['GLAmount'] . '" /></td> </tr>'; } else { - echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . '):</td> + echo '<tr><td>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . '):</td> <td><input type="text" name="GLAmount" maxlength="12" size="12" class="number" /></td> </tr>'; } @@ -1038,19 +1042,19 @@ <input type="submit" name="Cancel" value="' . _('Cancel') . '" /> </div>'; - if (sizeOf($_SESSION['PaymentDetail']->GLItems)>0) { + if (sizeOf($_SESSION['PaymentDetail' . $identifier]->GLItems)>0) { echo '<br /> <table class="selection"> <tr> <th>' . _('Cheque No').'</th> - <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail']->Currency . ')</th> + <th>' . _('Amount') . ' (' . $_SESSION['PaymentDetail' . $identifier]->Currency . ')</th> <th>' . _('GL Account') . '</th> <th>' . _('Narrative') . '</th> <th>' . _('Tag') . '</th> </tr>'; $PaymentTotal = 0; - foreach ($_SESSION['PaymentDetail']->GLItems as $PaymentItem) { + foreach ($_SESSION['PaymentDetail' . $identifier]->GLItems as $PaymentItem) { $Tagsql="SELECT tagdescription from tags where tagref='" . $PaymentItem->Tag . "'"; $TagResult=DB_query($Tagsql, $db); $TagMyrow=DB_fetch_row($TagResult); @@ -1062,17 +1066,17 @@ echo '<tr> <td>' . $PaymentItem->Cheque . '</td> - <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($PaymentItem->Amount,$_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces) . '</td> <td>' . $PaymentItem->GLCode . ' - ' . $PaymentItem->GLActName . '</td> <td>' . stripslashes($PaymentItem->Narrative) . '</td> <td>' . $PaymentItem->Tag . ' - ' . $TagName . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF']) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'] . '?identifier=' . $identifier) . '?Delete=' . $PaymentItem->ID . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this payment analysis item?') . '\');">' . _('Delete') . '</a></td> </tr>'; $PaymentTotal += $PaymentItem->Amount; } echo '<tr> <td></td> - <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail']->CurrDecimalPlaces) . '</b></td> + <td class="number"><b>' . locale_number_format($PaymentTotal,$_SESSION['PaymentDetail' . $identifier]->CurrDecimalPlaces) . '</b></td> <td></td> <td></td> <td></td> @@ -1088,16 +1092,16 @@ echo '<table class="selection"> <tr> - <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail']->Currency . ':</td> - <td><input class="number" type="text" name="Amount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Amount . '" /></td> + <td>' . _('Amount of Payment') . ' ' . $_SESSION['PaymentDetail' . $identifier]->Currency . ':</td> + <td><input class="number" type="text" name="Amount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail' . $identifier]->Amount . '" /></td> </tr>'; - if (isset($_SESSION['PaymentDetail']->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ + if (isset($_SESSION['PaymentDetail' . $identifier]->SupplierID)){ /*So it is a supplier payment so show the discount entry item */ echo '<tr> <td>' . _('Amount of Discount') . ':</td> - <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail']->Discount . '" /></td> + <td><input class="number" type="text" name="Discount" maxlength="12" size="13" value="' . $_SESSION['PaymentDetail' . $identifier]->Discount . '" /></td> </tr>'; - echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail']->SuppName . '" />'; + echo '<input type="hidden" name="SuppName" value="' . $_SESSION['PaymentDetail' . $identifier]->SuppName . '" />'; } else { echo '<input type="hidden" name="Discount" Value="0" />'; } @@ -1107,4 +1111,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |