From: <dai...@us...> - 2011-07-03 03:01:47
|
Revision: 4619 http://web-erp.svn.sourceforge.net/web-erp/?rev=4619&view=rev Author: daintree Date: 2011-07-03 03:01:39 +0000 (Sun, 03 Jul 2011) Log Message: ----------- various Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/DailyBankTransactions.php trunk/DailySalesInquiry.php trunk/DebtorsAtPeriodEnd.php trunk/DeliveryDetails.php trunk/DiscountCategories.php trunk/DiscountMatrix.php trunk/EDIMessageFormat.php trunk/EDIProcessOrders.php trunk/PDFDeliveryDifferences.php trunk/PDFQuotation.php trunk/PDFQuotationPortrait.php trunk/PDFStockCheckComparison.php trunk/PrintCheque.php trunk/PrintCustStatements.php trunk/WorkOrderCosting.php trunk/doc/Change.log Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/CustWhereAlloc.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -12,7 +12,8 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Customer Where Allocated'). '" alt="" />' . $title . '</p>'; -echo '<table class=selection cellpadding=2><tr>'; +echo '<table class="selection" cellpadding=2> + <tr>'; echo '<td>' . _('Type') . ':</td> <td><select tabindex=1 name="TransType"> '; @@ -36,7 +37,9 @@ echo '<td>'._('Transaction Number').':</td> <td><input tabindex=2 type="text" name="TransNo" maxlength=10 size=10 value="'. $_POST['TransNo'] . '"></td>'; -echo '</tr></table><br /> +echo '</tr> + </table> + <br /> <div class="centre"><input tabindex=3 type="submit" name="ShowResults" value="' . _('Show How Allocated') . '"></div>'; if (isset($_POST['ShowResults']) AND $_POST['TransNo']==''){ @@ -49,9 +52,9 @@ /*First off get the DebtorTransID of the transaction (invoice normally) selected */ $sql = "SELECT id, - ovamount+ovgst AS totamt - FROM debtortrans - WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; + ovamount+ovgst AS totamt + FROM debtortrans + WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; $result = DB_query($sql , $db); @@ -60,25 +63,26 @@ $AllocToID = $myrow['id']; $sql = "SELECT type, - transno, - trandate, - debtortrans.debtorno, - reference, - rate, - ovamount+ovgst+ovfreight+ovdiscount as totalamt, - custallocns.amt - FROM debtortrans - INNER JOIN custallocns ON debtortrans.id=custallocns.transid_allocfrom - WHERE custallocns.transid_allocto='". $AllocToID."'"; + transno, + trandate, + debtortrans.debtorno, + reference, + rate, + ovamount+ovgst+ovfreight+ovdiscount as totalamt, + custallocns.amt + FROM debtortrans + INNER JOIN custallocns + ON debtortrans.id=custallocns.transid_allocfrom + WHERE custallocns.transid_allocto='". $AllocToID."'"; $ErrMsg = _('The customer transactions for the selected criteria could not be retrieved because'); - $TransResult = DB_query($sql, $db, $ErrMsg); if (DB_num_rows($TransResult)==0){ prnMsg(_('There are no allocations made against this transaction'),'info'); } else { - echo '<br /><table cellpadding=2 class=selection>'; + echo '<br /> + <table cellpadding=2 class="selection">'; echo '<tr> <th colspan=6><div class="centre"><font size=3 color=blue><b>'._('Allocations made against invoice number') . ' ' . $_POST['TransNo'] . '<br />'._('Transaction Total').': '. number_format($myrow['totamt'],2) . '</font></b></div></th> @@ -91,7 +95,7 @@ <th>' . _('Ex Rate') . '</th> <th>' . _('Amount') . '</th> <th>' . _('Alloc') . '</th> - </tr>'; + </tr>'; echo $tableheader; $RowCounter = 1; Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DailyBankTransactions.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -30,7 +30,8 @@ <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>'; + echo '</select></td> + </tr></table>'; prnMsg( _('Bank Accounts have not yet been defined. You must first') . ' <a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a> ' . _('and general ledger accounts to be affected'),'warn'); include('includes/footer.inc'); exit; @@ -41,9 +42,9 @@ $_POST['BankAccount']=$myrow['accountcode']; } if ($_POST['BankAccount']==$myrow['accountcode']){ - echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } else { - echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode']; + echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } } echo '</select></td></tr>'; @@ -95,9 +96,9 @@ } else { $BankDetailRow = DB_fetch_array($BankResult); echo '<table class=selection> - <tr> - <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> - </tr>'; + <tr> + <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> + </tr>'; echo '<tr> <th>' . ('Date') . '</th> <th>'._('Transaction type').'</th> Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DailySalesInquiry.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -52,7 +52,10 @@ } echo '</select></td>'; -echo '</tr></table><br /><div class="centre"><input tabindex=4 type=submit name="ShowResults" VALUE="' . _('Show Daily Sales For The Selected Month') . '">'; +echo '</tr> + </table> + <br /> + <div class="centre"><input tabindex=4 type=submit name="ShowResults" value="' . _('Show Daily Sales For The Selected Month') . '">'; echo '</form></div>'; echo '<br />'; /*Now get and display the sales data returned */ @@ -92,13 +95,14 @@ echo '<table cellpadding=2 class=selection>'; echo'<tr> - <th>' . _('Sunday') . '</th> - <th>' . _('Monday') . '</th> - <th>' . _('Tuesday') . '</th> - <th>' . _('Wednesday') . '</th> - <th>' . _('Thursday') . '</th> - <th>' . _('Friday') . '</th> - <th>' . _('Saturday') . '</th></tr>'; + <th>' . _('Sunday') . '</th> + <th>' . _('Monday') . '</th> + <th>' . _('Tuesday') . '</th> + <th>' . _('Wednesday') . '</th> + <th>' . _('Thursday') . '</th> + <th>' . _('Friday') . '</th> + <th>' . _('Saturday') . '</th> + </tr>'; $CumulativeTotalSales = 0; $CumulativeTotalCost = 0; Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DebtorsAtPeriodEnd.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -27,28 +27,29 @@ /*Now figure out the aged analysis for the customer range under review */ $SQL = "SELECT debtorsmaster.debtorno, - debtorsmaster.name, - currencies.currency, - SUM((debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)/debtortrans.rate) AS balance, - SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) AS fxbalance, - SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN - (debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount)/debtortrans.rate ELSE 0 END) AS afterdatetrans, - SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' - AND (debtortrans.type=11 OR debtortrans.type=12) THEN - debtortrans.diffonexch ELSE 0 END) AS afterdatediffonexch, - SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN - debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount ELSE 0 END - ) AS fxafterdatetrans - FROM debtorsmaster, - currencies, - debtortrans - WHERE debtorsmaster.currcode = currencies.currabrev - AND debtorsmaster.debtorno = debtortrans.debtorno - AND debtorsmaster.debtorno >= '" . $_POST['FromCriteria'] . "' + debtorsmaster.name, + currencies.currency, + currencies.decimalplaces, + SUM((debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)/debtortrans.rate) AS balance, + SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) AS fxbalance, + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN + (debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount)/debtortrans.rate ELSE 0 END) AS afterdatetrans, + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' + AND (debtortrans.type=11 OR debtortrans.type=12) THEN + debtortrans.diffonexch ELSE 0 END) AS afterdatediffonexch, + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN + debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount ELSE 0 END + ) AS fxafterdatetrans + FROM debtorsmaster INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + INNER JOIN debtortrans + ON debtorsmaster.debtorno = debtortrans.debtorno + WHERE debtorsmaster.debtorno >= '" . $_POST['FromCriteria'] . "' AND debtorsmaster.debtorno <= '" . $_POST['ToCriteria'] . "' GROUP BY debtorsmaster.debtorno, debtorsmaster.name, - currencies.currency"; + currencies.currency, + currencies.decimalplaces"; $CustomerResult = DB_query($SQL,$db,'','',false,false); @@ -84,8 +85,8 @@ if (abs($Balance)>0.009 OR ABS($FXBalance)>0.009) { - $DisplayBalance = number_format($DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'],2); - $DisplayFXBalance = number_format($DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans'],2); + $DisplayBalance = number_format($DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'],$DebtorBalances['decimalplaces']); + $DisplayFXBalance = number_format($DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans'],$DebtorBalances['decimalplaces']); $TotBal += $Balance; @@ -109,7 +110,7 @@ include('includes/PDFDebtorBalsPageHeader.inc'); } - $DisplayTotBalance = number_format($TotBal,2); + $DisplayTotBalance = number_format($TotBal,$_SESSION['CompanyRecord']['decimalplaces']); $LeftOvers = $pdf->addTextWrap(50,$YPos,160,$FontSize,_('Total balances'),'left'); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DeliveryDetails.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -40,7 +40,7 @@ if (isset($_POST['ProcessOrder']) OR isset($_POST['MakeRecurringOrder'])) { /*need to check for input errors in any case before order processed */ - $_POST['Update']='Yes rerun the validation checks'; + $_POST['Update']='Yes rerun the validation checks'; //no need for gettext! /*store the old freight cost before it is recalculated to ensure that there has been no change - test for change after freight recalculated and get user to re-confirm if changed */ @@ -126,22 +126,22 @@ } } $sql = "SELECT custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.phoneno, - custbranch.email, - custbranch.defaultlocation, - custbranch.defaultshipvia, - custbranch.deliverblind, - custbranch.specialinstructions, - custbranch.estdeliverydays - FROM custbranch - WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' - AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.phoneno, + custbranch.email, + custbranch.defaultlocation, + custbranch.defaultshipvia, + custbranch.deliverblind, + custbranch.specialinstructions, + custbranch.estdeliverydays + FROM custbranch + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' + AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->CustomerName . ' ' . _('cannot be retrieved because'); $DbgMsg = _('SQL used to retrieve the branch details was') . ':'; @@ -256,7 +256,7 @@ if(isset($_POST['MakeRecurringOrder']) AND ! $InputErrors){ echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/RecurringSalesOrders.php?identifier='.$identifier . '&NewRecurringOrder=Yes">'; - prnMsg(_('You should automatically be forwarded to the entry of recurring order details page') . '. ' . _('If this does not happen') . '(' . _('if the browser does not support META Refresh') . ') ' ."<a href='" . $rootpath . '/RecurringOrders.php?identifier='.$identifier . "&NewRecurringOrder=Yes'>". _('click here') .'</a> '. _('to continue'),'info'); + prnMsg(_('You should automatically be forwarded to the entry of recurring order details page') . '. ' . _('If this does not happen') . '(' . _('if the browser does not support META Refresh') . ') ' . '<a href="' . $rootpath . '/RecurringOrders.php?identifier='.$identifier . '&NewRecurringOrder=Yes">'. _('click here') .'</a> '. _('to continue'),'info'); include('includes/footer.inc'); exit; } @@ -569,7 +569,7 @@ if ($_POST['Quotation']==0) { /*then its not a quotation its a real order */ - echo '<br /><table class=selection> + echo '<br /><table class="selection"> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></td> <td>' . ' ' . '<a target="_blank" href="' . $rootpath . '/PrintCustOrder.php?identifier='.$identifier . '&TransNo=' . $OrderNo . '">'. _('Print packing slip') . ' (' . _('Preprinted stationery') . ')' .'</a></td> @@ -591,13 +591,13 @@ echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> - <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?' . SID .'identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Landscape)') .'</a></td> + <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Landscape)') .'</a></td> </tr> </table>'; echo '<br /><table class=selection> <tr> <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> - <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?' . SID .'identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Portrait)') .'</a></td> + <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?identifier='.$identifier . '&QuotationNo=' . $OrderNo . '">'. _('Print Quotation (Portrait)') .'</a></td> </tr> </table>'; } @@ -639,7 +639,7 @@ $ErrMsg = _('Could not update the contract status'); $DbgMsg = _('The SQL that failed to update the contract status was'); $UpdContractResult=DB_query("UPDATE contracts SET status=2, - wo='" . $WONo . "' + wo='" . $WONo . "' WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); $ErrMsg = _('Could not insert the contract bill of materials'); $InsContractBOM = DB_query("INSERT INTO bom (parent, @@ -653,7 +653,7 @@ workcentreadded, '" . $_SESSION['Items'.$identifier]->Location ."', '" . Date('Y-m-d') . "', - '2037-12-31' + '2099-12-31' FROM contractbom WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); @@ -707,31 +707,30 @@ } //end test to see if the order was a contract quotation being changed to an order - $HeaderSQL = "UPDATE salesorders - SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', - customerref = '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', - comments = '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', - ordertype = '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', - shipvia = '" . $_POST['ShipVia'] . "', - deliverydate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "', - quotedate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "', - confirmeddate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "', - deliverto = '" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', - deladd1 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', - deladd2 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', - deladd3 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', - deladd4 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', - deladd5 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', - deladd6 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', - contactphone = '" . $_SESSION['Items'.$identifier]->PhoneNo . "', - contactemail = '" . $_SESSION['Items'.$identifier]->Email . "', - freightcost = '" . $_SESSION['Items'.$identifier]->FreightCost ."', - fromstkloc = '" . $_SESSION['Items'.$identifier]->Location ."', - printedpackingslip = '" . $_POST['ReprintPackingSlip'] . "', - quotation = '" . $_SESSION['Items'.$identifier]->Quotation . "', - deliverblind = '" . $_SESSION['Items'.$identifier]->DeliverBlind . "' - WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] ."'"; + $HeaderSQL = "UPDATE salesorders SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', + customerref = '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + comments = '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', + ordertype = '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', + shipvia = '" . $_POST['ShipVia'] . "', + deliverydate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "', + quotedate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "', + confirmeddate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "', + deliverto = '" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + deladd1 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + deladd2 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + deladd3 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + deladd4 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + deladd5 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + deladd6 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', + contactphone = '" . $_SESSION['Items'.$identifier]->PhoneNo . "', + contactemail = '" . $_SESSION['Items'.$identifier]->Email . "', + freightcost = '" . $_SESSION['Items'.$identifier]->FreightCost ."', + fromstkloc = '" . $_SESSION['Items'.$identifier]->Location ."', + printedpackingslip = '" . $_POST['ReprintPackingSlip'] . "', + quotation = '" . $_SESSION['Items'.$identifier]->Quotation . "', + deliverblind = '" . $_SESSION['Items'.$identifier]->DeliverBlind . "' + WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] ."'"; $DbgMsg = _('The SQL that was used to update the order and failed was'); $ErrMsg = _('The order cannot be updated because'); Modified: trunk/DiscountCategories.php =================================================================== --- trunk/DiscountCategories.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DiscountCategories.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -28,10 +28,10 @@ //first off validate inputs sensible $result = DB_query("SELECT stockid - FROM stockmaster - WHERE mbflag <>'K' - AND mbflag<>'D' - AND stockid='" . strtoupper($_POST['StockID']) . "'",$db); + FROM stockmaster + WHERE mbflag <>'K' + AND mbflag<>'D' + AND stockid='" . strtoupper($_POST['StockID']) . "'",$db); if (DB_num_rows($result)==0){ $InputError = 1; prnMsg(_('The stock item entered must be set up as either a manufactured or purchased or assembly item'),'warn'); @@ -59,8 +59,8 @@ echo '<br />'; } elseif (isset($_POST['SubmitCategory'])) { $sql="UPDATE stockmaster - SET discountcategory='".$_POST['DiscountCategory']."' - WHERE categoryid='".$_POST['stockcategory']."'"; + SET discountcategory='".$_POST['DiscountCategory']."' + WHERE categoryid='".$_POST['stockcategory']."'"; $result=DB_query($sql, $db); } @@ -85,7 +85,10 @@ } echo '</select></td>'; - echo '<td><input type="submit" name="select" value="'._('Select').'"></td></tr></table><br />'; + echo '<td><input type="submit" name="select" value="'._('Select').'"></td> + </tr> + </table> + <br />'; } echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; @@ -125,7 +128,8 @@ <td><input type="text" name="PartID" size=10 maxlength=10 value="' . $_POST['PartID'] . '"></td> <td>' . _('Partial description') . ':</td> <td><input type="text" name="PartDesc" size=10 value="' . $_POST['PartDesc'] .'" maxlength=10></td> - <td><input type="submit" name="search" value="' . _('Search') .'"></td></tr>'; + <td><input type="submit" name="search" value="' . _('Search') .'"></td> + </tr>'; echo '</table>'; @@ -212,7 +216,7 @@ printf('<td>%s</td> <td>%s - %s</td> - <td><a href="%s">'. _('Delete') .'</td> + <td><a href="%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this discount category?') . '\');">'. _('Delete') .'</td> </tr>', $myrow['discountcategory'], $myrow['stockid'], Modified: trunk/DiscountMatrix.php =================================================================== --- trunk/DiscountMatrix.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/DiscountMatrix.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -136,23 +136,25 @@ echo '<div class="centre"><input tabindex=5 type="submit" name="submit" value="' . _('Enter Information') . '"></div><br />'; $sql = "SELECT sales_type, - salestype, - discountcategory, - quantitybreak, - discountrate - FROM discountmatrix INNER JOIN salestypes - ON discountmatrix.salestype=salestypes.typeabbrev - ORDER BY salestype, - discountcategory, - quantitybreak"; + salestype, + discountcategory, + quantitybreak, + discountrate + FROM discountmatrix INNER JOIN salestypes + ON discountmatrix.salestype=salestypes.typeabbrev + ORDER BY salestype, + discountcategory, + quantitybreak"; $result = DB_query($sql,$db); echo '<table class=selection>'; -echo '<tr><th>' . _('Sales Type') . '</th> +echo '<tr> + <th>' . _('Sales Type') . '</th> <th>' . _('Discount Category') . '</th> <th>' . _('Quantity Break') . '</th> - <th>' . _('Discount Rate') . ' %' . '</th></tr>'; + <th>' . _('Discount Rate') . ' %' . '</th> + </tr>'; $k=0; //row colour counter @@ -170,7 +172,7 @@ <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> - <td><a href="%s">' . _('Delete') . '</td> + <td><a href="%s" onclick="return confirm(\'' . _('Are you sure you wish to delete this discount matrix record?') . '\');">' . _('Delete') . '</td> </tr>', $myrow['sales_type'], $myrow['discountcategory'], Modified: trunk/EDIMessageFormat.php =================================================================== --- trunk/EDIMessageFormat.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/EDIMessageFormat.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -31,13 +31,13 @@ sequenceno, section, linetext) - SELECT '".$PartnerCode."', - 'INVOIC', - sequenceno, - section, - linetext - FROM edimessageformat - WHERE partnercode='DEFAULT' + SELECT '".$PartnerCode."', + 'INVOIC', + sequenceno, + section, + linetext + FROM edimessageformat + WHERE partnercode='DEFAULT' AND messagetype='INVOIC'"; $ErrMsg = _('There was an error inserting the default template invoice message records for') . ' ' . $PartnerCode . ' ' . _('because'); @@ -113,23 +113,23 @@ or deletion of the records*/ $sql = "SELECT id, - section, - sequenceno, - linetext - FROM edimessageformat - WHERE partnercode='" . $PartnerCode . "' - AND messagetype='" . $MessageType . "' - ORDER BY sequenceno"; + section, + sequenceno, + linetext + FROM edimessageformat + WHERE partnercode='" . $PartnerCode . "' + AND messagetype='" . $MessageType . "' + ORDER BY sequenceno"; $result = DB_query($sql,$db); echo '<table class=selection>'; echo '<tr><th colspan=5><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode.'</font></th></tr>'; $TableHeader = '<tr> - <th>' . _('Section') . '</th> - <th>' . _('Sequence') . '</th> - <th>' . _('Format String') . '</th> - </tr>'; + <th>' . _('Section') . '</th> + <th>' . _('Sequence') . '</th> + <th>' . _('Format String') . '</th> + </tr>'; echo $TableHeader; $k=0; //row colour counter @@ -145,18 +145,18 @@ printf('<td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td><a href="%s&SelectedMessageLine=%s">' . _('Edit') . '</a></td> - <td><a href="%s&delete=%s">' . _('Delete') . '</a></td> - </tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $_SERVER['PHP_SELF'] . '?' . SID, - $myrow[0], - $_SERVER['PHP_SELF'] . '?' . SID, - $myrow[0]); + <td class=number>%s</td> + <td>%s</td> + <td><a href="%s&SelectedMessageLine=%s">' . _('Edit') . '</a></td> + <td><a href="%s&delete=%s">' . _('Delete') . '</a></td> + </tr>', + $myrow[1], + $myrow[2], + $myrow[3], + $_SERVER['PHP_SELF'] . '?' . SID, + $myrow[0], + $_SERVER['PHP_SELF'] . '?' . SID, + $myrow[0]); } //END WHILE LIST LOOP echo '</table><p>'; Modified: trunk/EDIProcessOrders.php =================================================================== --- trunk/EDIProcessOrders.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/EDIProcessOrders.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.20 $ */ /* $Id$*/ -//$PageSecurity =11; - include ('includes/session.inc'); $title = _('Process EDI Orders'); @@ -40,7 +37,7 @@ /*Read in the EANCOM Order Segments for the current seg group from the segments table */ -$sql = 'SELECT id, segtag, maxoccur, seggroup FROM edi_orders_segs'; +$sql = "SELECT id, segtag, maxoccur, seggroup FROM edi_orders_segs"; $OrderSeg = DB_query($sql,$db); $i=0; $Seg = array(); @@ -58,7 +55,7 @@ while (false !== ($OrderFile=readdir($dirhandle))){ /*there are files in the incoming orders dir */ $TryNextFile = False; - echo "<br />$OrderFile"; + echo '<br />' . $OrderFile; /*Counter that keeps track of the array pointer for the 1st seg in the current seg group */ $FirstSegInGrp =0; @@ -541,7 +538,7 @@ } else { $mail->setSubject(_('EDI Order Message') . ' ' . $Order->CustRef); - $EDICustServPerson ="'phil' <phil@localhost>"; + $EDICustServPerson = $_SESSION['PurchasingManagerEmail']; $Recipients = array($EDICustServPerson); } @@ -556,7 +553,6 @@ - } /*end of the loop around all the incoming order files in the incoming orders directory */ Modified: trunk/PDFDeliveryDifferences.php =================================================================== --- trunk/PDFDeliveryDifferences.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PDFDeliveryDifferences.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -2,9 +2,6 @@ /* $Id$*/ -/* $Revision: 1.15 $ */ - -//$PageSecurity = 3; include ('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -27,42 +24,51 @@ echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . _('Delivery Differences Report') . '</p>'; - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . sid . "'>"; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . - ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']. - "' name='FromDate' maxlength=10 size=10 value='" . - Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . "'></td></tr>"; - echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>"; + echo '<table class=selection> + <tr> + <td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td> + <td><input type=text class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat']. '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> + </tr>'; echo '<tr><td>' . _('Inventory Category') . '</td><td>'; $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; $result = DB_query($sql,$db); - echo "<select name='CategoryID'>"; - echo "<option selected value='All'>" . _('Over All Categories'); + echo '<select name="CategoryID">'; + echo '<option selected value="All">' . _('Over All Categories') . '</option>'; - while ($myrow=DB_fetch_array($result)){ - echo "<option value='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription']; - } + while ($myrow=DB_fetch_array($result)){ + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; + } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>"; - echo "<option selected value='All'>" . _('All Locations'); + echo '<tr><td>' . _('Inventory Location') . ':</td> + <td><select name="Location"> + <option selected value="All">' . _('All Locations') . '</option>'; - $result= DB_query('SELECT loccode, locationname FROM locations',$db); - while ($myrow=DB_fetch_array($result)){ - echo "<option value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - } + $result= DB_query("SELECT loccode, locationname FROM locations",$db); + while ($myrow=DB_fetch_array($result)){ + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; - echo "<option selected value='No'>" . _('No'); - echo "<option value='Yes'>" . _('Yes'); - echo "</select></td></tr></table><br /><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; + echo '<tr><td>' . _('Email the report off') . ':</td> + <td><select name="Email"> + <option selected value="No">' . _('No') . '</option> + <option value="Yes">' . _('Yes') . '</option> + </select> + </td> + </tr> + </table> + <br /> + <div class="centre"><input type="submit" name="Go" value="' . _('Create PDF') . '"></div>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -257,20 +263,8 @@ $YPos-=$line_height; $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,_('DIFOT') . ' ' . number_format((1-($TotalDiffs/$myrow[0])) * 100,2) . '%', 'left'); -/* UldisN -$pdfcode = $pdf->output(); -$len = mb_strlen($pdfcode); -header('Content-type: application/pdf'); -header('Content-Length: ' . $len); -header('Content-Disposition: inline; filename=DeliveryDifferences.pdf'); -header('Expires: 0'); -header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); -header('Pragma: public'); - -$pdf->stream(); -*/ $ReportFileName = $_SESSION['DatabaseName'] . '_DeliveryDifferences_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName);//UldisN +$pdf->OutputD($ReportFileName); if ($_POST['Email']=='Yes'){ if (file_exists($_SESSION['reports_dir'] . '/'.$ReportFileName)){ Modified: trunk/PDFQuotation.php =================================================================== --- trunk/PDFQuotation.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PDFQuotation.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -84,8 +84,8 @@ $FontSize=12; $PageNumber = 1; $line_height=15; -// $pdf->selectFont('./fonts/Helvetica.afm'); + /* Now ... Has the order got any line items still outstanding to be invoiced */ $ErrMsg = _('There was a problem retrieving the quotation line details for quotation Number') . ' ' . @@ -224,28 +224,16 @@ } /*end if there are line details to show on the quotation*/ -//$pdfcode = $pdf->output('PDFQuotation.pdf', 'I'); -//$len = mb_strlen($pdfcode); if ($ListCount == 0){ - $title = _('Print Quotation Error'); - include('includes/header.inc'); - echo '<p>'. _('There were no items on the quotation') . '. ' . _('The quotation cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&Quotation=Quotes_only">'. _('Print Another Quotation'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); + $title = _('Print Quotation Error'); + include('includes/header.inc'); + echo '<p>'. _('There were no items on the quotation') . '. ' . _('The quotation cannot be printed'). + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&Quotation=Quotes_only">'. _('Print Another Quotation'). + '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; + include('includes/footer.inc'); exit; } else { -/* - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=Quotation.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); -//echo 'here'; - $pdf->Output('PDFQuotation.pdf', 'I'); -*/ - $pdf->OutputI($_SESSION['DatabaseName'] . '_Quotation_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputI($_SESSION['DatabaseName'] . '_Quotation_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } ?> \ No newline at end of file Modified: trunk/PDFQuotationPortrait.php =================================================================== --- trunk/PDFQuotationPortrait.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PDFQuotationPortrait.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -2,7 +2,6 @@ /* $Id: PDFQuotationPortrait.php 4491 2011-02-15 06:31:08Z daintree $ */ - include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -59,18 +58,17 @@ //If there are no rows, there's a problem. if (DB_num_rows($result)==0){ - $title = _('Print Quotation Error'); - include('includes/header.inc'); - echo '<div class="centre"><br /><br /><br />'; - prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'&Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a></li> - </td></tr></table></div><br /><br /><br />'; - include('includes/footer.inc'); - exit; + $title = _('Print Quotation Error'); + include('includes/header.inc'); + echo '<div class="centre"><br /><br /><br />'; + prnMsg( _('Unable to Locate Quotation Number') . ' : ' . $_GET['QuotationNo'] . ' ', 'error'); + echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> + <li><a href="'. $rootpath . '/SelectSalesOrder.php?'. SID .'&Quotations=Quotes_Only">' . _('Outstanding Quotations') . '</a></li> + </td></tr></table></div><br /><br /><br />'; + include('includes/footer.inc'); + exit; } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ - - $myrow = DB_fetch_array($result); + $myrow = DB_fetch_array($result); } /*retrieve the order details from the database to print */ @@ -85,7 +83,6 @@ $FontSize=12; $PageNumber = 1; $line_height=24; -// $pdf->selectFont('./fonts/Helvetica.afm'); /* Now ... Has the order got any line items still outstanding to be invoiced */ @@ -137,13 +134,19 @@ $TaxProv = $myrow['taxprovinceid']; $TaxCat = $myrow2['taxcatid']; $Branch = $myrow['branchcode']; - $sql3 = " select taxgrouptaxes.taxauthid from taxgrouptaxes INNER JOIN custbranch ON taxgrouptaxes.taxgroupid=custbranch.taxgroupid WHERE custbranch.branchcode='" .$Branch ."'"; + $sql3 = " SELECT taxgrouptaxes.taxauthid + FROM taxgrouptaxes INNER JOIN custbranch + ON taxgrouptaxes.taxgroupid=custbranch.taxgroupid + WHERE custbranch.branchcode='" .$Branch ."'"; $result3=DB_query($sql3,$db, $ErrMsg); while ($myrow3=DB_fetch_array($result3)){ $TaxAuth = $myrow3['taxauthid']; } - $sql4 = "SELECT * FROM taxauthrates WHERE dispatchtaxprovince='" .$TaxProv ."' AND taxcatid='" .$TaxCat ."' AND taxauthority='" .$TaxAuth ."'"; + $sql4 = "SELECT * FROM taxauthrates + WHERE dispatchtaxprovince='" .$TaxProv ."' + AND taxcatid='" .$TaxCat ."' + AND taxauthority='" .$TaxAuth ."'"; $result4=DB_query($sql4,$db, $ErrMsg); while ($myrow4=DB_fetch_array($result4)){ $TaxClass = 100 * $myrow4['taxrate']; @@ -162,9 +165,9 @@ $LeftOvers = $pdf->addTextWrap(120,$YPos,295,$FontSize,$myrow2['description']); $LeftOvers = $pdf->addTextWrap(180,$YPos,85,$FontSize,$DisplayQty,'right'); $LeftOvers = $pdf->addTextWrap(230,$YPos,85,$FontSize,$DisplayPrice,'right'); - if ($DisplayDiscount > 0){ - $LeftOvers = $pdf->addTextWrap(280,$YPos,85,$FontSize,$DisplayDiscount,'right'); - } + if ($DisplayDiscount > 0){ + $LeftOvers = $pdf->addTextWrap(280,$YPos,85,$FontSize,$DisplayDiscount,'right'); + } $LeftOvers = $pdf->addTextWrap(330,$YPos,85,$FontSize,$DisplayTaxClass,'right'); $LeftOvers = $pdf->addTextWrap(410,$YPos,85,$FontSize,$DisplayTaxAmount,'center'); $LeftOvers = $pdf->addTextWrap(460,$YPos,90,$FontSize,$DisplayTotal,'right'); @@ -185,12 +188,11 @@ } //end while there are line items to print out if ((mb_strlen($myrow['comments']) >200 AND $YPos-$line_height <= 75) - OR (mb_strlen($myrow['comments']) >1 AND $YPos-$line_height <= 62) - OR $YPos-$line_height <= 50){ - /* We reached the end of the page so finsih off the page and start a newy */ - $PageNumber++; - include ('includes/PDFQuotationPageHeader.inc'); - + OR (mb_strlen($myrow['comments']) >1 AND $YPos-$line_height <= 62) + OR $YPos-$line_height <= 50){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + include ('includes/PDFQuotationPageHeader.inc'); } //end if need a new page headed up $LeftOvers = $pdf->addTextWrap($XPos,$YPos-80,200,10,_('Notes:')); @@ -225,28 +227,16 @@ } /*end if there are line details to show on the quotation*/ -//$pdfcode = $pdf->output('PDFQuotation.pdf', 'I'); -//$len = mb_strlen($pdfcode); if ($ListCount == 0){ $title = _('Print Quotation Error'); include('includes/header.inc'); echo '<p>'. _('There were no items on the quotation') . '. ' . _('The quotation cannot be printed'). - '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&Quotation=Quotes_only">'. _('Print Another Quotation'). - '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; + '<br /><a href="' . $rootpath . '/SelectSalesOrder.php?Quotation=Quotes_only">'. _('Print Another Quotation'). + '</a>' . '<br />'. '<a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } else { -/* - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=Quotation.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); -//echo 'here'; - $pdf->Output('PDFQuotation.pdf', 'I'); -*/ - $pdf->OutputI($_SESSION['DatabaseName'] . '_Quotation_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputI($_SESSION['DatabaseName'] . '_Quotation_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } ?> Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PDFStockCheckComparison.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -2,9 +2,6 @@ /* $Id$*/ -/* $Revision: 1.18 $ */ - -//$PageSecurity = 2; include('includes/session.inc'); If (isset($_POST['PrintPDF']) AND isset($_POST['ReportOrClose'])){ @@ -254,7 +251,11 @@ $LeftOvers = $pdf->addTextWrap(135,$YPos,180,$FontSize,$CheckItemRow['description'], 'left'); $LeftOvers = $pdf->addTextWrap(315,$YPos,60,$FontSize,$CheckItemRow['qoh'], 'right'); - $SQL = "SELECT qtycounted, reference FROM stockcounts WHERE loccode ='" . $Location . "' AND stockid = '" . $CheckItemRow['stockid'] . "'"; + $SQL = "SELECT qtycounted, + reference + FROM stockcounts + WHERE loccode ='" . $Location . "' + AND stockid = '" . $CheckItemRow['stockid'] . "'"; $Counts = DB_query($SQL,$db,'','',false,false); @@ -306,33 +307,10 @@ } /*end STOCK comparison while loop */ $YPos -= (2*$line_height); -/* - $pdfcode = $pdf->output(); - $len = mb_strlen($pdfcode); - if ($len<=20){ - $title = _('Print Stock check comparison Error'); - include('includes/header.inc'); - echo '<p>'; - prnMsg( _('There were no Inventory Comparison sheets to print out'), 'error'); - echo '<br /><a href="' . $rootpath . '/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; - include('includes/footer.inc'); - exit; - } else { - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=StockComparison.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_StockComparison_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); - $pdf->Output('StockCheckComparison.pdf', 'I'); - - } -*/ - $pdf->OutputD($_SESSION['DatabaseName'] . '_StockComparison_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN - if ($_POST['ReportOrClose']=='ReportAndClose'){ //need to print the report first before this but don't risk re-adjusting all the stock!! $sql = "TRUNCATE TABLE stockcheckfreeze"; Modified: trunk/PrintCheque.php =================================================================== --- trunk/PrintCheque.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PrintCheque.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -2,10 +2,6 @@ /* $Id$*/ -/* $Revision: 1.5 $ */ - -//$PageSecurity = 5; - include('includes/DefinePaymentClass.php'); include('includes/session.inc'); include('Numbers/Words.php'); @@ -58,8 +54,6 @@ $LeftOvers = $pdf->addTextWrap(375,$YPos,100,$FontSize, number_format($_SESSION['PaymentDetail']->Amount,2), 'right'); - - // remittance advice 1 $YPos -= 14*$line_height; $LeftOvers = $pdf->addTextWrap(0,$YPos,$Page_Width,$FontSize,_('Remittance Advice'), 'center'); @@ -87,26 +81,7 @@ $LeftOvers = $pdf->addTextWrap(100,$YPos,100,$FontSize,$_SESSION['PaymentDetail']->SupplierID, 'left'); $LeftOvers = $pdf->addTextWrap(250,$YPos,75,$FontSize,$_GET['ChequeNum'], 'left'); $LeftOvers = $pdf->addTextWrap(350,$YPos,75,$FontSize,number_format(round($_SESSION['PaymentDetail']->Amount,2),2), 'left'); -/* UldisN -$pdfcode = $pdf->output(); -$len = mb_strlen($pdfcode); -if ($len<=1){ - $title = _('Print Check Error'); - include('includes/header.inc'); - prnMsg(_('Could not print the cheque'),'warn'); - include('includes/footer.inc'); - exit; -} else { - header('Content-type: application/pdf'); - header('Content-Length: ' . $len); - header('Content-Disposition: inline; filename=Cheque.pdf'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - $pdf->Output('PrintCheque.pdf', 'I'); -} -*/ -$pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf');//UldisN -$pdf->__destruct(); //UldisN -?> +$pdf->OutputD($_SESSION['DatabaseName'] . '_Cheque_' . date('Y-m-d') . '_ChequeNum_' . $_GET['ChequeNum'] . '.pdf'); +$pdf->__destruct(); +?> \ No newline at end of file Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2011-07-02 23:04:59 UTC (rev 4618) +++ trunk/PrintCustStatements.php 2011-07-03 03:01:39 UTC (rev 4619) @@ -2,10 +2,6 @@ /* $Id$*/ -/* $Revision: 1.19 $ */ - -//$PageSecurity = 2; - include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -15,6 +11,7 @@ if (isset($_POST['PrintPDF'])) { $PaperSize='A4_Landscape'; } + if (isset($_GET['PrintPDF'])) { $FromCust = $_GET['FromCust']; $ToCust = $_GET['ToCust']; @@ -25,18 +22,16 @@ $PaperSize='A4_Landscape'; } - - if (isset($_GET['FromCust'])) { $getFrom = $_GET['FromCust']; $_POST['FromCust'] = $getFrom; } + if (isset($_GET['ToCust'])) { $getTo = $_GET['ToCust']; $_POST['ToCust'] = $getTo; } - If (isset($_POST['PrintPDF']) && isset($_POST['FromCust']) && $_POST['FromCust']!=''){ $_POST['FromCust'] = strtoupper($_POST['FromCust']); @@ -57,30 +52,30 @@ $ErrMsg = _('There was a problem settling the old transactions.'); $DbgMsg = _('The SQL used to settle outstanding transactions was'); $sql = "UPDATE debtortrans SET settled=1 - WHERE ABS(debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc)<0.009"; + WHERE ABS(debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc)<0.009"; $SettleAsNec = DB_query($sql,$db, $ErrMsg, $DbgMsg); /*Figure out who all the customers in this range are */ $ErrMsg= _('There was a problem retrieving the customer information for the statements from the database'); $sql = "SELECT debtorsmaster.debtorno, - debtorsmaster.name, - debtorsmaster.address1, - debtorsmaster.address2, - debtorsmaster.address3, - debtorsmaster.address4, - debtorsmaster.address5, - debtorsmaster.address6, - debtorsmaster.lastpaid, - debtorsmaster.lastpaiddate, - currencies.currency, - paymentterms.terms - FROM debtorsmaster INNER JOIN currencies - ON debtorsmaster.currcode=currencies.currabrev - INNER JOIN paymentterms - ON debtorsmaster.paymentterms=paymentterms.termsindicator - WHERE debtorsmaster.debtorno >='" . $_POST['FromCust'] ."' - AND debtorsmaster.debtorno <='" . $_POST['ToCust'] ."' - ORDER BY debtorsmaster.debtorno"; + debtorsmaster.name, + debtorsmaster.address1, + debtorsmaster.address2, + debtorsmaster.address3, + debtorsmaster.address4, + debtorsmaster.address5, + debtorsmaster.address6, + debtorsmaster.lastpaid, + debtorsmaster.lastpaiddate, + currencies.currency, + paymentterms.terms + FROM debtorsmaster INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN paymentterms + ON debtorsmaster.paymentterms=paymentterms.termsindicator + WHERE debtorsmaster.debtorno >='" . $_POST['FromCust'] ."' + AND debtorsmaster.debtorno <='" . $_POST['ToCust'] ."' + ORDER BY debtorsmaster.debtorno"; $StatementResults=DB_query($sql,$db, $ErrMsg); if (DB_Num_Rows($StatementResults) == 0){ @@ -99,16 +94,16 @@ /*now get all the outstanding transaction ie Settled=0 */ $ErrMsg = _('There was a problem retrieving the outstanding transactions for') . ' ' . $StmtHeader['name'] . ' '. _('from the database') . '.'; $sql = "SELECT systypes.typename, - debtortrans.transno, - debtortrans.trandate, - debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst as total, - debtortrans.alloc, - debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc as ostdg - FROM debtortrans INNER JOIN systypes - ON debtortrans.type=systypes.typeid - WHERE debtortrans.debtorno='" . $StmtHeader['debtorno'] . "' - AND debtortrans.settled=0 - ORDER BY debtortrans.id"; + debtortrans.transno, + debtortrans.trandate, + debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst as total, + debtortrans.alloc, + debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc as ostdg + FROM debtortrans INNER JOIN systypes + ON debtortrans.type=systypes.typeid + WHERE debtortrans.debtorno='" . $StmtHeader['debtorno'] . "' + AND debtortrans.settled=0 + ORDER BY debtortrans.id"; $OstdgTrans=DB_query($sql,$db, $ErrMsg); @@ -118,22 +113,22 @@ $ErrMsg = _('There was a problem retrieving the transactions that were settled over the course of the last month for'). ' ' . $StmtHeader['name'] . ' ' . _('from the database'); if ($_SESSION['Show_Settled_LastMonth']==1){ $sql = "SELECT DISTINCT debtortrans.id, - systypes.typename, - debtortrans.transno, - debtortrans.trandate, - debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst AS total, - debtortrans.alloc, - debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc AS ostdg - FROM debtortrans INNER JOIN systypes - ON debtortrans.type=systypes.typeid - INNER JOIN custallocns - ON (debtortrans.id=custallocns.transid_allocfrom - OR debtortrans.id=custallocns.transid_allocto) - WHERE custallocns.datealloc >='" . - Date('Y-m-d',Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))) . "' - AND debtortrans.debtorno='" . $StmtHeader['debtorno'] . "' - AND debtortrans.settled=1 - ORDER BY debtortrans.id"; + systypes.typename, + debtortrans.transno, + debtortrans.trandate, + debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst AS total, + debtortrans.alloc, + debtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc AS ostdg + FROM debtortrans INNER JOIN systypes + ON debtortrans.type=systypes.typeid + INNER JOIN custallocns + ON (debtortrans.id=custallocns.transid_allocfrom + OR debtortrans.id=custallocns.transid_allocto) + WHERE custallocns.datealloc >='" . + Date('Y-m-d',Mktime(0,0,0,Date('m')-1,Date('d'),Date('y'))) . "' + AND debtortrans.debtorno='" . $StmtHeader['debtorno'] . "' + AND debtortrans.settled=1 + ORDER BY debtortrans.id"; $SetldTrans=DB_query($sql,$db, $ErrMsg); $NumberOfRecordsReturned += DB_num_rows($SetldTrans); @@ -273,72 +268,72 @@ /*Now figure out the aged analysis for the customer under review */ $SQL = "SELECT debtorsmaster.name, - currencies.currency, - paymentterms.terms, - debtorsmaster.creditlimit, - holdreasons.dissallowinvoices, - holdreasons.reasondescription, - SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc) AS balance, - SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= - paymentterms.daysbeforedue - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1', 'MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= 0 - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - END) AS due, - Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN - CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue - AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= - (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1','MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') .")) >= " . $_SESSION['PastDueDays1'] . ") - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - END) AS overdue1, - Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN - CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue - AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + - " . $_SESSION['PastDueDays2'] . ") - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - ELSE - CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1','MONTH') . "), " . - interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) - >= " . $_SESSION['PastDueDays2'] . ") - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + - debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END - END) AS overdue2 - FROM debtorsmaster INNER JOIN paymentterms - ON debtorsmaster.paymentterms = paymentterms.termsindicator - INNER JOIN currencies - ON debtorsmaster.currcode = currencies.currabrev - INNER JOIN holdreasons - ON debtorsmaster.holdreason = holdreasons.reasoncode - INNER JOIN debtortrans - ON debtorsmaster.debtorno = debtortrans.debtorno - WHERE - debtorsmaster.debtorno = '" . $StmtHeader['debtorno'] . "' - GROUP BY - debtorsmaster.name, - currencies.currency, - paymentterms.terms, - paymentterms.daysbeforedue, - paymentterms.dayinfollowingmonth, - debtorsmaster.creditlimit, - holdreasons.dissallowinvoices, - holdreasons.reasondescription"; + currencies.currency, + paymentterms.terms, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription, + SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc) AS balance, + SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= + paymentterms.daysbeforedue + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + ELSE + CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1', 'MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= 0 + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + END) AS due, + Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN + CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue + AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= + (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ") + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + ELSE + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1','MONTH') . "), " . interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') .")) >= " . $_SESSION['PastDueDays1'] . ") + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + END) AS overdue1, + Sum(CASE WHEN paymentterms.daysbeforedue > 0 THEN + CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue + AND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + + " . $_SESSION['PastDueDays2'] . ") + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + ELSE + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . interval('1','MONTH') . "), " . + interval('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) + >= " . $_SESSION['PastDueDays2'] . ") + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END + END) AS overdue2 + FROM debtorsmaster INNER JOIN paymentterms + ON debtorsmaster.paymentterms = paymentterms.termsindicator + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + INNER JOIN holdreasons + ON debtorsmaster.holdreason = holdreasons.reasoncode + INNER JOIN debtortrans + ON debtorsmaster.debtorno = debtortrans.debtorno + WHERE + debtorsmaster.debtorno = '" . $StmtHeader['debtorno'] . "' + GROUP BY + debtorsmaster.name, + currencies.currency, + paymentterms.terms, + paymentterms.daysbeforedue, + paymentterms.dayinfollowingmonth, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription"; $ErrMsg = 'The customer detail... [truncated message content] |