From: <tu...@us...> - 2018-01-27 22:59:21
|
Revision: 7926 http://sourceforge.net/p/web-erp/reponame/7926 Author: turbopt Date: 2018-01-27 22:59:18 +0000 (Sat, 27 Jan 2018) Log Message: ----------- Paul Becker (PaulT commit): Remove stray ; appearing after if, else, and foreach blocks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8064) Modified Paths: -------------- trunk/CustItem.php trunk/Factors.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/PcClaimExpensesFromTab.php trunk/PurchData.php trunk/SupplierPriceList.php trunk/SystemParameters.php trunk/doc/Change.log trunk/includes/MiscFunctions.php trunk/includes/class.pdf.php trunk/javascripts/MiscFunctions.js Modified: trunk/CustItem.php =================================================================== --- trunk/CustItem.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/CustItem.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -229,7 +229,7 @@ </form>'; include ('includes/footer.php'); exit; - }; + } } if ($Edit == true) { Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/Factors.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -20,7 +20,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; $_POST['New'] = 'Yes'; -}; +} echo '<div class="centre"><p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Factor Companies') . '" alt="" />' . ' ' .$Title . '</p></div>'; Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/MRPPlannedPurchaseOrders.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -333,7 +333,7 @@ $displayconsolidation = _('Weekly'); } else { $displayconsolidation = _('Monthly'); - }; + } $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/MRPPlannedWorkOrders.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -376,7 +376,7 @@ $displayconsolidation = _('Weekly'); } else { $displayconsolidation = _('Monthly'); - }; + } $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/PcClaimExpensesFromTab.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -127,7 +127,7 @@ $UploadTheFile ='No'; } if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist mkdir($ReceiptFileDir, 0775, true); } $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file @@ -134,12 +134,12 @@ $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. unlink($ReceiptExistingFile); - }; + } move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. } - } + } prnMsg($Msg, 'success'); } elseif ($InputError != 1) { // First check the type is not being duplicated @@ -232,7 +232,7 @@ $UploadTheFile ='No'; } if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist mkdir($ReceiptFileDir, 0775, true); } $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file @@ -239,12 +239,12 @@ $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. unlink($ReceiptExistingFile); - }; + } move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. } - } + } prnMsg($Msg, 'success'); } if ($InputError != 1) { @@ -268,7 +268,7 @@ $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory foreach($ReceiptExistingFiles as $ReceiptExistingFile) { unlink($ReceiptExistingFile); - }; + } unset($_GET['delete']); } //end of get delete if (!isset($SelectedTabs)) { @@ -333,7 +333,7 @@ <td>' . $SelectedTabs . '</td> </tr>'; echo '</table>'; - + //Limit expenses history to X days echo '<table class="selection"> <tr> @@ -392,19 +392,19 @@ WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; $ResultDes = DB_query($SQLDes); $Description = DB_fetch_array($ResultDes); - + if (!isset($Description[0])) { $ExpenseCodeDes = 'ASSIGNCASH'; } else { $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; } - + if ($MyRow['authorized'] == '0000-00-00') { $AuthorisedDate = _('Unauthorised'); } else { $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); } - + //Generate download link for expense receipt, or show text if no receipt file is found. $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found @@ -414,7 +414,7 @@ } else { $ReceiptText = _('No attachment'); } - + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; $TagResult = DB_query($TagSQL); $TagRow = DB_fetch_array($TagResult); @@ -427,7 +427,7 @@ } else { $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; } - + $TaxesDescription = ''; $TaxesTaxAmount = ''; $TaxSQL = "SELECT counterindex, @@ -630,7 +630,7 @@ ++$i; } } - + //Select the tag echo '<tr> <td>', _('Tag'), ':</td> @@ -655,7 +655,7 @@ </td> </tr>'; // End select tag - + //For the accept attribute of the file element, prefix dots to the front of each supported file extension. $ReceiptSupportedExtDotPrefix = array_map(function($ReceiptSupportedExt) { return '.' . $ReceiptSupportedExt; @@ -667,7 +667,7 @@ <input type="file" name="Receipt" id="Receipt" accept="' . implode(',', $ReceiptSupportedExtDotPrefix) . '" title="', _('Accepted file types'), ': ', implode(', ', $ReceiptSupportedExt), '" /> </td> </tr>'; - + if (!isset($_POST['Notes'])) { $_POST['Notes'] = ''; } @@ -677,7 +677,7 @@ <input type="text" name="Notes" size="50" maxlength="49" value="', $_POST['Notes'], '" /> </td> </tr>'; - + echo '</table>'; // close main table echo '<input type="hidden" name="SelectedTabs" value="', $SelectedTabs, '" />'; echo '<input type="hidden" name="Days" value="', $Days, '" />'; Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/PurchData.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -392,7 +392,7 @@ </form>'; include ('includes/footer.php'); exit; - }; + } } if ($Edit == true) { Modified: trunk/SupplierPriceList.php =================================================================== --- trunk/SupplierPriceList.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/SupplierPriceList.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -419,7 +419,7 @@ echo '</form>'; include ('includes/footer.php'); exit; - }; + } } if(isset($_POST['SearchSupplier'])) { Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/SystemParameters.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -1243,7 +1243,7 @@ } elseif ($_SESSION['QualityLogSamples'] == 1){ echo '<option select="selected" value="1">' . _('Yes') . '</option>'; echo '<option value="0">' . _('No') . '</option>'; - }; + } echo '</select> </td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/doc/Change.log 2018-01-27 22:59:18 UTC (rev 7926) @@ -1,6 +1,7 @@ webERP Change Log -27/1/17 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). +27/1/18 Paul Becker (PaulT commit): Remove stray ; appearing after if, else, and foreach blocks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8064) +27/1/18 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). 26/1/18 Andrew Galuski/Tim (PaulT merge/commit): New picking list feature for regular and controlled/serialized stock. This feature improves (and replaces) the current pick list handling. (Reported in forums by HDeriauFF: http://www.weberp.org/forum/showthread.php?tid=7988) 26/1/18 Exson: Add single quotation escape and charset in htmlspecialchars() in session.inc 26/1/18 Exson: Use htmlspecialchars() to encode html special characters to html entity and set the cookie available only httponly in session.inc Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/includes/MiscFunctions.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -139,7 +139,7 @@ var $attributes; var $content; var $children; -}; +} function GetECBCurrencyRates () { /* See http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/includes/class.pdf.php 2018-01-27 22:59:18 UTC (rev 7926) @@ -144,7 +144,7 @@ $ns=0; $cw = $this->GetStringWidth($s, '', '', 0, true); while($i<$nb) { - /*$c=$s{$i};*/ + $c=mb_substr($s, $i, 1, 'UTF-8'); if($c===' ' AND $i>0) { $sep=$i; Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2018-01-27 19:11:13 UTC (rev 7925) +++ trunk/javascripts/MiscFunctions.js 2018-01-27 22:59:18 UTC (rev 7926) @@ -59,7 +59,7 @@ } else { this.setCustomValidity('The number format is wrong'); return false; - }; + } } function assignComboToInput(c, i) { |
From: <tu...@us...> - 2018-02-01 01:38:59
|
Revision: 7928 http://sourceforge.net/p/web-erp/reponame/7928 Author: turbopt Date: 2018-02-01 01:38:56 +0000 (Thu, 01 Feb 2018) Log Message: ----------- Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/MiscFunctions.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-01-28 01:03:00 UTC (rev 7927) +++ trunk/doc/Change.log 2018-02-01 01:38:56 UTC (rev 7928) @@ -1,6 +1,7 @@ webERP Change Log -27/1/18 PaulT: Remove unused $db parameter from DB_query(), DB_error_no() and DB_error_msg() other DB-related function calls. +31/1/18 PaulT: Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message. +27/1/18 PaulT: Remove unused $db parameter from DB_query(), DB_error_no(), DB_error_msg() and other DB-related function calls. 27/1/18 Paul Becker (PaulT commit): Remove stray ; appearing after if, else, and foreach blocks. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8064) 27/1/18 PaulT: MiscFunctions.php, Z_ChangeStockCode.php, Z_ChangeGLAccountCode.php: Remove unused $db parameter from function ChangeFieldInTable(). 26/1/18 Andrew Galuski/Tim (PaulT merge/commit): New picking list feature for regular and controlled/serialized stock. This feature improves (and replaces) the current pick list handling. (Reported in forums by HDeriauFF: http://www.weberp.org/forum/showthread.php?tid=7988) Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2018-01-28 01:03:00 UTC (rev 7927) +++ trunk/includes/MiscFunctions.php 2018-02-01 01:38:56 UTC (rev 7928) @@ -31,6 +31,7 @@ } break; case 'warn': + case 'warning': $Class = 'warn'; $Prefix = $Prefix ? $Prefix : _('WARNING') . ' ' . _('Message Report'); if (isset($_SESSION['LogSeverity']) and $_SESSION['LogSeverity']>1) { |
From: <tu...@us...> - 2018-02-03 00:27:44
|
Revision: 7931 http://sourceforge.net/p/web-erp/reponame/7931 Author: turbopt Date: 2018-02-03 00:27:41 +0000 (Sat, 03 Feb 2018) Log Message: ----------- PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115) Modified Paths: -------------- trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/doc/Change.log trunk/includes/PDFTransPageHeader.inc trunk/includes/PDFTransPageHeaderPortrait.inc Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2018-02-01 14:09:34 UTC (rev 7930) +++ trunk/PrintCustTrans.php 2018-02-03 00:27:41 UTC (rev 7931) @@ -8,9 +8,11 @@ $BookMark = 'PrintInvoicesCredits'; if (isset($_GET['FromTransNo'])) { - $FromTransNo = trim($_GET['FromTransNo']); + $FromTransNo = filter_number_format($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { $FromTransNo = filter_number_format($_POST['FromTransNo']); +} else { + $FromTransNo = ''; } if (isset($_GET['InvOrCredit'])) { @@ -20,9 +22,9 @@ } if (isset($_GET['PrintPDF'])) { - $PrintPDF = TRUE; + $PrintPDF = $_GET['PrintPDF']; } elseif (isset($_POST['PrintPDF'])) { - $PrintPDF = TRUE; + $PrintPDF = $_POST['PrintPDF']; } if (!isset($_POST['ToTransNo']) @@ -34,24 +36,15 @@ $FirstTrans = $FromTransNo; /* Need to start a new page only on subsequent transactions */ -if (isset($PrintPDF) AND isset($FromTransNo) AND isset($InvOrCredit)){ +if (isset($PrintPDF) + and $PrintPDF!='' + and isset($FromTransNo) + and isset($InvOrCredit) + and $FromTransNo!='') { - include ('includes/class.pdf.php'); + $PaperSize = 'A4_Landscape'; + include ('includes/PDFStarter.php'); - /* This invoice is hard coded for A4 Landscape invoices or credit notes so can't use PDFStarter.inc */ - - $Page_Width=842; - $Page_Height=595; - $Top_Margin=30; - $Bottom_Margin=30; - $Left_Margin=40; - $Right_Margin=30; - - - $pdf = new Cpdf('L', 'pt', 'A4'); - $pdf->addInfo('Creator', 'webERP http://www.weberp.org'); - $pdf->addInfo('Author', 'webERP ' . $Version); - if ($InvOrCredit=='Invoice') { $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); $pdf->addInfo('Subject',_('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); @@ -60,13 +53,6 @@ $pdf->addInfo('Subject',_('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } - $pdf->setAutoPageBreak(0); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - $pdf->AddPage(); - $pdf->cMargin = 0; -/* END Brought from class.pdf.php constructor */ - $FirstPage = true; $line_height=16; @@ -79,6 +65,28 @@ notice that salesorder record must be present to print the invoice purging of sales orders will nobble the invoice reprints */ + // check if the user has set a default bank account for invoices, if not leave it blank + $sql = "SELECT bankaccounts.invoice, + bankaccounts.bankaccountnumber, + bankaccounts.bankaccountcode + FROM bankaccounts + WHERE bankaccounts.invoice = '1'"; + $result=DB_query($sql,'','',false,false); + if(DB_error_no()!=1) { + if(DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); + $DefaultBankAccountNumber = _('Account') .': ' .$myrow['bankaccountnumber']; + $DefaultBankAccountCode = _('Bank Code:') .' ' .$myrow['bankaccountcode']; + } else { + $DefaultBankAccountNumber = ''; + $DefaultBankAccountCode = ''; + } + } else { + $DefaultBankAccountNumber = ''; + $DefaultBankAccountCode = ''; + } +// gather the invoice data + if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, @@ -87,8 +95,8 @@ debtortrans.ovgst, debtortrans.rate, debtortrans.invtext, + debtortrans.consignment, debtortrans.packages, - debtortrans.consignment, debtorsmaster.name, debtorsmaster.address1, debtorsmaster.address2, @@ -101,6 +109,8 @@ debtorsmaster.taxref, debtorsmaster.language_id, paymentterms.terms, + paymentterms.dayinfollowingmonth, + paymentterms.daysbeforedue, salesorders.deliverto, salesorders.deladd1, salesorders.deladd2, @@ -126,8 +136,8 @@ custbranch.brpostaddr4, custbranch.brpostaddr5, custbranch.brpostaddr6, + custbranch.salesman, salesman.salesmanname, - salesman.salesmancode, debtortrans.debtorno, debtortrans.branchcode, currencies.decimalplaces @@ -153,10 +163,10 @@ WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; - if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { - $sql = $sql . " AND debtorsmaster.ediinvoices=0"; + if(isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { + $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; } - } else { + } else {/* then its a credit note */ $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -188,11 +198,10 @@ custbranch.brpostaddr4, custbranch.brpostaddr5, custbranch.brpostaddr6, + custbranch.salesman, salesman.salesmanname, - salesman.salesmancode, debtortrans.debtorno, debtortrans.branchcode, - paymentterms.terms, currencies.decimalplaces FROM debtortrans INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno @@ -201,19 +210,18 @@ AND debtortrans.branchcode=custbranch.branchcode INNER JOIN salesman ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms - ON debtorsmaster.paymentterms=paymentterms.termsindicator INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 AND debtortrans.transno='" . $FromTransNo . "'"; - if (isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { - $sql = $sql . " AND debtorsmaster.ediinvoices=0"; + + if(isset($_POST['PrintEDI']) AND $_POST['PrintEDI']=='No') { + $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; } } // end else - $result=DB_query($sql, '', '',false, false); + $result=DB_query($sql,'','',false, false); if (DB_error_no()!=0) { $Title = _('Transaction Print Error Report'); @@ -227,19 +235,22 @@ } if (DB_num_rows($result)==1) { $myrow = DB_fetch_array($result); - if ($_SESSION['SalesmanLogin']!='' AND $_SESSION['SalesmanLogin']!=$myrow['salesman']){ - prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to view transaction for this order'),'error'); - include('includes/footer.inc'); - exit; + + if ( $_SESSION['SalesmanLogin'] != '' AND $_SESSION['SalesmanLogin'] != $myrow['salesman'] ){ + $Title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.php'); + prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to view transaction for this order'),'error'); + include('includes/footer.php'); + exit; } - if (count($_SESSION['AllowedPageSecurityTokens'])==2 - AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) - AND $myrow['debtorno'] != $_SESSION['CustomerID']){ + if ( $CustomerLogin == 1 AND $myrow['debtorno'] != $_SESSION['CustomerID'] ){ + $Title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.php'); + echo '<p class="bad">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company').'</p>'; + include('includes/footer.php'); + exit; + } - echo '<p class="bad">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company').'</p>'; - exit; - } - $ExchRate = $myrow['rate']; //Change the language to the customer's language @@ -256,12 +267,15 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, + stockmaster.controlled, + stockmaster.serialised, stockmaster.units, + stockmoves.stkmoveno, stockmaster.decimalplaces FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ @@ -272,17 +286,20 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, + stockmaster.controlled, + stockmaster.serialised, stockmaster.units, + stockmoves.stkmoveno, stockmaster.decimalplaces FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=11 - AND stockmoves.transno=" . $FromTransNo . " + AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; } // end else $result=DB_query($sql); - if (DB_error_no()!=0 OR (DB_num_rows($result)==0 AND $InvOrCredit == 'Invoice')) { + if(DB_error_no()!=0) { $Title = _('Transaction Print Error Report'); include ('includes/header.php'); @@ -292,15 +309,23 @@ } include('includes/footer.php'); exit; - } else { + } + if ($InvOrCredit=='Invoice') { + /* Calculate Due Date info. This reference is used in the PDFTransPageHeader.inc file. */ + $DisplayDueDate = CalcDueDate(ConvertSQLDate($myrow['trandate']), $myrow['dayinfollowingmonth'], $myrow['daysbeforedue']); + } + + if (DB_num_rows($result)>0) { + $FontSize = 10; $PageNumber = 1; include('includes/PDFTransPageHeader.inc'); $FirstPage = False; + + while ($myrow2=DB_fetch_array($result)) { - if ($myrow2['discountpercent']==0) { $DisplayDiscount =''; } else { @@ -324,6 +349,13 @@ } else { $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,251,$FontSize,$myrow2['description']); } + + $lines=1; + while($LeftOvers!='') { + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,251,$FontSize,$LeftOvers); + $lines++; + } + $LeftOvers = $pdf->addTextWrap($Left_Margin+353,$YPos,96,$FontSize,$DisplayPrice,'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+453,$YPos,95,$FontSize,$DisplayQty,'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+553,$YPos,35,$FontSize,$myrow2['units'],'centre'); @@ -330,6 +362,39 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+590,$YPos,50,$FontSize,$DisplayDiscount,'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos,120,$FontSize,$DisplayNet,'right'); + if($myrow2['controlled']==1) { + + $GetControlMovts = DB_query(" + SELECT + moveqty, + serialno + FROM stockserialmoves + WHERE stockmoveno='" . $myrow2['stkmoveno'] . "'"); + + if($myrow2['serialised']==1) { + while($ControlledMovtRow = DB_fetch_array($GetControlMovts)) { + $YPos -= ($line_height); + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,100,$FontSize,$ControlledMovtRow['serialno'],'left'); + if($YPos-$line_height <= $Bottom_Margin) { + /* head up a new invoice/credit note page */ + /*draw the vertical column lines right to the bottom */ + PrintLinesToBottom (); + include ('includes/PDFTransPageHeaderPortrait.inc'); + } //end if need a new page headed up + } + } else { + while($ControlledMovtRow = DB_fetch_array($GetControlMovts)) { + $YPos -= ($line_height); + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,100,$FontSize,(-$ControlledMovtRow['moveqty']) . ' x ' . $ControlledMovtRow['serialno'], 'left'); + if($YPos-$line_height <= $Bottom_Margin) { + /* head up a new invoice/credit note page */ + /*draw the vertical column lines right to the bottom */ + PrintLinesToBottom (); + include ('includes/PDFTransPageHeaderPortrait.inc'); + } //end if need a new page headed up + } + } + } $YPos -= ($line_height); $lines=explode("\r\n",htmlspecialchars_decode($myrow2['narrative'])); @@ -339,18 +404,19 @@ /* head up a new invoice/credit note page */ /* draw the vertical column lines right to the bottom */ PrintLinesToBottom (); - include ('includes/PDFTransPageHeader.inc'); - } //end if need a new page headed up + include ('includes/PDFTransPageHeader.inc'); + } //end if need a new page headed up - /* increment a line down for the next line item */ - if (mb_strlen($lines[$i])>1){ + /* increment a line down for the next line item */ + if (mb_strlen($lines[$i])>1){ $lines[$i] = $pdf->addTextWrap($Left_Margin+100,$YPos,245,$FontSize,stripslashes($lines[$i])); } $YPos -= ($line_height); } } //end for loop around lines of narrative to display + + if ($YPos <= $Bottom_Margin) { - /* head up a new invoice/credit note page */ /*draw the vertical column lines right to the bottom */ PrintLinesToBottom (); @@ -357,7 +423,7 @@ include ('includes/PDFTransPageHeader.inc'); } //end if need a new page headed up - } //end while there invoice are line items to print out + } //end while there are line items to print out } /*end if there are stock movements to show on the invoice or credit note*/ $YPos -= $line_height; @@ -368,7 +434,8 @@ include ('includes/PDFTransPageHeader.inc'); } /* Print a column vertical line with enough space for the footer */ - /* draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc */ + /* draw the vertical column lines to 4 lines shy of the bottom + to leave space for invoice footer info ie totals etc */ $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin+(4*$line_height)); /* Print a column vertical line */ @@ -404,20 +471,16 @@ $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } - /* Print out the invoice text entered */ + $YPos = $Bottom_Margin+(3*$line_height); - /* Print out the payment terms */ - $pdf->addTextWrap($Left_Margin+5,$YPos+3,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); - // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); - // $FontSize=10; - + /* Print out the invoice text entered */ $FontSize =8; - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-12,280,$FontSize,$myrow['invtext']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-12,270,$FontSize,$myrow['invtext']); if (mb_strlen($LeftOvers)>0) { - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,280,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,270,$FontSize,$LeftOvers); if (mb_strlen($LeftOvers)>0) { - $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,280,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,270,$FontSize,$LeftOvers); /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ } } @@ -427,7 +490,7 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos+5,120,$FontSize,$DisplaySubTot, 'right'); $pdf->addText($Page_Width-$Right_Margin-220, $YPos+2,$FontSize, _('Freight')); - $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-6,120,$FontSize,$DisplayFreight, 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-8,120,$FontSize,$DisplayFreight, 'right'); $pdf->addText($Page_Width-$Right_Margin-220, $YPos-10,$FontSize, _('Tax')); $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-($line_height)-5,120, $FontSize,$DisplayTax, 'right'); @@ -440,47 +503,26 @@ $YPos+=10; if ($InvOrCredit=='Invoice') { + /* Print out the payment terms */ + $pdf->addTextWrap($Left_Margin+5,$YPos-5,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); + $pdf->addText($Page_Width-$Right_Margin-220, $YPos - ($line_height*2)-10,$FontSize, _('TOTAL INVOICE')); $FontSize=9; $YPos-=4; - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$_SESSION['RomalpaClause']); + + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,260,$FontSize,$_SESSION['RomalpaClause']); while (mb_strlen($LeftOvers)>0 AND $YPos > $Bottom_Margin) { $YPos-=12; - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,260,$FontSize,$LeftOvers); } - /*print out bank details */ - /*Get currency default for the currency of the invocie */ - $PrintBankDetails = true; //assume we print bank details by default - $BankResult = DB_query("SELECT bankaddress, - bankaccountnumber, - bankaccountcode - FROM bankaccounts - WHERE invoice=2 - AND currcode='" . $myrow['currcode'] . "'"); - if (DB_num_rows($BankResult)==0){ - /* If no currency default check the fall back default */ - $BankResult = DB_query("SELECT bankaddress, - bankaccountnumber, - bankaccountcode - FROM bankaccounts - WHERE invoice=1"); - if (DB_num_rows($BankResult)==0){ - $PrintBankDetails = false; - } - } - if ($PrintBankDetails){ - $BankDetailsRow = DB_fetch_array($BankResult); - $YPos-=4; - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaddress']); - $YPos-=12; - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$BankDetailsRow['bankaccountcode'] . ' ' . _('Account No:') . ' ' . $BankDetailsRow['bankaccountnumber']); - } /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); } - $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, ''); + + // Print Bank acount details if available and default for invoices is selected + $pdf->addText($Page_Width-$Right_Margin-490, $YPos - ($line_height*3)+32,$FontSize, $DefaultBankAccountCode . ' ' . $DefaultBankAccountNumber); $FontSize=10; } else { $pdf->addText($Page_Width-$Right_Margin-220, $YPos-($line_height*2)-10,$FontSize, _('TOTAL CREDIT')); @@ -495,8 +537,8 @@ $FromTransNo--; if (isset($_GET['Email'])){ //email the invoice to address supplied - include('includes/header.php'); + include ('includes/htmlMimeMail.php'); $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'; $pdf->Output($FileName,'F'); @@ -526,7 +568,7 @@ } $pdf->__destruct(); - //Now change the language back to the user's language + //Change the language back to the user's language $_SESSION['Language'] = $UserLanguage; include('includes/LanguageSetup.php'); @@ -540,12 +582,16 @@ /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; - echo '<div>'; + echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<div class="centre"><p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</p></div>'; - echo '<table class="table1"> - <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name="InvOrCredit">'; + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</p>'; + + echo '<table class="selection"> + <tr> + <td>' . _('Print Invoices or Credit Notes') . '</td> + <td><select name="InvOrCredit">'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { echo '<option selected="selected" value="Invoice">' . _('Invoices') . '</option>'; @@ -555,8 +601,11 @@ echo '<option value="Invoice">' . _('Invoices') . '</option>'; } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name="PrintEDI">'; + echo '</select></td> + </tr> + <tr> + <td>', _('Print EDI Transactions'), '</td> + <td><select name="PrintEDI">'; if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { @@ -569,16 +618,23 @@ echo '<option selected="selected" value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input type="text" class="number" maxlength="6" size="7" name="FromTransNo" /></td></tr>'; - echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input type="text" class="number" maxlength="6" size="7" name="ToTransNo" /></td></tr> + echo '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Start invoice/credit note number to print') . '</td> + <td><input class="number" type="text" maxlength="6" size="7" name="FromTransNo" required="required" /></td> + </tr>'; + echo '<tr> + <td>' . _('End invoice/credit note number to print') . '</td> + <td><input class="number" type="text" maxlength="6" size="7" name="ToTransNo" /></td> + </tr> </table>'; - echo '<div class="centre">'; - echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /><br /><br /></div>'; - echo '</div> - </form>'; + echo '<div class="centre"> + <br /> + <input type="submit" name="Print" value="' . _('Print Preview') . '" /> + <br /> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div><br>'; $sql = "SELECT typeno FROM systypes WHERE typeid=10"; @@ -592,13 +648,13 @@ $result = DB_query($sql); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b> - <br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . - '</div>'; + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</div>'; - } else { + echo '</div> + </form>'; + } else { // A FromTransNo number IS set - while ($FromTransNo <= filter_number_format($_POST['ToTransNo'])) { + while($FromTransNo <= filter_number_format($_POST['ToTransNo'])) { /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will @@ -640,10 +696,13 @@ custbranch.braddress4, custbranch.braddress5, custbranch.braddress6, + custbranch.salesman, salesman.salesmanname, - salesman.salesmancode, debtortrans.debtorno, - currencies.decimalplaces + currencies.decimalplaces, + paymentterms.dayinfollowingmonth, + paymentterms.daysbeforedue, + paymentterms.terms FROM debtortrans INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno INNER JOIN custbranch @@ -665,7 +724,7 @@ ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=10 AND debtortrans.transno='" . $FromTransNo . "'"; - } else { + } else { /* then its a credit note */ $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, @@ -689,8 +748,8 @@ custbranch.braddress4, custbranch.braddress5, custbranch.braddress6, + custbranch.salesman, salesman.salesmanname, - salesman.salesmancode, debtortrans.debtorno, currencies.decimalplaces FROM debtortrans INNER JOIN debtorsmaster @@ -700,8 +759,6 @@ AND debtortrans.branchcode=custbranch.branchcode INNER JOIN salesman ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms - ON debtorsmaster.paymentterms=paymentterms.termsindicator INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 @@ -709,28 +766,27 @@ } $result=DB_query($sql); - if ((DB_num_rows($result)==0 AND $InvOrCredit == 'Invoice') OR (DB_error_no()!=0)) { + if(DB_num_rows($result)==0 OR DB_error_no()!=0) { echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $FromTransNo . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'); if ($debug==1) { - echo _('The SQL used to get this information that failed was') . '<br />' . $sql; + prnMsg( _('The SQL used to get this information that failed was') . '<br />' . $sql, 'warn'); } break; include('includes/footer.php'); exit; } elseif (DB_num_rows($result)==1) { + /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ $myrow = DB_fetch_array($result); + if ($_SESSION['SalesmanLogin']!='' AND $_SESSION['SalesmanLogin']!=$myrow['salesman']){ - prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to see transaction for this order'),'error'); - include('includes/footer.inc'); + prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to view transaction for this order'),'error'); + include('includes/footer.php'); exit; } - /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens'])==2 - AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) - AND $myrow['debtorno'] != $_SESSION['CustomerID']){ - + if( $CustomerLogin == 1 AND $myrow['debtorno'] != $_SESSION['CustomerID']) { echo '<p class="bad">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); + include('includes/footer.php'); exit; } @@ -737,93 +793,125 @@ $ExchRate = $myrow['rate']; $PageNumber = 1; - /* Now print out the logo and company name and address */ - echo '<table style="width:100%">'; - /* Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<tr><td><b>' . _('Charge To') . ':</b>'; - echo '<br />' . $myrow['name'] . - '<br />' . $myrow['address1'] . - '<br />' . $myrow['address2'] . - '<br />' . $myrow['address3'] . - '<br />' . $myrow['address4'] . - '<br />' . $myrow['address5'] . - '<br />' . $myrow['address6']; - echo '</td>'; + echo '<table class="table1"> + <tr> + <td valign="top" style="width:10%"><img src="' . $_SESSION['LogoFile'] . '" alt="" /></td> + <td style="background-color:#bbbbbb">'; - echo '<td><h2>' . $_SESSION['CompanyRecord']['coyname'] . '</h2><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td>'; + if ($InvOrCredit=='Invoice') { + echo '<h2>' . _('TAX INVOICE') . ' '; + } else { + echo '<h2 style="color:red">' . _('TAX CREDIT NOTE') . ' '; + } + echo _('Number') . ' ' . $FromTransNo . '</h2> + <br />' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno']; - echo '<td align="right">'; - if ($InvOrCredit=='Invoice') { - echo '<h2>' . _('TAX INVOICE') . '</h2>'; - } else { - echo '<h2 style="color:red">' . _('TAX CREDIT NOTE') . '</h2>'; - } - echo '<br />' . _('Number') . ' ' . $FromTransNo . '<br />' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td> - </tr>'; + if ( $InvOrCredit == 'Invoice' ) { + /* Print payment terms and due date */ + $DisplayDueDate = CalcDueDate(ConvertSQLDate($myrow['trandate']), $myrow['dayinfollowingmonth'], $myrow['daysbeforedue']); + echo '<br />' . _('Payment Terms') . ': '. $myrow['terms'] . '<br />' . _('Due Date') . ': ' . $DisplayDueDate; + } - echo '<tr><td align="left"><b>' . _('Charge Branch') . ':</b>'; - echo '<br />' . $myrow['brname'] . - '<br />' . $myrow['braddress1'] . - '<br />' . $myrow['braddress2'] . - '<br />' . $myrow['braddress3'] . - '<br />' . $myrow['braddress4'] . - '<br />' . $myrow['braddress5'] . - '<br />' . $myrow['braddress6'] . '</td>'; + echo '</td> + </tr> + </table>'; - if ($InvOrCredit=='Invoice') { - echo '<td align="left"><b>' . _('Delivered To') . ':</b>'; - echo '<br />' . $myrow['deliverto'] . - '<br />' . $myrow['deladd1'] . - '<br />' . $myrow['deladd2'] . - '<br />' . $myrow['deladd3'] . - '<br />' . $myrow['deladd4'] . - '<br />' . $myrow['deladd5'] . - '<br />' . $myrow['deladd6'] . '</td>'; - } - else { - echo '<td></td>'; - } + /* Main table with customer name and charge to info. */ + echo '<table class="table1"> + <tr> + <td><h2>' . $_SESSION['CompanyRecord']['coyname'] . '</h2> + <br />'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '<td align="right">'; - echo '<br /><b>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</b>'; echo '</td> - </tr> - </table>'; - /*end of the main table showing the company name and charge to details */ + <td style="width:50%" class="number">'; + /* Put the customer charged to details in a sub table within a cell of the main table*/ + + echo '<table class="table1"> + <tr> + <th style="background-color:#bbbbbb">' . _('Charge To') . ':</th> + </tr> + <tr> + <td>'; + echo $myrow['name'] . + '<br />' . $myrow['address1'] . + '<br />' . $myrow['address2'] . + '<br />' . $myrow['address3'] . + '<br />' . $myrow['address4'] . + '<br />' . $myrow['address5'] . + '<br />' . $myrow['address6']; + + echo '</td> + </tr> + </table>'; + /*end of the small table showing charge to account details */ + echo _('Page') . ': ' . $PageNumber; + echo '</td> + </tr> + </table>'; + /*end of the main table showing the company name and charge to details */ + if ($InvOrCredit=='Invoice') { + /* Table with Charge Branch and Delivered To info. */ + echo '<table class="table1"> + <tr> + <th style="background-color:#bbbbbb">' . _('Charge Branch') . ':</th> + <th style="background-color:#bbbbbb">' . _('Delivered To') . ':</th> + </tr>'; + echo '<tr> + <td>' . $myrow['brname'] . + '<br />' . $myrow['braddress1'] . + '<br />' . $myrow['braddress2'] . + '<br />' . $myrow['braddress3'] . + '<br />' . $myrow['braddress4'] . + '<br />' . $myrow['braddress5'] . + '<br />' . $myrow['braddress6'] . + '</td>'; - echo '<table style="width:100%"><tr> - <th><b>' . _('Your Order Ref') . '</b></th> - <th><b>' . _('Our Order No') . '</b></th> - <th><b>' . _('Order Date') . '</b></th> - <th><b>' . _('Invoice Date') . '</b></th> - <th><b>' . _('Sales Person') . '</b></th> - <th><b>' . _('Shipper') . '</b></th> - <th><b>' . _('Consignment Ref') . '</b></th> + echo '<td>' . $myrow['deliverto'] . + '<br />' . $myrow['deladd1'] . + '<br />' . $myrow['deladd2'] . + '<br />' . $myrow['deladd3'] . + '<br />' . $myrow['deladd4'] . + '<br />' . $myrow['deladd5'] . + '<br />' . $myrow['deladd6'] . + '</td>'; + echo '</tr> + </table><hr />'; + /* End Charge Branch and Delivered To table */ + /* Table with order details */ + echo '<table class="table1"> + <tr> + <td style="background-color:#bbbbbb"><b>' . _('Your Order Ref') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Our Order No') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Order Date') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Invoice Date') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Sales Person') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Shipper') . '</b></td> + <td style="background-color:#bbbbbb"><b>' . _('Consignment Ref') . '</b></td> </tr>'; - echo '<tr> + echo '<tr> <td>' . $myrow['customerref'] . '</td> - <td>' .$myrow['orderno'] . '</td> + <td>' . $myrow['orderno'] . '</td> <td>' . ConvertSQLDate($myrow['orddate']) . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td>' . $myrow['salesmanname'] . '</td> <td>' . $myrow['shippername'] . '</td> <td>' . $myrow['consignment'] . '</td> - </tr></table>'; - + </tr> + </table>'; + /* End order details table */ $sql ="SELECT stockmoves.stockid, - stockmaster.description, + stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, @@ -831,40 +919,62 @@ stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' - AND stockmoves.show_on_inv_crds=1"; + FROM stockmoves + INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=10 + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { /* then its a credit note */ - - echo '<table><tr> - <td><b>' . _('Date') . '</b></td> - <td><b>' . _('Sales Person') . '</b></td> - </tr>'; - echo '<tr> - <td>' . ConvertSQLDate($myrow['trandate']) . '</td> - <td>' . $myrow['salesmanname'] . '</td> - </tr></table>'; - - $sql ="SELECT stockmoves.stockid, - stockmaster.description, + /* Table for Branch info */ + echo '<table width="50%"> + <tr> + <th style="background-color:#bbbbbb">' . _('Branch') . ':</th> + </tr>'; + echo '<tr> + <td style="background-color:#EEEEEE">' . $myrow['brname'] . + '<br />' . $myrow['braddress1'] . + '<br />' . $myrow['braddress2'] . + '<br />' . $myrow['braddress3'] . + '<br />' . $myrow['braddress4'] . + '<br />' . $myrow['braddress5'] . + '<br />' . $myrow['braddress6'] . + '</td> + </tr></table>'; + /* End Branch info table */ + /* Table for Sales Person info. */ + echo '<hr /> + <table class="table1"> + <tr> + <th style="background-color:#bbbbbb">' . _('Date') . '</th> + <th style="background-color:#bbbbbb">' . _('Sales Person') . '</th> + </tr>'; + echo '<tr> + <td>' . ConvertSQLDate($myrow['trandate']) . '</td> + <td>' . $myrow['salesmanname'] . '</td> + </tr> + </table>'; + /* End Sales Person table */ + $sql ="SELECT stockmoves.stockid, + stockmaster.description, stockmoves.qty as quantity, stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmaster.units, stockmoves.narrative, - stockmaster.units, stockmaster.decimalplaces - FROM stockmoves, - stockmaster - WHERE stockmoves.stockid = stockmaster.stockid - AND stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' - AND stockmoves.show_on_inv_crds=1"; + FROM stockmoves + INNER JOIN stockmaster + ON stockmoves.stockid = stockmaster.stockid + WHERE stockmoves.type=11 + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } + echo '<hr />'; + echo '<div class="centre"><h4>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</h4></div>'; + $result=DB_query($sql); if (DB_error_no()!=0) { echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); @@ -875,8 +985,10 @@ } if (DB_num_rows($result)>0){ - echo '<table style="width:100%"> - <tr><th>' . _('Item Code') . '</th> + /* Table for stock details */ + echo '<table class="table1"> + <tr> + <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit') . '</th> @@ -890,27 +1002,27 @@ while ($myrow2=DB_fetch_array($result)){ - if ($k==1){ - $RowStarter = '<tr class="EvenTableRows">'; - $k=0; - } else { - $RowStarter = '<tr class="OddTableRows">'; - $k=1; - } + if($k==1){ + $RowStarter = '<tr class="EvenTableRows">'; + $k=0; + } else { + $RowStarter = '<tr class="OddTableRows">'; + $k=1; + } - echo $RowStarter; + echo $RowStarter; - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); - $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); - $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); + $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); + $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); + $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); - if ($myrow2['discountpercent']==0){ - $DisplayDiscount =''; - } else { - $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; - } + if ($myrow2['discountpercent']==0){ + $DisplayDiscount =''; + } else { + $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; + } - printf ('<td>%s</td> + printf ('<td>%s</td> <td>%s</td> <td class="number">%s</td> <td class="number">%s</td> @@ -926,45 +1038,165 @@ $DisplayDiscount, $DisplayNet); - if (mb_strlen($myrow2['narrative'])>1){ - $narrative = str_replace(array("\r\n", "\n", "\r", "\\r\\n"), '<br />', $myrow2['narrative']); - echo $RowStarter . '<td></td><td colspan="6">' . $narrative . '</td></tr>'; + if (mb_strlen($myrow2['narrative'])>1){ + $narrative = str_replace(array("\r\n", "\n", "\r", "\\r\\n"), '<br />', $myrow2['narrative']); + echo $RowStarter . + '<td></td> + <td colspan="6">' . $narrative . '</td> + </tr>'; $LineCounter++; - } + } - $LineCounter++; + $LineCounter++; + if($LineCounter == ($_SESSION['PageLength'] - 2)) { + + /* head up a new invoice/credit note page */ + + $PageNumber++; + /* End the stock table before the new page */ + echo '</table> + <table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '" alt="" /></td> + <td style="background-color:#bbbbbb">'; + + if ($InvOrCredit=='Invoice') { + echo '<h2>' . _('TAX INVOICE') . ' '; + } else { + echo '<h2 style="color:red">' . _('TAX CREDIT NOTE') . ' '; + } + echo _('Number') . ' ' . $FromTransNo . '</h2><br />' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; + + /*Print the company name and address */ + echo '<table class="table1"> + <tr> + <td><h2>' . $_SESSION['CompanyRecord']['coyname'] . '</h2><br />'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; + echo '</td><td class="number">' . _('Page') . ': ' . $PageNumber . '</td> + </tr> + </table>'; + echo '<table class="table1"> + <tr> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Net') . '</th> + </tr>'; + + $LineCounter = 10; + + } //end if need a new page headed up } //end while there are line items to print out echo '</table>'; } /*end if there are stock movements to show on the invoice or credit note*/ - /* Now print out the footer and totals */ + /* check to see enough space left to print the totals/footer */ + $LinesRequiredForText = floor(mb_strlen($myrow['invtext'])/140); + if($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)) { + + /* head up a new invoice/credit note page */ + $PageNumber++; + echo '<table class="table1"> + <tr> + <td valign="top"><img src="' . $_SESSION['LogoFile'] . '" alt="" /></td> + <td style="background-color:#bbbbbb">'; + + if ($InvOrCredit=='Invoice') { + echo '<h2>' . _('TAX INVOICE') . ' '; + } else { + echo '<h2 style="color:red">' . _('TAX CREDIT NOTE') . ' '; + } + echo _('Number') . ' ' . $FromTransNo . '</h2> + <br />' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td> + </tr> + </table>'; + + /*Print the company name and address */ + echo '<table class="table1"> + <tr> + <td><h2>' . $_SESSION['CompanyRecord']['coyname'] . '</h2><br />'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; + echo '</td><td class="number">' . _('Page') . ': ' . $PageNumber . '</td> + </tr> + </table>'; + echo '<table class="table1"> + <tr> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Net') . '</th> + </tr> + </table>'; + + $LineCounter = 10; + } + + /*Print out the invoice text entered */ + echo '<br /><br />' . $myrow['invtext']; + + /*Space out the footer to the bottom of the page */ + $LineCounter=$LineCounter+2+$LinesRequiredForText; + while($LineCounter < ($_SESSION['PageLength'] - 6)) { + echo '<br />'; + $LineCounter++; + } + + /* Footer table with totals */ + if ($InvOrCredit=='Invoice') { - - $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_number_format($myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_number_format($myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_number_format($myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],$myrow['decimalplaces']); } else { - $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); - $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); - $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); - $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplaySubTot = locale_number_format(-$myrow['ovamount'],$myrow['decimalplaces']); + $DisplayFreight = locale_number_format(-$myrow['ovfreight'],$myrow['decimalplaces']); + $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); + $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } - /*Print out the invoice text entered */ - echo '<table style="width:100%"><tr> - <td style="width:80%">' . $myrow['invtext'] . '</td> - <td class="number">' . _('Sub Total') . ' ' . $DisplaySubTot . '<br />'; - echo _('Freight') . ' ' . $DisplayFreight . '<br />'; - echo _('Tax') . ' ' . $DisplayTax . '<br />'; + echo '<table class="table1"><tr> + <td class="number">' . _('Sub Total') . '</td> + <td class="number" style="width:15%">' . $DisplaySubTot . '</td></tr>'; + echo '<tr><td class="number">' . _('Freight') . '</td> + <td class="number">' . $DisplayFreight . '</td></tr>'; + echo '<tr><td class="number">' . _('Tax') . '</td> + <td class="number">' . $DisplayTax . '</td></tr>'; if ($InvOrCredit=='Invoice'){ - echo '<b>' . _('TOTAL INVOICE') . ' ' . $DisplayTotal . '</b>'; + echo '<tr><td class="number"><b>' . _('TOTAL INVOICE') . '</b></td> + <td class="number"><b>' . $DisplayTotal . '</b></td></tr>'; } else { - echo '<b>' . _('TOTAL CREDIT') . ' ' . $DisplayTotal . '</b>'; + echo '<tr><td class="number" style="color:red"><b>' . _('TOTAL CREDIT') . '</b></td> + <td class="number" style="color:red"><b>' . $DisplayTotal . '</b></td></tr>'; } - echo '</td></tr></table>'; + echo '</table>'; + /* End footer totals table */ } /* end of check to see that there was an invoice record to print */ $FromTransNo++; } /* end loop to print invoices */ @@ -975,12 +1207,12 @@ function PrintLinesToBottom () { + global $Bottom_Margin; + global $Left_Margin; + global $line_height; + global $PageNumber; global $pdf; - global $PageNumber; global $TopOfColHeadings; - global $Left_Margin; - global $Bottom_Margin; - global $line_height; /* draw the vertical column lines right to the bottom */ $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin); @@ -1003,4 +1235,4 @@ } -?> +?> \ No newline at end of file Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2018-02-01 14:09:34 UTC (rev 7930) +++ trunk/PrintCustTransPortrait.php 2018-02-03 00:27:41 UTC (rev 7931) @@ -7,7 +7,6 @@ $ViewTopic = 'ARReports'; $BookMark = 'PrintInvoicesCredits'; - if(isset($_GET['FromTransNo'])) { $FromTransNo = filter_number_format($_GET['FromTransNo']); } elseif(isset($_POST['FromTransNo'])) { @@ -43,22 +42,10 @@ and isset($InvOrCredit) and $FromTransNo!='') { - include ('includes/class.pdf.php'); + include ('includes/PDFStarter.php'); - - $Page_Width=595; - $Page_Height=842; - $Top_Margin=30; - $Bottom_Margin=30; - $Left_Margin=40; - $Right_Margin=30; - - $pdf = new Cpdf('P', 'pt', 'A4'); - $pdf->addInfo('Author','webERP ' . $Version); - $pdf->addInfo('Creator','webERP http://www.weberp.org'); - if($InvOrCredit=='Invoice') { - $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); + $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); $pdf->addInfo('Subject',_('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } else { $pdf->addInfo('Title',_('Sales Credit Note') ); @@ -65,12 +52,6 @@ $pdf->addInfo('Subject',_('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } - $pdf->setAutoPageBreak(0); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - $pdf->AddPage(); - $pdf->cMargin = 0; - $FirstPage = true; $line_height=16; @@ -127,6 +108,8 @@ debtorsmaster.taxref, debtorsmaster.language_id, paymentterms.terms, + paymentterms.dayinfollowingmonth, + paymentterms.daysbeforedue, salesorders.deliverto, salesorders.deladd1, salesorders.deladd2, @@ -152,6 +135,7 @@ custbranch.brpostaddr4, custbranch.brpostaddr5, custbranch.brpostaddr6, + custbranch.salesman, salesman.salesmanname, debtortrans.debtorno, debtortrans.branchcode, @@ -179,9 +163,9 @@ AND debtortrans.transno='" . $FromTransNo . "'"; if(isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { - $sql = $sql . " AND debtorsmaster.ediinvoices=0"; + $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; } - } else { + } else {/* then its a credit note */ $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -213,10 +197,10 @@ custbranch.brpostaddr4, custbranch.brpostaddr5, custbranch.brpostaddr6, + custbranch.salesman, salesman.salesmanname, debtortrans.debtorno, debtortrans.branchcode, - paymentterms.terms, currencies.decimalplaces FROM debtortrans INNER JOIN debtorsmaster ON debtortrans.debtorno=debtorsmaster.debtorno @@ -225,8 +209,6 @@ AND debtortrans.branchcode=custbranch.branchcode INNER JOIN salesman ON custbranch.salesman=salesman.salesmancode - INNER JOIN paymentterms - ON debtorsmaster.paymentterms=paymentterms.termsindicator INNER JOIN currencies ON debtorsmaster.currcode=currencies.currabrev WHERE debtortrans.type=11 @@ -254,7 +236,24 @@ } if(DB_num_rows($result)==1) { $myrow = DB_fetch_array($result); + + if ( $_SESSION['SalesmanLogin'] != '' AND $_SESSION['SalesmanLogin'] != $myrow['salesman'] ){ + $Title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.php'); + prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to view transaction for this order'),'error'); + include('includes/footer.php'); + exit; + } + if ( $CustomerLogin == 1 AND $myrow['debtorno'] != $_SESSION['CustomerID'] ){ + $Title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.php'); + echo '<p class="bad">' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company').'</p>'; + include('includes/footer.php'); + exit; + } + $ExchRate = $myrow['rate']; + //Change the language to the customer's language $_SESSION['Language'] = $myrow['language_id']; include('includes/LanguageSetup.php'); @@ -310,6 +309,11 @@ exit; } + if ($InvOrCredit=='Invoice') { + /* Calculate Due Date info. This reference is used in the PDFTransPageHeaderPortrait.inc file. */ + $DisplayDueDate = CalcDueDate(ConvertSQLDate($myrow['trandate']), $myrow['dayinfollowingmonth'], $myrow['daysbeforedue']); + } + if(DB_num_rows($result)>0) { $FontSize = 10; @@ -342,6 +346,7 @@ } else { $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos,186,$FontSize,$myrow2['description']);// Print item short description. } + $lines=1; while($LeftOvers!='') { $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos-(10*$lines),186,$FontSize,$LeftOvers); @@ -427,21 +432,21 @@ /*Print a column vertical line with enough space for the footer*/ /*draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc*/ - $pdf->line($Left_Margin+78, $TopOfColHeadings+12,$Left_Margin+78,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+78, $TopOfColHeadings,$Left_Margin+78,$Bottom_Margin+(4*$line_height)); /*Print a column vertical line */ - $pdf->line($Left_Margin+268, $TopOfColHeadings+12,$Left_Margin+268,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+268, $TopOfColHeadings,$Left_Margin+268,$Bottom_Margin+(4*$line_height)); /*Print a column vertical line */ - $pdf->line($Left_Margin+348, $TopOfColHeadings+12,$Left_Margin+348,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+348, $TopOfColHeadings,$Left_Margin+348,$Bottom_Margin+(4*$line_height)); /*Print a column vertical line */ - $pdf->line($Left_Margin+388, $TopOfColHeadings+12,$Left_Margin+388,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+388, $TopOfColHeadings,$Left_Margin+388,$Bottom_Margin+(4*$line_height)); /*Print a column vertical line */ - $pdf->line($Left_Margin+418, $TopOfColHeadings+12,$Left_Margin+418,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+418, $TopOfColHeadings,$Left_Margin+418,$Bottom_Margin+(4*$line_height)); - $pdf->line($Left_Margin+448, $TopOfColHeadings+12,$Left_Margin+448,$Bottom_Margin+(4*$line_height)); + $pdf->line($Left_Margin+448, $TopOfColHeadings,$Left_Margin+448,$Bottom_Margin+(4*$line_height)); /*Rule off at bottom of the vertical lines */ $pdf->line($Left_Margin, $Bottom_Margin+(4*$line_height),$Page_Width-$Right_Margin,$Bottom_Margin+(4*$line_height)); @@ -459,16 +464,14 @@ $DisplayTax = locale_number_format(-$myrow['ovgst'],$myrow['decimalplaces']); $DisplayTotal = locale_number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],$myrow['decimalplaces']); } - /*Print out the invoice text entered */ + $YPos = $Bottom_Margin+(3*$line_height); - /* Print out the payment terms */ - $pdf->addTextWrap($Left_Margin, $YPos+3, 280, $FontSize,_('Payment Terms') . ': ' . $myrow['terms']); - + /*Print out the invoice text entered */ $FontSize =8; $LeftOvers=explode("\r\n",DB_escape_string($myrow['invtext'])); for ($i=0;$i<sizeOf($LeftOvers);$i++) { - $pdf->addText($Left_Margin, $YPos-8-($i*8), $FontSize, $LeftOvers[$i]); + $pdf->addTextWrap($Left_Margin, $YPos-8-($i*8), 290, $FontSize, $LeftOvers[$i]); } $FontSize = 10; @@ -489,17 +492,23 @@ $YPos+=10; if($InvOrCredit=='Invoice') { + /* Print out the payment terms */ + $pdf->addTextWrap($Left_Margin, $YPos-5, 280, $FontSize,_('Payment Terms') . ': ' . $myrow['terms']); + $LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-220, $Bottom_Margin+5, 144, $FontSize, _('TOTAL INVOICE')); + $FontSize=8; - $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos-18,280,$FontSize,$_SESSION['RomalpaClause']); + $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos-18,290,$FontSize,$_SESSION['RomalpaClause']); while(mb_strlen($LeftOvers)>0 AND $YPos > $Bottom_Margin) { $YPos -=10; - $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos-18,280,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTe... [truncated message content] |
From: <tu...@us...> - 2018-02-03 00:57:16
|
Revision: 7932 http://sourceforge.net/p/web-erp/reponame/7932 Author: turbopt Date: 2018-02-03 00:57:14 +0000 (Sat, 03 Feb 2018) Log Message: ----------- Dashboard.php: Replace due date handling with existing function. Modified Paths: -------------- trunk/Dashboard.php trunk/doc/Change.log Modified: trunk/Dashboard.php =================================================================== --- trunk/Dashboard.php 2018-02-03 00:27:41 UTC (rev 7931) +++ trunk/Dashboard.php 2018-02-03 00:57:14 UTC (rev 7932) @@ -260,31 +260,8 @@ $DisplayOverdue1 = locale_number_format($DetailTrans['overdue1']-$DetailTrans['overdue2'], $CurrDecimalPlaces); $DisplayOverdue2 = locale_number_format($DetailTrans['overdue2'], $CurrDecimalPlaces); - if($DetailTrans['daysbeforedue'] > 0) { - $AddDays=$DetailTrans['daysbeforedue'] . ' days'; - if(function_exists('date_add')) { - $DisplayDueDate = date_add(date_create($DetailTrans['trandate']), date_interval_create_from_date_string($AddDays)); - } else { - $DisplayDueDate = strtotime($AddDays,strtotime($DetailTrans['trandate'])); - } + $DisplayDueDate = CalcDueDate($DisplayTranDate, $DetailTrans['dayinfollowingmonth'], $DetailTrans['daysbeforedue']); - } else { - $AddDays=(intval($DetailTrans['dayinfollowingmonth']) - 1) . ' days'; - if(function_exists('date_add')) { - $DisplayDueDate = date_create($DetailTrans['trandate']); - $DisplayDueDate->modify('first day of next month'); - $DisplayDueDate = date_add($DisplayDueDate, date_interval_create_from_date_string($AddDays)); - } else { - $DisplayDueDate = strtotime('first day of next month',strtotime($DetailTrans['trandate'])); - $DisplayDueDate = strtotime($DisplayDueDate,strtotime($AddDays)); - } - - } - if(function_exists('date_add')) { - $DisplayDueDate=date_format($DisplayDueDate,$_SESSION['DefaultDateFormat']); - } else { - $DisplayDueDate = Date($_SESSION['DefaultDateFormat'],$DisplayDueDate); - } if($k == 1) { echo '<tr class="EvenTableRows">'; $k = 0; @@ -292,7 +269,7 @@ echo '<tr class="OddTableRows">'; $k = 1; } - echo '<td style="text-align:center">', _($DetailTrans['typename']), '</td>',// Should it be left (text field) ? + echo '<td class="centre">', _($DetailTrans['typename']), '</td>',// Should it be left (text field) ? '<td class="number">', $DetailTrans['transno'], '</td> <td class="centre">', $DisplayTranDate, '</td> <td class="centre">', $DisplayDueDate, '</td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-03 00:27:41 UTC (rev 7931) +++ trunk/doc/Change.log 2018-02-03 00:57:14 UTC (rev 7932) @@ -1,5 +1,6 @@ webERP Change Log +2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function. 2/2/18 PaulT: PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115) 31/1/18 PaulT: Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message. 27/1/18 PaulT: Remove unused $db parameter from DB_query(), DB_error_no(), DB_error_msg() and other DB-related function calls. |
From: <tu...@us...> - 2018-02-04 15:57:48
|
Revision: 7933 http://sourceforge.net/p/web-erp/reponame/7933 Author: turbopt Date: 2018-02-04 15:57:45 +0000 (Sun, 04 Feb 2018) Log Message: ----------- Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/BOMExtendedQty.php trunk/BOMListing.php trunk/CounterReturns.php trunk/Credit_Invoice.php trunk/Dashboard.php trunk/DebtorsAtPeriodEnd.php trunk/GLAccountCSV.php trunk/GLAccountInquiry.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTrialBalance.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/MRPPlannedWorkOrders.php trunk/MRPReschedules.php trunk/MRPShortages.php trunk/MailInventoryValuation.php trunk/OutstandingGRNs.php trunk/PDFCustomerList.php trunk/PDFLowGP.php trunk/PDFSellThroughSupportClaim.php trunk/PDFStockCheckComparison.php trunk/PcAnalysis.php trunk/PurchaseByPrefSupplier.php trunk/ReorderLevel.php trunk/SalesGraph.php trunk/SelectCreditItems.php trunk/StockCheck.php trunk/StockDispatch.php trunk/SuppPriceList.php trunk/SupplierBalsAtPeriodEnd.php trunk/Tax.php trunk/Z_DataExport.php trunk/Z_RePostGLFromPeriod.php trunk/Z_UpdateChartDetailsBFwd.php trunk/api/api_branches.php trunk/api/api_customers.php trunk/api/api_debtortransactions.php trunk/api/api_glaccounts.php trunk/api/api_glgroups.php trunk/api/api_glsections.php trunk/api/api_locations.php trunk/api/api_purchdata.php trunk/api/api_salesareas.php trunk/api/api_salesman.php trunk/api/api_salesorders.php trunk/api/api_salestypes.php trunk/api/api_stock.php trunk/api/api_stockcategories.php trunk/api/api_suppliers.php trunk/api/api_workorders.php trunk/doc/Change.log Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/AgedDebtors.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -287,7 +287,7 @@ $ListCount = DB_num_rows($CustomerResult); $CurrDecimalPlaces =2; //by default - while ($AgedAnalysis = DB_fetch_array($CustomerResult,$db)) { + while ($AgedAnalysis = DB_fetch_array($CustomerResult)) { $CurrDecimalPlaces = $AgedAnalysis['decimalplaces']; $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/AgedSuppliers.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -126,7 +126,7 @@ $ListCount = DB_num_rows($SupplierResult); // UldisN - while ($AgedAnalysis = DB_fetch_array($SupplierResult,$db)){ + while ($AgedAnalysis = DB_fetch_array($SupplierResult)){ $CurrDecimalPlaces = $AgedAnalysis['currdecimalplaces']; Modified: trunk/BOMExtendedQty.php =================================================================== --- trunk/BOMExtendedQty.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/BOMExtendedQty.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -202,7 +202,7 @@ stockmaster.mbflag"; $result = DB_query($sql); $ListCount = DB_num_rows($result); - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ // Parameters for addTextWrap are defined in /includes/class.pdf.php // 1) X position 2) Y position 3) Width Modified: trunk/BOMListing.php =================================================================== --- trunk/BOMListing.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/BOMListing.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -62,7 +62,7 @@ $ParentPart = ''; - while ($BOMList = DB_fetch_array($BOMResult,$db)){ + while ($BOMList = DB_fetch_array($BOMResult)){ if ($ParentPart!=$BOMList['parent']){ Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/CounterReturns.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -420,7 +420,7 @@ $KitResult = DB_query($sql,$ErrMsg,$DbgMsg); $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)) { + while ($KitParts = DB_fetch_array($KitResult)) { $NewItem = $KitParts['component']; $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewPOLine = 0; @@ -533,7 +533,7 @@ $KitResult = DB_query($sql,$ErrMsg); $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ + while ($KitParts = DB_fetch_array($KitResult)){ $NewItem = $KitParts['component']; $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewPOLine = 0; @@ -582,7 +582,7 @@ $KitResult = DB_query($sql,$ErrMsg); $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ + while ($KitParts = DB_fetch_array($KitResult)){ $NewItem = $KitParts['component']; $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewPOLine = 0; @@ -633,7 +633,7 @@ $KitResult = DB_query($sql,$ErrMsg); $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ + while ($KitParts = DB_fetch_array($KitResult)){ $NewItem = $KitParts['component']; $NewItemQty = $KitParts['quantity'] * $ParentQty; $NewItemDue = date($_SESSION['DefaultDateFormat']); @@ -1020,7 +1020,7 @@ $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$ErrMsg,$DbgMsg,true); - while ($AssParts = DB_fetch_array($AssResult,$db)){ + while ($AssParts = DB_fetch_array($AssResult)){ $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; /* Need to get the current location quantity Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Credit_Invoice.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -774,7 +774,7 @@ $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($sql, $ErrMsg, $DbgMsg, true); - while($AssParts = DB_fetch_array($AssResult,$db)) { + while($AssParts = DB_fetch_array($AssResult)) { $StandardCost += $AssParts['standard'] * $AssParts['quantity']; /*Determine the type of stock item being credited */ Modified: trunk/Dashboard.php =================================================================== --- trunk/Dashboard.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Dashboard.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -163,7 +163,7 @@ exit; } - while($AgedAnalysis = DB_fetch_array($CustomerResult,$db)) { + while($AgedAnalysis = DB_fetch_array($CustomerResult)) { if($k == 1) { echo '<tr class="EvenTableRows">'; $k = 0; Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/DebtorsAtPeriodEnd.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -78,7 +78,7 @@ $TotBal=0; - while ($DebtorBalances = DB_fetch_array($CustomerResult,$db)){ + while ($DebtorBalances = DB_fetch_array($CustomerResult)){ $Balance = $DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'] + $DebtorBalances['afterdatediffonexch'] ; $FXBalance = $DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans']; @@ -153,7 +153,7 @@ $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,_('Could not retrieve period data because'),_('The SQL that failed to get the period data was')); - while ($myrow = DB_fetch_array($Periods,$db)){ + while ($myrow = DB_fetch_array($Periods)){ echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/GLAccountCSV.php =================================================================== --- trunk/GLAccountCSV.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/GLAccountCSV.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -41,7 +41,7 @@ ORDER BY chartmaster.accountcode"; $AccountsResult = DB_query($sql); $i=0; -while ($myrow=DB_fetch_array($AccountsResult,$db)){ +while ($myrow=DB_fetch_array($AccountsResult)){ if(isset($_POST['Account'][$i]) AND $myrow['accountcode'] == $_POST['Account'][$i]){ echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' ' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . '</option>'; $i++; @@ -57,7 +57,7 @@ $Periods = DB_query($sql); $id=0; -while ($myrow=DB_fetch_array($Periods,$db)){ +while ($myrow=DB_fetch_array($Periods)){ if (isset($SelectedPeriod[$id]) and $myrow['periodno'] == $SelectedPeriod[$id]){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>'; $id++; Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/GLAccountInquiry.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -62,7 +62,7 @@ INNER JOIN glaccountusers ON glaccountusers.accountcode=chartmaster.accountcode AND glaccountusers.userid='" . $_SESSION['UserID'] . "' AND glaccountusers.canview=1 ORDER BY chartmaster.accountcode"; $Account = DB_query($sql); -while($myrow=DB_fetch_array($Account,$db)) { +while($myrow=DB_fetch_array($Account)) { if($myrow['accountcode'] == $SelectedAccount) { if(!is_null($myrow['bankact'])) { $BankAccount = true; @@ -104,7 +104,7 @@ $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql); -while($myrow=DB_fetch_array($Periods,$db)) { +while($myrow=DB_fetch_array($Periods)) { if(isset($FirstPeriodSelected) AND $myrow['periodno'] >= $FirstPeriodSelected AND $myrow['periodno'] <= $LastPeriodSelected) { echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])) . '</option>'; } else { Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/GLProfit_Loss.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -58,7 +58,7 @@ $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/GLTagProfit_Loss.php =================================================================== --- trunk/GLTagProfit_Loss.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/GLTagProfit_Loss.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -48,7 +48,7 @@ $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; @@ -83,7 +83,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/GLTrialBalance.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -63,7 +63,7 @@ $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; @@ -93,7 +93,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/InventoryPlanningPrefSupplier.php =================================================================== --- trunk/InventoryPlanningPrefSupplier.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/InventoryPlanningPrefSupplier.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -201,7 +201,7 @@ $Period_3 = $CurrentPeriod -3; $Period_4 = $CurrentPeriod -4; - while ($InventoryPlan = DB_fetch_array($InventoryResult,$db)){ + while ($InventoryPlan = DB_fetch_array($InventoryResult)){ if ($SupplierID!=$InventoryPlan['supplierno']){ $FontSize=10; Modified: trunk/InventoryQuantities.php =================================================================== --- trunk/InventoryQuantities.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/InventoryQuantities.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -113,7 +113,7 @@ $FontSize=8; $holdpart = " "; - While ($myrow = DB_fetch_array($result,$db)){ + While ($myrow = DB_fetch_array($result)){ if ($myrow['stockid'] != $holdpart) { $YPos -=(2 * $line_height); $holdpart = $myrow['stockid']; Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/MRPPlannedWorkOrders.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -148,7 +148,7 @@ $TotalPartCost = 0; $Total_ExtCost = 0; - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ $YPos -=$line_height; // Print information on part break @@ -265,7 +265,7 @@ $Total_ExtCost = 0; $j=1; //row ID $k=0; //row colour counter - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ // Alternate row color if ($k==1){ Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/MRPReschedules.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -68,7 +68,7 @@ $Tot_Val=0; $fill = false; $pdf->SetFillColor(224,235,255); - While ($myrow = DB_fetch_array($result,$db)){ + While ($myrow = DB_fetch_array($result)){ $YPos -=$line_height; $FontSize=8; Modified: trunk/MRPShortages.php =================================================================== --- trunk/MRPShortages.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/MRPShortages.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -181,7 +181,7 @@ $Partctr = 0; $fill = false; $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ if ($_POST['ReportType'] == 'Shortage'){ $LineToPrint = ($myrow['demand'] > $myrow['supply']); Modified: trunk/MailInventoryValuation.php =================================================================== --- trunk/MailInventoryValuation.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/MailInventoryValuation.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -134,7 +134,7 @@ $Tot_Val=0; $Category = ''; $CatTot_Val=0; -While ($InventoryValn = DB_fetch_array($InventoryResult,$db)){ +While ($InventoryValn = DB_fetch_array($InventoryResult)){ if ($Category!=$InventoryValn['categoryid']){ $FontSize=10; Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/OutstandingGRNs.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -86,7 +86,7 @@ $Tot_Val=0; $Supplier = ''; $SuppTot_Val=0; - While ($GRNs = DB_fetch_array($GRNsResult,$db)){ + While ($GRNs = DB_fetch_array($GRNsResult)){ if ($Supplier!=$GRNs['supplierid']){ @@ -192,7 +192,7 @@ $k = 0; //row colour counter $i = 1; $TotalHomeCurrency = 0; - while ($GRNs = DB_fetch_array($GRNsResult,$db) ){ + while ($GRNs = DB_fetch_array($GRNsResult) ){ if ($k == 1) { echo '<tr class="EvenTableRows">'; $k = 0; Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PDFCustomerList.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -255,7 +255,7 @@ $Area =''; $SalesPerson=''; - while($Customers = DB_fetch_array($CustomersResult,$db)) { + while($Customers = DB_fetch_array($CustomersResult)) { if($_POST['Activity']!='All') { Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PDFLowGP.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -80,7 +80,7 @@ $Tot_Val=0; $Category = ''; $CatTot_Val=0; - while ($LowGPItems = DB_fetch_array($LowGPSalesResult,$db)){ + while ($LowGPItems = DB_fetch_array($LowGPSalesResult)){ $YPos -=$line_height; $FontSize=8; Modified: trunk/PDFSellThroughSupportClaim.php =================================================================== --- trunk/PDFSellThroughSupportClaim.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PDFSellThroughSupportClaim.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -95,7 +95,7 @@ $SupplierClaimTotal=0; $Supplier = ''; $FontSize=8; - while ($SellThroRow = DB_fetch_array($ClaimsResult,$db)){ + while ($SellThroRow = DB_fetch_array($ClaimsResult)){ $YPos -=$line_height; if ($SellThroRow['suppname']!=$Supplier){ Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PDFStockCheckComparison.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -225,7 +225,7 @@ $Location = ''; $Category = ''; - While ($CheckItemRow = DB_fetch_array($CheckedItems,$db)){ + While ($CheckItemRow = DB_fetch_array($CheckedItems)){ if ($Location!=$CheckItemRow['loccode']){ $FontSize=14; @@ -294,7 +294,7 @@ } } elseif (DB_num_rows($Counts)>0) { $TotalCount =0; - while ($CountRow=DB_fetch_array($Counts,$db)){ + while ($CountRow=DB_fetch_array($Counts)){ $LeftOvers = $pdf->addTextWrap(375, $YPos, 60, $FontSize, locale_number_format(($CountRow['qtycounted']),$CheckItemRow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap(440, $YPos, 100, $FontSize, $CountRow['reference'], 'left'); $TotalCount += $CountRow['qtycounted']; Modified: trunk/PcAnalysis.php =================================================================== --- trunk/PcAnalysis.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PcAnalysis.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -23,7 +23,7 @@ if ($InputError == 0){ // Creation of beginning of SQL query $SQL = "SELECT pcexpenses.codeexpense,"; - + // Creation of periods SQL query $PeriodToday=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); $SQLPeriods = "SELECT periodno, @@ -35,8 +35,8 @@ $Periods = DB_query($SQLPeriods); $NumPeriod = 0; $LabelsArray = array(); - while ($MyRow=DB_fetch_array($Periods,$db)){ - + while ($MyRow=DB_fetch_array($Periods)){ + $NumPeriod++; $LabelsArray[$NumPeriod] = MonthAndYearFromSQLDate($MyRow['lastdate_in_period']); $SQL = $SQL . "(SELECT SUM(pcashdetails.amount) @@ -67,14 +67,14 @@ ->setDescription("Petty Cash Expenses Analysis") ->setKeywords("") ->setCategory(""); - + // Formatting - + $objPHPExcel->getActiveSheet()->getStyle('C:AB')->getNumberFormat()->setFormatCode('#,##0.00'); $objPHPExcel->getActiveSheet()->getStyle('4')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setBold(true); $objPHPExcel->getActiveSheet()->getStyle('A:B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); - + // Add title data $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Petty Cash Tab(s)'); @@ -109,7 +109,7 @@ $objPHPExcel->getActiveSheet()->setCellValue('Z4', $LabelsArray[3]); $objPHPExcel->getActiveSheet()->setCellValue('AA4', $LabelsArray[2]); $objPHPExcel->getActiveSheet()->setCellValue('AB4', $LabelsArray[1]); - + // Add data $i = 5; while ($MyRow = DB_fetch_array($Result)) { @@ -116,7 +116,7 @@ $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $MyRow['codeexpense']); $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $MyRow['description']); - + $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, '=SUM(Q'.$i.':AB'.$i.')'); $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=AVERAGE(Q'.$i.':AB'.$i.')'); @@ -147,7 +147,7 @@ $i++; } - + // Freeze panes $objPHPExcel->getActiveSheet()->freezePane('E5'); @@ -157,7 +157,7 @@ ->getColumnDimension($col) ->setAutoSize(true); } - + // Rename worksheet if ($TabToShow=='All'){ $objPHPExcel->getActiveSheet()->setTitle('All Accounts'); @@ -219,7 +219,7 @@ <td><select name="Tabs">'; $SQL = "SELECT tabcode - FROM pctabs + FROM pctabs ORDER BY tabcode"; $CatResult = DB_query($SQL); @@ -248,7 +248,7 @@ function beginning_of_month($Date){ $Date2 = explode("-",$Date); - $M = $Date2[1]; + $M = $Date2[1]; $Y = $Date2[0]; $FirstOfMonth = $Y . '-' . $M . '-01'; return $FirstOfMonth; Modified: trunk/PurchaseByPrefSupplier.php =================================================================== --- trunk/PurchaseByPrefSupplier.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/PurchaseByPrefSupplier.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -425,7 +425,7 @@ $i=0; - while ($ItemRow = DB_fetch_array($ItemsResult,$db)){ + while ($ItemRow = DB_fetch_array($ItemsResult)){ $SQL = "SELECT SUM(CASE WHEN (trandate>='" . Date('Y-m-d',mktime(0,0,0, date('m')-2, date('d'), date('Y'))) . "' AND Modified: trunk/ReorderLevel.php =================================================================== --- trunk/ReorderLevel.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/ReorderLevel.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -75,7 +75,7 @@ $ListCount = 0; // UldisN - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ $YPos -=(2 * $line_height); $ListCount ++; @@ -123,7 +123,7 @@ AND locstock.stockid ='" . $myrow['stockid'] . "' AND locstock.loccode !='" . $myrow['loccode'] . "'"; $OtherResult = DB_query($sql2,'','',false,true); - while ($myrow2 = DB_fetch_array($OtherResult,$db)){ + while ($myrow2 = DB_fetch_array($OtherResult)){ $YPos -=$line_height; // Parameters for addTextWrap are defined in /includes/class.pdf.php Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/SalesGraph.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -51,7 +51,7 @@ $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno"; $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; @@ -80,7 +80,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/SelectCreditItems.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -1454,7 +1454,7 @@ $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$ErrMsg,$DbgMsg,true); - while ($AssParts = DB_fetch_array($AssResult,$db)){ + while ($AssParts = DB_fetch_array($AssResult)){ $StandardCost += $AssParts['standard'] * $AssParts['quantity']; Modified: trunk/StockCheck.php =================================================================== --- trunk/StockCheck.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/StockCheck.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -152,7 +152,7 @@ $Category = ''; - While ($InventoryCheckRow = DB_fetch_array($InventoryResult,$db)){ + While ($InventoryCheckRow = DB_fetch_array($InventoryResult)){ if ($Category!=$InventoryCheckRow['categoryid']){ $FontSize=12; Modified: trunk/StockDispatch.php =================================================================== --- trunk/StockDispatch.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/StockDispatch.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -148,7 +148,7 @@ $FontSize=8; $Now = Date('Y-m-d H-i-s'); - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ // Check if there is any stock in transit already sent from FROM LOCATION $InTransitQuantityAtFrom = 0; if ($_SESSION['ProhibitNegativeStock']==1){ Modified: trunk/SuppPriceList.php =================================================================== --- trunk/SuppPriceList.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/SuppPriceList.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -161,7 +161,7 @@ $FontSize=8; $code=''; - while ($myrow = DB_fetch_array($result,$db)){ + while ($myrow = DB_fetch_array($result)){ $YPos -=$line_height; $PriceDated=ConvertSQLDate($myrow[4]); @@ -217,8 +217,8 @@ <th class="ascending">' . _('Date From') . '</th> <th>' . _('Supp Code') . '</th> </tr>'; - $k = 0; - while ($myrow = DB_fetch_array($result,$db)){ + $k = 0; + while ($myrow = DB_fetch_array($result)){ echo '<tr'; if ($k==0) { echo ' class="OddTableRows">'; Modified: trunk/SupplierBalsAtPeriodEnd.php =================================================================== --- trunk/SupplierBalsAtPeriodEnd.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/SupplierBalsAtPeriodEnd.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -71,7 +71,7 @@ $TotBal=0; - While ($SupplierBalances = DB_fetch_array($SupplierResult,$db)){ + While ($SupplierBalances = DB_fetch_array($SupplierResult)){ $Balance = $SupplierBalances['balance'] - $SupplierBalances['afterdatetrans'] + $SupplierBalances['afterdatediffonexch']; $FXBalance = $SupplierBalances['fxbalance'] - $SupplierBalances['fxafterdatetrans']; @@ -147,7 +147,7 @@ $ErrMsg = _('Could not retrieve period data because'); $Periods = DB_query($sql,$ErrMsg); - while ($myrow = DB_fetch_array($Periods,$db)){ + while ($myrow = DB_fetch_array($Periods)){ echo '<option value="' . $myrow['lastdate_in_period'] . '" selected="selected" >' . MonthAndYearFromSQLDate($myrow['lastdate_in_period'],'M',-1) . '</option>'; } echo '</select></td> Modified: trunk/Tax.php =================================================================== --- trunk/Tax.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Tax.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -65,7 +65,7 @@ $YPos -= $FontSize; $YPos -= $FontSize; $FontSize = 8; - while ($DebtorTransRow = DB_fetch_array($DebtorTransResult,$db)) { + while ($DebtorTransRow = DB_fetch_array($DebtorTransResult)) { $pdf->addText($Left_Margin, $YPos, $FontSize, ConvertSQLDate($DebtorTransRow['trandate'])); $pdf->addText(82, $YPos, $FontSize, _($DebtorTransRow['typename'])); $pdf->addTextWrap(140, $YPos - $FontSize, 40, $FontSize, $DebtorTransRow['transno'], 'right'); @@ -236,7 +236,7 @@ if ($_POST['DetailOrSummary'] == 'Detail') { $FontSize = 10; $YPos -= $FontSize; // Jumps additional line. - $YPos -= $FontSize; + $YPos -= $FontSize; $pdf->addText($Left_Margin, $YPos + $FontSize, $FontSize, _('Tax on Petty Cash Expenses')); $YPos -= $FontSize; // Prints out lines: Modified: trunk/Z_DataExport.php =================================================================== --- trunk/Z_DataExport.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Z_DataExport.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -89,7 +89,7 @@ stripcomma('categoryid') . ',' . stripcomma('categorydescription') . "\n"; - While ($PriceList = DB_fetch_array($PricesResult,$db)){ + While ($PriceList = DB_fetch_array($PricesResult)){ $Qty = 0; $sqlQty = "SELECT newqoh FROM stockmoves @@ -193,7 +193,7 @@ stripcomma('disabletrans') . "\n"; - While ($CustList = DB_fetch_array($CustResult,$db)){ + While ($CustList = DB_fetch_array($CustResult)){ $CreditLimit = $CustList['creditlimit']; if ( mb_strlen($CustList['braddress1']) <= 3 ) { @@ -273,7 +273,7 @@ stripcomma('commissionrate2') . "\n"; - While ($SalesManList = DB_fetch_array($SalesManResult,$db)){ + While ($SalesManList = DB_fetch_array($SalesManResult)){ $CommissionRate1 = $SalesManList['commissionrate1']; $BreakPoint = $SalesManList['breakpoint']; @@ -317,7 +317,7 @@ stripcomma('filename') . ','. stripcomma('url') . "\n"; $baseurl = 'http://'. $_SERVER['HTTP_HOST'] . dirname(htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8')) . '/' . 'getstockimg.php?automake=1&stockid=%s.png'; - While ($ImageList = DB_fetch_array($ImageResult,$db)){ + While ($ImageList = DB_fetch_array($ImageResult)){ $url = sprintf($baseurl, urlencode($ImageList['stockid'])); $CSVContent .= ( stripcomma($ImageList['stockid']) . ',' . @@ -356,7 +356,7 @@ stripcomma('tokenname') . "\n"; - While ($SecTokenList = DB_fetch_array($SecTokenResult,$db)){ + While ($SecTokenList = DB_fetch_array($SecTokenResult)){ $CSVContent .= (stripcomma($SecTokenList['tokenid']) . ',' . stripcomma($SecTokenList['tokenname']) . "\n"); @@ -392,7 +392,7 @@ stripcomma('secrolename') . "\n"; - While ($SecRoleList = DB_fetch_array($SecRoleResult,$db)){ + While ($SecRoleList = DB_fetch_array($SecRoleResult)){ $CSVContent .= (stripcomma($SecRoleList['secroleid']) . ',' . stripcomma($SecRoleList['secrolename']) . "\n"); @@ -428,7 +428,7 @@ stripcomma('tokenid') . "\n"; - While ($SecGroupList = DB_fetch_array($SecGroupResult,$db)){ + While ($SecGroupList = DB_fetch_array($SecGroupResult)){ $CSVContent .= (stripcomma($SecGroupList['secroleid']) . ',' . stripcomma($SecGroupList['tokenid']) . "\n"); @@ -496,7 +496,7 @@ stripcomma('swipecard') . "\n"; - While ($SecUserList = DB_fetch_array($SecUserResult,$db)){ + While ($SecUserList = DB_fetch_array($SecUserResult)){ $CSVContent .= (stripcomma($SecUserList['userid']) . ',' . stripcomma($SecUserList['password']) . ',' . Modified: trunk/Z_RePostGLFromPeriod.php =================================================================== --- trunk/Z_RePostGLFromPeriod.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Z_RePostGLFromPeriod.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -23,7 +23,7 @@ FROM periods ORDER BY periodno"; $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } Modified: trunk/Z_UpdateChartDetailsBFwd.php =================================================================== --- trunk/Z_UpdateChartDetailsBFwd.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/Z_UpdateChartDetailsBFwd.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -27,7 +27,7 @@ $Periods = DB_query($sql); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } @@ -43,7 +43,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; Modified: trunk/api/api_branches.php =================================================================== --- trunk/api/api_branches.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_branches.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -348,7 +348,7 @@ $sql = 'INSERT INTO custbranch ('.mb_substr($FieldNames,0,-2).') '. 'VALUES ('.mb_substr($FieldValues,0,-2).') '; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -471,7 +471,7 @@ $sql = mb_substr($sql,0,-2)." WHERE debtorno='".$BranchDetails['debtorno']."' AND branchcode='".$BranchDetails['branchcode']."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -527,7 +527,7 @@ $sql="SELECT * FROM custbranch WHERE debtorno='".$DebtorNumber."' AND branchcode='".$BranchCode."'"; - $result = api_DB_Query($sql, $db); + $result = api_DB_query($sql); if (DB_error_no() != 0 ) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_customers.php =================================================================== --- trunk/api/api_customers.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_customers.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -361,7 +361,7 @@ $sql = 'INSERT INTO debtorsmaster ('.mb_substr($FieldNames,0,-2).') '. 'VALUES ('.mb_substr($FieldValues,0,-2).') '; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -487,7 +487,7 @@ } $sql = mb_substr($sql,0,-2)." WHERE debtorno='".$CustomerDetails['debtorno']."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -513,7 +513,7 @@ return $Errors; } $sql="SELECT * FROM debtorsmaster WHERE debtorno='".$DebtorNumber."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $Errors[0] = 0; // None found. $Errors[1] = DB_fetch_array($result); @@ -533,7 +533,7 @@ $sql='SELECT debtorno FROM debtorsmaster WHERE '.$Field." LIKE '%".$Criteria."%'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $DebtorList = array(0); // First element: no errors while ($myrow=DB_fetch_array($result)) { $DebtorList[]=$myrow[0]; Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_debtortransactions.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -708,7 +708,7 @@ $AssResult = api_DB_query($SQL); - while ($AssParts = DB_fetch_array($AssResult,$db)){ + while ($AssParts = DB_fetch_array($AssResult)){ $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; /* Need to get the current location quantity Modified: trunk/api/api_glaccounts.php =================================================================== --- trunk/api/api_glaccounts.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_glaccounts.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -72,7 +72,7 @@ if (sizeof($Errors)==0) { $sql = 'INSERT INTO chartmaster ('.mb_substr($FieldNames,0,-2).') '. "VALUES ('".mb_substr($FieldValues,0,-2)."') "; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $sql='INSERT INTO chartdetails (accountcode, period) SELECT ' . $AccountDetails['accountcode'] . ', Modified: trunk/api/api_glgroups.php =================================================================== --- trunk/api/api_glgroups.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_glgroups.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -81,7 +81,7 @@ if (sizeof($Errors)==0) { $sql = "INSERT INTO accountgroups ('" .mb_substr($FieldNames,0,-2) . "') VALUES ('" . mb_substr($FieldValues,0,-2) . "' ) "; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_glsections.php =================================================================== --- trunk/api/api_glsections.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_glsections.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -45,7 +45,7 @@ if (sizeof($Errors)==0) { $sql = "INSERT INTO accountsection ('" . mb_substr($FieldNames,0,-2) . "') VALUES ('" . mb_substr($FieldValues,0,-2) . "')"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_locations.php =================================================================== --- trunk/api/api_locations.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_locations.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -152,7 +152,7 @@ $sql = "INSERT INTO locations (" . mb_substr($FieldNames,0,-2) . ") VALUES ('" . mb_substr($FieldValues,0,-2) . "') "; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -214,7 +214,7 @@ } $sql = mb_substr($sql,0,-2)." WHERE loccode='".$Location['loccode']."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_purchdata.php =================================================================== --- trunk/api/api_purchdata.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_purchdata.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -86,7 +86,7 @@ $sql = "INSERT INTO purchdata (".mb_substr($FieldNames,0,-2).") VALUES ('" . mb_substr($FieldValues,0,-2). "') "; DB_Txn_Begin(); - $result = DB_Query($sql, $db); + $result = DB_query($sql); DB_Txn_Commit(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -135,7 +135,7 @@ $sql = mb_substr($sql,0,-2) . " WHERE stockid='" . $PurchDataDetails['stockid'] ."' AND supplierno='" . $PurchDataDetails['supplierno'] ."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); echo DB_error_no(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; Modified: trunk/api/api_salesareas.php =================================================================== --- trunk/api/api_salesareas.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_salesareas.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -83,7 +83,7 @@ $sql = 'INSERT INTO areas ('.mb_substr($FieldNames,0,-2) . ") VALUES ('" .mb_substr($FieldValues,0,-2) . "') "; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_salesman.php =================================================================== --- trunk/api/api_salesman.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_salesman.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -67,7 +67,7 @@ $sql = 'INSERT INTO salesman ('.mb_substr($FieldNames,0,-2).') '. 'VALUES ('.mb_substr($FieldValues,0,-2).') '; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_salesorders.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -875,7 +875,7 @@ $AssResult = api_DB_query($SQL); - while ($AssParts = DB_fetch_array($AssResult,$db)){ + while ($AssParts = DB_fetch_array($AssResult)){ $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; /* Need to get the current location quantity Modified: trunk/api/api_salestypes.php =================================================================== --- trunk/api/api_salestypes.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_salestypes.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -69,7 +69,7 @@ $sql = "INSERT INTO salestypes ('" . mb_substr($FieldNames,0,-2) . "') VALUES ('" . mb_substr($FieldValues,0,-2) . "') "; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { Modified: trunk/api/api_stock.php =================================================================== --- trunk/api/api_stock.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_stock.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -258,7 +258,7 @@ function GetCategoryGLCode($CategoryID, $field, $db) { $sql='SELECT '.$field." FROM stockcategory WHERE categoryid='".$CategoryID."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); return $myrow[0]; } @@ -369,8 +369,8 @@ $locsql = "INSERT INTO locstock (loccode,stockid) SELECT locations.loccode,'" . $StockItemDetails['stockid'] . "' FROM locations"; DB_Txn_Begin(); - $stockresult = DB_Query($stocksql, $db); - $locresult = DB_Query($locsql, $db); + $stockresult = DB_query($stocksql); + $locresult = DB_query($locsql); DB_Txn_Commit(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -483,7 +483,7 @@ } $sql = mb_substr($sql,0,-2)." WHERE stockid='".$StockItemDetails['stockid']."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); echo DB_error_no(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -510,7 +510,7 @@ return $Errors; } $sql="SELECT * FROM stockmaster WHERE stockid='".$StockID."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { $Errors[0]=0; $Errors[1]=DB_fetch_array($result); @@ -533,7 +533,7 @@ $sql="SELECT stockid FROM stockmaster WHERE " . $Field ." LIKE '%".$Criteria."%'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $i=0; $StockItemList = array(); while ($myrow=DB_fetch_array($result)) { @@ -591,7 +591,7 @@ return $Errors; } $sql="SELECT reorderlevel, loccode FROM locstock WHERE stockid='".$StockID."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { $i=0; while ($myrow=DB_fetch_array($result)) { @@ -621,7 +621,7 @@ $sql="UPDATE locstock SET reorderlevel='".$ReorderLevel."' WHERE stockid='".$StockID."' AND loccode='".$Location."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { return 0; } else { @@ -644,7 +644,7 @@ FROM salesorderdetails WHERE stkcode='".$StockID."' AND completed=0"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { $Errors[0]=0; $Errors[1]=DB_fetch_array($result); @@ -669,7 +669,7 @@ FROM purchorderdetails WHERE itemcode='".$StockID."' AND completed=0"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { $Errors[0]=0; $Errors[1]=DB_fetch_array($result); @@ -696,7 +696,7 @@ WHERE stockid='".$StockID."' and typeabbrev='".$SalesType."' and currabrev='".$Currency."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); if ($myrow[0]==0) { $sql="INSERT INTO prices VALUES('". $StockID."', @@ -711,7 +711,7 @@ AND typeabbrev='".$SalesType."' AND currabrev='".$Currency."'"; } - $result = DB_Query($sql, $db); + $result = DB_query($sql); $Errors[0] = 0; return $Errors; } @@ -735,7 +735,7 @@ AND currabrev='".$Currency. "' AND startdate<='". Date('Y-m-d') . "' AND (enddate>'" . Date('Y-m-d') . "' OR enddate='0000-00-00')"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); if ($myrow[0]==0) { $Errors[0] = NoPricesSetup; @@ -748,7 +748,7 @@ AND startdate<='". Date('Y-m-d') . "' AND (enddate>'" . Date('Y-m-d') . "' OR enddate='0000-00-00')"; } - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); $Errors[0]=0; $Errors[1]=$myrow; @@ -770,7 +770,7 @@ ON taxauthrates.taxcatid=stockmaster.taxcatid WHERE stockid='". $StockID . "' AND taxauthority='". $TaxAuth . "'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow = DB_fetch_row($result); $Errors[0]=0; $Errors[1]=$myrow; @@ -886,7 +886,7 @@ WHERE stockmoves.type=25) as t ON stockserialitems.stockid=t.stockid and stockserialitems.serialno=t.serialno WHERE stockid='".$StockID."' AND loccode='".$Location."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { $i=0; while ($myrow=DB_fetch_array($result)) { Modified: trunk/api/api_stockcategories.php =================================================================== --- trunk/api/api_stockcategories.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_stockcategories.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -66,7 +66,7 @@ $sql = "INSERT INTO stockcategory ('" . mb_substr($FieldNames,0,-2) . "') VALUES ('" . mb_substr($FieldValues,0,-2) . "') "; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -107,7 +107,7 @@ } $sql = mb_substr($sql,0,-2)." WHERE categoryid='" . $CategoryDetails['categoryid'] . "'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); echo DB_error_no(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -134,7 +134,7 @@ return $Errors; } $sql="SELECT * FROM stockcategory WHERE categoryid='".$Categoryid."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { return DB_fetch_array($result); } else { @@ -156,7 +156,7 @@ categorydescription FROM stockcategory WHERE " . $Field ." " . LIKE . " '%".$Criteria."%'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $i=0; $CategoryList = array(); while ($myrow=DB_fetch_array($result)) { @@ -183,7 +183,7 @@ ON stockitemproperties.stockid=stockmaster.stockid WHERE stockitemproperties.value like '".$Label."' AND stockcatproperties.categoryid='".$Category."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $i=0; $ItemList = array(); $ItemList[0]=0; @@ -205,7 +205,7 @@ $sql="SELECT value FROM stockitemproperties WHERE stockid='".$StockID."' AND stkcatpropid='".$Property . "'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $myrow=DB_fetch_array($result); $Errors[0]=0; $Errors[1]=$myrow[0]; Modified: trunk/api/api_suppliers.php =================================================================== --- trunk/api/api_suppliers.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_suppliers.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -206,7 +206,7 @@ $sql = 'INSERT INTO suppliers ('.mb_substr($FieldNames,0,-2).') '. 'VALUES ('.mb_substr($FieldValues,0,-2).') '; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; } else { @@ -294,7 +294,7 @@ } $sql = mb_substr($sql,0,-2)." WHERE supplierid='".$SupplierDetails['supplierid']."'"; if (sizeof($Errors)==0) { - $result = DB_Query($sql, $db); + $result = DB_query($sql); echo DB_error_no(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -321,7 +321,7 @@ return $Errors; } $sql="SELECT * FROM suppliers WHERE supplierid='".$SupplierID."'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); if (sizeof($Errors)==0) { return DB_fetch_array($result); } else { @@ -342,7 +342,7 @@ $sql='SELECT supplierid FROM suppliers WHERE '.$Field." LIKE '%".$Criteria."%' ORDER BY supplierid"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $i=0; $SupplierList = array(); while ($myrow=DB_fetch_array($result)) { Modified: trunk/api/api_workorders.php =================================================================== --- trunk/api/api_workorders.php 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/api/api_workorders.php 2018-02-04 15:57:45 UTC (rev 7933) @@ -244,9 +244,9 @@ 'VALUES ('.mb_substr($ItemFieldValues,0,-2).') '; $systypessql = 'UPDATE systypes set typeno='.GetNextTransactionNo(40, $db).' where typeid=40'; DB_Txn_Begin(); - $woresult = DB_Query($wosql, $db); - $itemresult = DB_Query($itemsql, $db); - $systyperesult = DB_Query($systypessql, $db); + $woresult = DB_query($wosql); + $itemresult = DB_query($itemsql); + $systyperesult = DB_query($systypessql); DB_Txn_Commit(); if (DB_error_no() != 0) { $Errors[0] = DatabaseUpdateFailed; @@ -355,7 +355,7 @@ DB_query($systypessql); DB_query($costsql); if ($Batch!='') { - DB_Query($batchsql, $db); + DB_query($batchsql); } DB_Txn_Commit(); if (DB_error_no() != 0) { @@ -475,7 +475,7 @@ $sql="SELECT wo FROM woitems WHERE " . $Field ." " . LIKE . " '%".$Criteria."%'"; - $result = DB_Query($sql, $db); + $result = DB_query($sql); $i=0; $WOList = array(); while ($myrow=DB_fetch_array($result)) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-03 00:57:14 UTC (rev 7932) +++ trunk/doc/Change.log 2018-02-04 15:57:45 UTC (rev 7933) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. 2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function. 2/2/18 PaulT: PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115) 31/1/18 PaulT: Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message. |
From: <tu...@us...> - 2018-02-04 17:44:11
|
Revision: 7934 http://sourceforge.net/p/web-erp/reponame/7934 Author: turbopt Date: 2018-02-04 17:44:09 +0000 (Sun, 04 Feb 2018) Log Message: ----------- Paul Becker (PaulT merge/commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) Modified Paths: -------------- trunk/PrintCustOrder.php trunk/PrintCustOrder_generic.php trunk/doc/Change.log trunk/includes/PDFOrderPageHeader_generic.inc Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2018-02-04 15:57:45 UTC (rev 7933) +++ trunk/PrintCustOrder.php 2018-02-04 17:44:09 UTC (rev 7934) @@ -19,7 +19,8 @@ <br /> <br /> <table class="table_index"> - <tr><td class="menu_group_item"> + <tr> + <td class="menu_group_item"> <ul> <li><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> <li><a href="'. $RootPath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> @@ -37,6 +38,7 @@ /*retrieve the order details from the database to print */ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); + $sql = "SELECT salesorders.customerref, salesorders.comments, salesorders.orddate, @@ -85,10 +87,21 @@ include('includes/header.php'); echo '<div class="centre"><br /><br /><br />'; prnMsg( _('Unable to Locate Order Number') . ' : ' . $_GET['TransNo'] . ' ', 'error'); - echo '<br /><br /><br /><table class="table_index"><tr><td class="menu_group_item"> - <li><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> - <li><a href="'. $RootPath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> - </td></tr></table></div><br /><br /><br />'; + echo '<br /> + <br /> + <br /> + <table class="table_index"> + <tr> + <td class="menu_group_item"> + <li><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $RootPath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> + </td> + </tr> + </table> + </div> + <br /> + <br /> + <br />'; include('includes/footer.php'); exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ @@ -139,7 +152,8 @@ salesorderdetails.quantity, salesorderdetails.qtyinvoiced, salesorderdetails.unitprice, - stockmaster.decimalplaces + stockmaster.decimalplaces, + stockmaster.units FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; @@ -204,9 +218,10 @@ $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); - $LeftOvers = $pdf->addTextWrap(13,$YPos,135,$FontSize,$myrow2['stkcode']); - $LeftOvers = $pdf->addTextWrap(148,$YPos,239,$FontSize,$myrow2['description']); + $LeftOvers = $pdf->addTextWrap(13,$YPos,135,$FontSize,$myrow2['stkcode'],'left'); + $LeftOvers = $pdf->addTextWrap(148,$YPos,239,$FontSize,$myrow2['description'],'left'); $LeftOvers = $pdf->addTextWrap(387,$YPos,90,$FontSize,$DisplayQty,'right'); + $LeftOvers = $pdf->addTextWrap(475,$YPos,20,$FontSize,$myrow2['units'],'left'); $LeftOvers = $pdf->addTextWrap(505,$YPos,90,$FontSize,$DisplayQtySupplied,'right'); $LeftOvers = $pdf->addTextWrap(604,$YPos,90,$FontSize,$DisplayPrevDel,'right'); Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2018-02-04 15:57:45 UTC (rev 7933) +++ trunk/PrintCustOrder_generic.php 2018-02-04 17:44:09 UTC (rev 7934) @@ -6,12 +6,14 @@ include('includes/session.php'); include('includes/SQL_CommonFunctions.inc'); - //Get Out if we have no order number to work with -If (!isset($_GET['TransNo']) OR $_GET['TransNo']==""){ +If (!isset($_GET['TransNo']) OR $_GET['TransNo']==''){ $Title = _('Select Order To Print'); include('includes/header.php'); - echo '<div class="centre"><br /><br /><br />'; + echo '<div class="centre"> + <br /> + <br /> + <br />'; prnMsg( _('Select an Order Number to Print before calling this page') , 'error'); echo '<br /> <br /> @@ -20,7 +22,7 @@ <tr> <td class="menu_group_item"> <ul> - <li><a href="'. $RootPath . '/SelectSalesOrder.php?">' . _('Outstanding Sales Orders') . '</a></li> + <li><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Outstanding Sales Orders') . '</a></li> <li><a href="'. $RootPath . '/SelectCompletedOrder.php">' . _('Completed Sales Orders') . '</a></li> </ul> </td> @@ -31,7 +33,7 @@ <br /> <br />'; include('includes/footer.php'); - exit(); + exit; } /*retrieve the order details from the database to print */ @@ -101,7 +103,6 @@ <br /> <br /> <br />'; - include('includes/footer.php'); exit(); } elseif (DB_num_rows($result)==1){ /*There is only one order header returned - thats good! */ @@ -143,12 +144,12 @@ /*retrieve the order details from the database to print */ -/* Then there's an order to print and its not been printed already (or its been flagged for reprinting) +/* Then there's an order to print and it has not been printed already (or its been flagged for reprinting) LETS GO */ $PaperSize = 'A4_Landscape'; include('includes/PDFStarter.php'); -//$pdf->selectFont('./fonts/Helvetica.afm'); + $pdf->addInfo('Title', _('Customer Laser Packing Slip') ); $pdf->addInfo('Subject', _('Laser Packing slip for order') . ' ' . $_GET['TransNo']); $FontSize=12; @@ -174,6 +175,9 @@ salesorderdetails.narrative, stockmaster.mbflag, stockmaster.decimalplaces, + stockmaster.grossweight, + stockmaster.volume, + stockmaster.units, stockmaster.controlled, stockmaster.serialised, pickreqdetails.qtypicked, @@ -205,10 +209,13 @@ while ($myrow2=DB_fetch_array($result)){ - $ListCount ++; + $ListCount ++; + $Volume += $myrow2['quantity'] * $myrow2['volume']; + $Weight += $myrow2['quantity'] * $myrow2['grossweight']; $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $DisplayPrevDel = locale_number_format($myrow2['qtyinvoiced'],$myrow2['decimalplaces']); + if ($myrow2['qtypicked'] > 0) { $DisplayQtySupplied = locale_number_format($myrow2['qtypicked'], $myrow2['decimalplaces']); } else { @@ -215,15 +222,35 @@ $DisplayQtySupplied = locale_number_format($myrow2['quantity'] - $myrow2['qtyinvoiced'],$myrow2['decimalplaces']); } - $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode']); - $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$myrow2['description']); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize,$myrow2['stkcode'],'left'); + $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize,$myrow2['description'],'left'); $LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize,$DisplayQty,'right'); - $LeftOvers = $pdf->addTextWrap(487,$YPos,70,$FontSize,$myrow2['bin'],'left'); - $LeftOvers = $pdf->addTextWrap(573,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); - $LeftOvers = $pdf->addTextWrap(672,$YPos,85,$FontSize,$DisplayPrevDel,'right'); + $LeftOvers = $pdf->addTextWrap(487,$YPos,85,$FontSize,$myrow2['units'],'left'); + $LeftOvers = $pdf->addTextWrap(527,$YPos,70,$FontSize,$myrow2['bin'],'left'); + $LeftOvers = $pdf->addTextWrap(593,$YPos,85,$FontSize,$DisplayQtySupplied,'right'); + $LeftOvers = $pdf->addTextWrap(692,$YPos,85,$FontSize,$DisplayPrevDel,'right'); + if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { + // Prints salesorderdetails.narrative: + $FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative. + $Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative. + $LeftOvers = trim($myrow2['narrative']); + //********** + $LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character. + $LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character + $LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character + //********** + while (mb_strlen($LeftOvers) > 1) { + $YPos -= $FontSize2; + if ($YPos < ($Bottom_Margin)) {// Begins new page. + include ('includes/PDFOrderPageHeader_generic.inc'); + } + $LeftOvers = $pdf->addTextWrap(147, $YPos, $Width2, $FontSize2, $LeftOvers); + } + } + if ($YPos-$line_height <= 50){ - /* We reached the end of the page so finsih off the page and start a newy */ + /* We reached the end of the page so finish off the page and start a newy */ $PageNumber++; include ('includes/PDFOrderPageHeader_generic.inc'); } //end if need a new page headed up @@ -231,11 +258,12 @@ /*increment a line down for the next line item */ $YPos -= ($line_height); } + if ($myrow2['cust_part'] > '') { $LeftOvers = $pdf->addTextWrap($XPos, $YPos, 127, $FontSize, $myrow2['cust_part'], 'right'); $LeftOvers = $pdf->addTextWrap(147, $YPos, 255, $FontSize, $myrow2['cust_description']); if ($YPos - $line_height <= 50) { - /* We reached the end of the page so finsih off the page and start a newy */ + /* We reached the end of the page so finish off the page and start a newy */ $PageNumber++; include('includes/PDFOrderPageHeader_generic.php'); } //end if need a new page headed up @@ -244,6 +272,7 @@ $YPos -= ($line_height); } } + if ($myrow2['mbflag']=='A'){ /*Then its an assembly item - need to explode into it's components for packing list purposes */ $sql = "SELECT bom.component, @@ -277,6 +306,7 @@ } } //loop around all the components of the assembly } + if ($myrow2['controlled'] == '1') { $ControlLabel = _('Lot') . ':'; if ($myrow2['serialised'] == 1) { @@ -306,7 +336,19 @@ } /*end if there are order details to show on the order*/ + if ( $Copy != 'Customer' ) { + $LeftOvers = $pdf->addTextWrap(375,20,150,$FontSize,'Accepted/Received By:','left'); + $pdf->line(500,20,650,20); + $LeftOvers = $pdf->addTextWrap(675,20,50,$FontSize,'Date:','left'); + $pdf->line(710,20,785,20); + } + + $LeftOvers = $pdf->addTextWrap(17,20,100,$FontSize,'Volume: ' . round($Volume) . ' GA','left'); + $LeftOvers = $pdf->addTextWrap(147,20,200,$FontSize,'Weight: ' . round($Weight) . ' LB (approximate)','left'); + $Copy='Customer'; + $Volume = 0; + $Weight = 0; } /*end for loop to print the whole lot twice */ @@ -320,8 +362,8 @@ include('includes/footer.php'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf'); - $pdf->__destruct(); + $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted=CURRENT_DATE Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-04 15:57:45 UTC (rev 7933) +++ trunk/doc/Change.log 2018-02-04 17:44:09 UTC (rev 7934) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) 2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. 2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function. 2/2/18 PaulT: PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115) Modified: trunk/includes/PDFOrderPageHeader_generic.inc =================================================================== --- trunk/includes/PDFOrderPageHeader_generic.inc 2018-02-04 15:57:45 UTC (rev 7933) +++ trunk/includes/PDFOrderPageHeader_generic.inc 2018-02-04 17:44:09 UTC (rev 7934) @@ -9,28 +9,29 @@ /* if the deliver blind flag is set on the order, we do not want to output the company logo */ if ($DeliverBlind < 2) { - $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+20,520,0,60); + $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos,490,0,60); } $FontSize=18; if ($Copy=='Customer'){ - $pdf->addText($XPos-20, 500,$FontSize, _('Packing Slip') . ' - ' . _('Customer Copy') ); + $pdf->addText($XPos-40, 585,$FontSize, _('Packing Slip') . ' - ' . _('Customer Copy') ); } else { - $pdf->addText($XPos-20, 500,$FontSize, _('Packing Slip') . ' - ' . _('Office Copy') ); + $pdf->addText($XPos-40, 585,$FontSize, _('Packing Slip') . ' - ' . _('Office Copy') ); } /* if the deliver blind flag is set on the order, we do not want to output the company contact info */ if ($DeliverBlind < 2) { - $FontSize=14; + $FontSize=12; $YPos = 480; $pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']); - $FontSize =8; - $pdf->addText($XPos, $YPos-12,$FontSize, $_SESSION['CompanyRecord']['regoffice1']); - $pdf->addText($XPos, $YPos-21,$FontSize, $_SESSION['CompanyRecord']['regoffice2']); - $pdf->addText($XPos, $YPos-30,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); - $pdf->addText($XPos, $YPos-39,$FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); - $pdf->addText($XPos, $YPos-48,$FontSize, $_SESSION['CompanyRecord']['email']); + $FontSize=10; + $pdf->addText($XPos, $YPos-14,$FontSize, $_SESSION['CompanyRecord']['regoffice1']); + $pdf->addText($XPos, $YPos-26,$FontSize, $_SESSION['CompanyRecord']['regoffice2']); + $pdf->addText($XPos, $YPos-38,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']); + $pdf->addText($XPos, $YPos-50,$FontSize, $_SESSION['CompanyRecord']['regoffice6']); + $pdf->addText($XPos, $YPos-62,$FontSize, _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] . ' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']); + $pdf->addText($XPos, $YPos-74,$FontSize, $_SESSION['CompanyRecord']['email']); } $XPos = 46; @@ -41,7 +42,7 @@ $pdf->addText($XPos, $YPos-15,$FontSize, $myrow['deliverto']); $pdf->addText($XPos, $YPos-30,$FontSize, $myrow['deladd1']); $pdf->addText($XPos, $YPos-45,$FontSize, $myrow['deladd2']); -$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5'] . ' ' . $myrow['deladd6']); +$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5'] . ' ' . $myrow['deladd6']); $YPos -= 80; @@ -49,27 +50,29 @@ $pdf->addText($XPos, $YPos-15,$FontSize, $myrow['name']); $pdf->addText($XPos, $YPos-30,$FontSize, $myrow['address1']); $pdf->addText($XPos, $YPos-45,$FontSize, $myrow['address2']); -$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']. ' ' . $myrow['address6']); +$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']. ' ' . $myrow['address6']); -$pdf->addText($XPos, $YPos-82,$FontSize, _('Customer No.'). ' : ' . $myrow['debtorno']); -$pdf->addText($XPos, $YPos-100,$FontSize, _('Shipped by'). ' : ' . $myrow['shippername']); +$pdf->addText($XPos, $YPos-82,$FontSize, _('Customer No.'). ': ' . $myrow['debtorno']); +$pdf->addText($XPos, $YPos-100,$FontSize, _('Shipped by'). ': ' . $myrow['shippername']); -$LeftOvers = $pdf->addTextWrap($XPos,$YPos-130,170,$FontSize,_('Comments').':'.stripcslashes($myrow['comments'])); +$FontSize=12; +$LeftOvers = $pdf->addTextWrap($XPos,$YPos-130,250,$FontSize,_('Comments').': '.stripcslashes($myrow['comments'])); if (mb_strlen($LeftOvers)>1){ - $LeftOvers = $pdf->addTextWrap($XPos,$YPos-145,170,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos-145,250,$FontSize,$LeftOvers); if (mb_strlen($LeftOvers)>1){ - $LeftOvers = $pdf->addTextWrap($XPos,$YPos-160,170,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos-160,250,$FontSize,$LeftOvers); if (mb_strlen($LeftOvers)>1){ - $LeftOvers = $pdf->addTextWrap($XPos,$YPos-175,170,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos-175,250,$FontSize,$LeftOvers); if (mb_strlen($LeftOvers)>1){ - $LeftOvers = $pdf->addTextWrap($XPos,$YPos-180,170,$FontSize,$LeftOvers); + $LeftOvers = $pdf->addTextWrap($XPos,$YPos-180,250,$FontSize,$LeftOvers); } } } } +$FontSize=14; $pdf->addText(620, 560,$FontSize, _('Order No'). ':'); $pdf->addText(700, 560,$FontSize, $_GET['TransNo']); $pdf->addText(620, 560-15,$FontSize, _('Your Ref'). ':'); @@ -91,9 +94,10 @@ $LeftOvers = $pdf->addTextWrap($XPos,$YPos,127,$FontSize, _('Item Code'),'left'); $LeftOvers = $pdf->addTextWrap(147,$YPos,255,$FontSize, _('Item Description'),'left'); $LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize, _('Quantity'),'right'); -$LeftOvers = $pdf->addTextWrap(487,$YPos,70,$FontSize, _('Bin Locn'),'center'); -$LeftOvers = $pdf->addTextWrap(573,$YPos,85,$FontSize,_('This Del'),'center'); -$LeftOvers = $pdf->addTextWrap(672,$YPos,85,$FontSize, _('Prev Dels'),'center'); +$LeftOvers = $pdf->addTextWrap(487,$YPos,85,$FontSize, _('Units'),'left'); +$LeftOvers = $pdf->addTextWrap(527,$YPos,70,$FontSize, _('Bin Locn'),'left'); +$LeftOvers = $pdf->addTextWrap(593,$YPos,85,$FontSize,_('This Del'),'right'); +$LeftOvers = $pdf->addTextWrap(692,$YPos,85,$FontSize, _('Prev Dels'),'right'); $YPos -= $line_height; |
From: <tu...@us...> - 2018-02-04 21:17:02
|
Revision: 7935 http://sourceforge.net/p/web-erp/reponame/7935 Author: turbopt Date: 2018-02-04 21:16:59 +0000 (Sun, 04 Feb 2018) Log Message: ----------- Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) Modified Paths: -------------- trunk/MRPPlannedPurchaseOrders.php trunk/doc/Change.log Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2018-02-04 17:44:09 UTC (rev 7934) +++ trunk/MRPPlannedPurchaseOrders.php 2018-02-04 21:16:59 UTC (rev 7935) @@ -14,20 +14,12 @@ include('includes/header.php'); echo '<br />'; prnMsg( _('The MRP calculation must be run before you can run this report') . '<br />' . - _('To run the MRP calculation click').' ' . '<a href='.$RootPath .'/MRP.php>' . _('here') . '</a>', 'error'); + _('To run the MRP calculation click').' ' . '<a href="' . $RootPath .'/MRP.php">' . _('here') . '</a>', 'error'); include('includes/footer.php'); exit; } -if (isset($_POST['PrintPDF'])) { +if ( isset($_POST['PrintPDF']) OR isset($_POST['Review']) ) { - include('includes/PDFStarter.php'); - $pdf->addInfo('Title',_('MRP Planned Purchase Orders Report')); - $pdf->addInfo('Subject',_('MRP Planned Purchase Orders')); - $FontSize=9; - $PageNumber=1; - $line_height=12; - - $Xpos = $Left_Margin+1; $WhereDate = ' '; $ReportDate = ' '; if (Is_Date($_POST['cutoffdate'])) { @@ -110,18 +102,19 @@ $result = DB_query($sql,'','',false,true); if (DB_error_no() !=0) { - $Title = _('MRP Planned Purchase Orders') . ' - ' . _('Problem Report'); - include('includes/header.php'); - prnMsg( _('The MRP planned purchase orders could not be retrieved by the SQL because') . ' ' . DB_error_msg(),'error'); - echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu') . '</a>'; - if ($debug==1){ - echo '<br />' . $sql; - } - include('includes/footer.php'); - exit; + $Title = _('MRP Planned Purchase Orders') . ' - ' . _('Problem Report'); + include('includes/header.php'); + prnMsg( _('The MRP planned purchase orders could not be retrieved by the SQL because') . ' ' . DB_error_msg(),'error'); + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo '<br />' . $sql; + } + include('includes/footer.php'); + exit; } + if (DB_num_rows($result)==0){ //then there is nothing to print - $Title = _('Print MRP Planned Purchase Orders Error'); + $Title = _('Print MRP Planned Purchase Orders'); include('includes/header.php'); prnMsg(_('There were no items with planned purchase orders'),'info'); echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; @@ -129,24 +122,34 @@ exit; } - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$_POST['Consolidation'],$ReportDate); + if (isset($_POST['PrintPDF'])) { // Print planned purchase orders - $Total_Shortage=0; - $Partctr = 0; - $fill = false; - $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted - $FontSize=8; - $holdpart = ' '; - $holddescription = ' '; - $holdmbflag = ' '; - $holdcost = ' '; - $holddecimalplaces = 0; - $totalpartqty = 0; - $totalpartcost = 0; - $Total_Extcost = 0; + include('includes/PDFStarter.php'); + $pdf->addInfo('Title',_('MRP Planned Purchase Orders Report')); + $pdf->addInfo('Subject',_('MRP Planned Purchase Orders')); + $FontSize=9; + $PageNumber=1; + $line_height=12; - while ($myrow = DB_fetch_array($result)){ + $Xpos = $Left_Margin+1; + + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, + $Page_Width,$Right_Margin,$_POST['Consolidation'],$ReportDate); + + $Partctr = 0; + $fill = false; + $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted + $FontSize=8; + $holdpart = ' '; + $holddescription = ' '; + $holdmbflag = ' '; + $holdcost = ' '; + $holddecimalplaces = 0; + $totalpartqty = 0; + $totalpartcost = 0; + $Total_Extcost = 0; + + while ($myrow = DB_fetch_array($result)){ $YPos -=$line_height; // Print information on part break @@ -160,7 +163,7 @@ $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); // Get and print supplier info for part - list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); + list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart); $displaydate = $lastdate; if (!Is_Date($lastdate)) { @@ -219,89 +222,176 @@ PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, $Right_Margin,$_POST['Consolidation'],$ReportDate); } - } /*end while loop */ + } /*end while loop */ - // Print summary information for last part - $YPos -=$line_height; - $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill); - $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); - $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty,$holddecimalplaces),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); - $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); + // Print summary information for last part + $YPos -=$line_height; + $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill); + $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); + $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty,$holddecimalplaces),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); + $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); - // Get and print supplier info for part - list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); - $displaydate = $lastdate; + // Get and print supplier info for part + list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart); + $displaydate = $lastdate; - if (!Is_Date($lastdate)) { - $displaydate = ' '; - } + if (!Is_Date($lastdate)) { + $displaydate = ' '; + } - $YPos -= $line_height; - $pdf->addTextWrap(50,$YPos,80,$FontSize,_('Last Purchase Date: '),'left',0,$fill); - $pdf->addTextWrap(130,$YPos,60,$FontSize,$displaydate,'left',0,$fill); - $pdf->addTextWrap(190,$YPos,60,$FontSize,_('Supplier: '),'left',0,$fill); - $pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill); - $pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill); - $pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill); - $FontSize =8; - $YPos -= (2*$line_height); + $YPos -= $line_height; + $pdf->addTextWrap(50,$YPos,80,$FontSize,_('Last Purchase Date: '),'left',0,$fill); + $pdf->addTextWrap(130,$YPos,60,$FontSize,$displaydate,'left',0,$fill); + $pdf->addTextWrap(190,$YPos,60,$FontSize,_('Supplier: '),'left',0,$fill); + $pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill); + $pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill); + $pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill); + $FontSize =8; + $YPos -= (2*$line_height); - if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$ReportDate); - // include('includes/MRPPlannedPurchaseOrdersPageHeader.inc'); - } + if ($YPos < $Bottom_Margin + $line_height){ + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$_POST['Consolidation'],$ReportDate); + } - /*Print out the grand totals */ - $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left'); - $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); - $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right'); - $DisplayTotalVal = locale_number_format($Total_Extcost,$_SESSION['CompanyRecord']['decimalplaces']); - $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); + /*Print out the grand totals */ + $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left'); + $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); + $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right'); + $DisplayTotalVal = locale_number_format($Total_Extcost,$_SESSION['CompanyRecord']['decimalplaces']); + $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); - $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf'); - $pdf->__destruct(); + $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + + } else { // Review planned purchase orders + + $Title = _('Review/Convert MRP Planned Purchase Orders'); + include('includes/header.php'); + echo '<p class="page_title_text"> + <img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $Title . '</p>'; + + echo '<form action="MRPConvertWorkOrders.php" method="post"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <th colspan="9"> + <h3>' . _('Consolidation') . ': ' . $_POST['Consolidation'] . ' ' + . _('Cutoff Date') . ': ' . $_POST['cutoffdate'] . '</h3> + </th> + </tr> + <tr> + <th> </th> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('MRP Date') . '</th> + <th>' . _('Due Date') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Ext. Cost') . '</th> + <th>' . _('Consolidations') . '</th> + </tr>'; + + $TotalPartQty = 0; + $TotalPartCost = 0; + $Total_ExtCost = 0; + $j=1; //row ID + $k=0; //row colour counter + while ($myrow = DB_fetch_array($result)){ + + // Alternate row color + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + + list($lastdate,$lastsupplier,$preferredsupplier,$conversionfactor) = GetPartInfo($myrow['part']); + + echo '<td><a href="' . $RootPath . '/PO_Header.php?NewOrder=Yes&SelectedSupplier=' . urlencode($preferredsupplier) . '&StockID=' . urlencode($myrow['part']) . '&Quantity=' . urlencode($myrow['supplyquantity']/$conversionfactor) . '">' . _('Convert') . '</a></td> + <td>' . '<a href="' . $RootPath . '/SelectProduct.php?StockID=' . urlencode($myrow['part']) . '">' . $myrow['part'] . '</a>' . '<input type="hidden" name="' . $j . '_part" value="' . $myrow['part']. '" /></td> + <td>' . $myrow['description'] . '</td> + <td>' . ConvertSQLDate($myrow['mrpdate']) . '</td> + <td>' . ConvertSQLDate($myrow['duedate']) . '</td> + <td class="number">' . locale_number_format($myrow['supplyquantity'],$myrow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['computedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['supplyquantity'] * $myrow['computedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + + if ($_POST['Consolidation']!='None') { + echo '<td class="number">' . $myrow['consolidatedcount'] . '</td>'; + } + else { + echo '<td> </td>'; // Last cell blank when Consolidation is None. + } + echo '</tr>'; + + $j++; + $Total_ExtCost += ( $myrow['supplyquantity'] * $myrow['computedcost'] ); + + } // end while loop + + // Print out the grand totals + echo '<tr> + <td colspan="3" class="number">' . _('Number of Purchase Orders') .': ' . ($j-1) . '</td> + <td colspan="4" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr> + </table> + </div> + </form>'; + + echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; + include('includes/footer.php'); + + } // end Review planned purchase orders } else { /*The option to print PDF was not hit so display form */ $Title=_('MRP Planned Purchase Orders Reporting'); include('includes/header.php'); - echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . - _('Inventory') . '" alt="" />' . ' ' . $Title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $Title . '</p>'; - echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> - <div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr> - <td>' . _('Consolidation') . ':</td> - <td><select required="required" name="Consolidation"> - <option selected="selected" value="None">' . _('None') . '</option> - <option value="Weekly">' . _('Weekly') . '</option> - <option value="Monthly">' . _('Monthly') . '</option> - </select></td> - </tr> - <tr> - <td>' . _('Print Option') . ':</td> - <td><select name="Fill"> - <option selected="selected" value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> - <option value="no">' . _('Plain Print') . '</option> - </select></td> - </tr> - <tr> - <td>' . _('Cut Off Date') . ':</td> - <td><input type ="text" required="required" class="date" alt="'.$_SESSION['DefaultDateFormat'] . - '" name="cutoffdate" size="10" value="'.date($_SESSION['DefaultDateFormat']).'" /></td> - </tr> - </table> - <br /> - <div class="centre"> - <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> - </div> - </div> - </form>'; + echo '<br /><br /> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <td>' . _('Consolidation') . ':</td> + <td> + <select required="required" name="Consolidation"> + <option selected="selected" value="None">' . _('None') . '</option> + <option value="Weekly">' . _('Weekly') . '</option> + <option value="Monthly">' . _('Monthly') . '</option> + </select> + </td> + </tr> + <tr> + <td>' . _('Print Option') . ':</td> + <td> + <select name="Fill"> + <option selected="selected" value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> + <option value="no">' . _('Plain Print') . '</option> + </select> + </td> + </tr> + <tr> + <td>' . _('Cut Off Date') . ':</td> + <td> + <input type ="text" required="required" class="date" alt="'.$_SESSION['DefaultDateFormat'] . '" name="cutoffdate" size="10" value="'.date($_SESSION['DefaultDateFormat']).'" /> + </td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="Review" value="' . _('Review') . '" /> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </div> + </form>'; include('includes/footer.php'); @@ -310,7 +400,7 @@ function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, $Page_Width,$Right_Margin,$consolidation,$ReportDate) { - /*PDF page header for MRP Planned Work Orders report */ + /*PDF page header for MRP Planned Purchase Orders report */ if ($PageNumber>1){ $pdf->newPage(); } @@ -327,6 +417,7 @@ $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -= $line_height; + if ($consolidation == 'None') { $displayconsolidation = _('None'); } elseif ($consolidation == 'Weekly') { @@ -334,6 +425,7 @@ } else { $displayconsolidation = _('Monthly'); } + $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); @@ -347,6 +439,7 @@ $pdf->addTextWrap(200,$YPos,60,$FontSize,_('MRP Date'), 'right'); $pdf->addTextWrap(260,$YPos,50,$FontSize,_('Quantity'), 'right'); $pdf->addTextWrap(310,$YPos,60,$FontSize,_('Ext. Cost'), 'right'); + if ($consolidation == 'None') { $pdf->addTextWrap(370,$YPos,80,$FontSize,_('Source Type'), 'right'); $pdf->addTextWrap(450,$YPos,80,$FontSize,_('Source Order'), 'right'); @@ -359,7 +452,7 @@ $PageNumber++; } // End of PrintHeader function -function GetPartInfo(&$db,$part) { +function GetPartInfo($part) { // Get last purchase order date and supplier for part, and also preferred supplier // Printed when there is a part break $sql = "SELECT orddate as maxdate, @@ -369,10 +462,12 @@ WHERE purchorderdetails.itemcode = '" . $part ."' ORDER BY orddate DESC LIMIT 1"; $result = DB_query($sql); + if (DB_num_rows($result)>0) { $myrow = DB_fetch_array($result); $PartInfo[] = ConvertSQLDate($myrow['maxdate']); $OrderNo= $myrow['orderno']; + $sql = "SELECT supplierno FROM purchorders WHERE purchorders.orderno = '" .$OrderNo. "'"; @@ -379,7 +474,8 @@ $result = DB_query($sql); $myrow = DB_fetch_array($result); $PartInfo[] = $myrow['supplierno']; - $sql = "SELECT supplierno + + $sql = "SELECT supplierno, conversionfactor FROM purchdata WHERE stockid = '" . $part . "' AND preferred='1'"; @@ -386,11 +482,12 @@ $result = DB_query($sql); $myrow = DB_fetch_array($result); $PartInfo[] = $myrow['supplierno']; + $PartInfo[] = $myrow['conversionfactor']; + return $PartInfo; } else { - return array('','',''); + return array('','','',''); } - } ?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-04 17:44:09 UTC (rev 7934) +++ trunk/doc/Change.log 2018-02-04 21:16:59 UTC (rev 7935) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) 2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. 2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function. |
From: <tu...@us...> - 2018-02-05 02:34:35
|
Revision: 7936 http://sourceforge.net/p/web-erp/reponame/7936 Author: turbopt Date: 2018-02-05 02:34:31 +0000 (Mon, 05 Feb 2018) Log Message: ----------- Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. Modified Paths: -------------- trunk/AuditTrail.php trunk/BOMs.php trunk/BOMs_SingleLevel.php trunk/ConfirmDispatch_Invoice.php trunk/ContractCosting.php trunk/CounterReturns.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/FixedAssetItems.php trunk/GLProfit_Loss.php trunk/GoodsReceived.php trunk/InternalStockRequestFulfill.php trunk/InternalStockRequestInquiry.php trunk/MailingGroupMaintenance.php trunk/PcClaimExpensesFromTab.php trunk/RecurringSalesOrders.php trunk/RecurringSalesOrdersProcess.php trunk/ReverseGRN.php trunk/SelectCreditItems.php trunk/SelectOrderItems.php trunk/SelectQASamples.php trunk/StockAdjustments.php trunk/StockLocTransferReceive.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/TaxAuthorities.php trunk/TaxCategories.php trunk/TaxProvinces.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/Z_AutoCustomerAllocations.php trunk/Z_ChangeSupplierCode.php trunk/Z_ImportFixedAssets.php trunk/Z_ImportGLTransactions.php trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc trunk/includes/DefineCartClass.php trunk/includes/DefineContractClass.php trunk/includes/DefineOfferClass.php trunk/includes/DefineReceiptClass.php trunk/includes/DefineSerialItems.php trunk/includes/DefineSuppTransClass.php trunk/includes/GetPrice.inc trunk/includes/PDFPaymentRun_PymtFooter.php trunk/includes/SQL_CommonFunctions.inc trunk/index.php trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php trunk/reportwriter/WriteForm.inc trunk/reportwriter/WriteReport.inc trunk/reportwriter/admin/RCFunctions.inc trunk/reportwriter/admin/ReportCreator.php trunk/reportwriter/install/ReportListForm.php trunk/reportwriter/install/ReportListLinks.php Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/AuditTrail.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -29,7 +29,7 @@ } // Get list of tables -$TableResult = DB_show_tables($db); +$TableResult = DB_show_tables(); // Get list of users $UserResult = DB_query("SELECT userid FROM www_users ORDER BY userid"); @@ -226,4 +226,4 @@ } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/BOMs.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -11,7 +11,6 @@ function display_children($Parent, $Level, &$BOMTree) { - global $db; global $i; // retrive all children of parent @@ -1097,4 +1096,4 @@ return strlen(substr(strrchr($SQLNumber, "."),1)); } -?> +?> \ No newline at end of file Modified: trunk/BOMs_SingleLevel.php =================================================================== --- trunk/BOMs_SingleLevel.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/BOMs_SingleLevel.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -11,7 +11,6 @@ function display_children($Parent, $Level, &$BOMTree) { - global $db; global $i; // retrive all children of parent Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ConfirmDispatch_Invoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -890,7 +890,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1251,7 +1251,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($OrderLine->Taxes as $Tax) { Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ContractCosting.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -370,7 +370,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/CounterReturns.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -948,7 +948,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['Items' . $identifier]->TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1172,7 +1172,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($ReturnItemLine->Taxes as $Tax) { @@ -1569,7 +1569,7 @@ $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $ReceiptDebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $ReceiptDebtorTransID = DB_Last_Insert_ID('debtortrans','id'); //and finally add the allocation record between receipt and invoice @@ -1826,4 +1826,4 @@ } echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/CounterSales.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1359,7 +1359,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['Items'.$identifier]->TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1584,7 +1584,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($OrderLine->Taxes as $Tax) { @@ -2021,7 +2021,7 @@ $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $ReceiptDebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $ReceiptDebtorTransID = DB_Last_Insert_ID('debtortrans','id'); $SQL = "UPDATE debtorsmaster SET lastpaiddate = '" . $DefaultDispatchDate . "', lastpaid='" . filter_number_format($_POST['AmountPaid']) . "' @@ -2398,4 +2398,4 @@ echo '</form>'; } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Credit_Invoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -658,7 +658,7 @@ $DbgMsg = _('The following SQL to insert the customer credit note was used'); $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); - $CreditTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $CreditTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -958,7 +958,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ //echo "<div align="left"><pre>"; var_dump($CreditLine); echo "</pre> </div>"; if($CreditLine->Controlled ==1) { @@ -1060,7 +1060,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); $SQL = "INSERT INTO stockmoves(stockid, type, @@ -1145,7 +1145,7 @@ $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); } /*Insert the taxes that applied to this line */ @@ -1652,4 +1652,4 @@ echo '</div>'; echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/FixedAssetItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -277,7 +277,7 @@ $result = DB_query($sql, $ErrMsg, $DbgMsg); if (DB_error_no() ==0) { - $NewAssetID = DB_Last_Insert_ID($db,'fixedassets', 'assetid'); + $NewAssetID = DB_Last_Insert_ID('fixedassets', 'assetid'); prnMsg( _('The new asset has been added to the database with an asset code of:') . ' ' . $NewAssetID,'success'); unset($_POST['LongDescription']); unset($_POST['Description']); @@ -692,4 +692,4 @@ </div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/GLProfit_Loss.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -93,7 +93,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; @@ -1320,4 +1320,4 @@ echo '</div>';// div class=? echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/GoodsReceived.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -591,7 +591,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($OrderLine->Controlled ==1){ @@ -825,4 +825,4 @@ echo '</div>'; echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/InternalStockRequestFulfill.php =================================================================== --- trunk/InternalStockRequestFulfill.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/InternalStockRequestFulfill.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -91,7 +91,7 @@ /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); $SQL="UPDATE stockrequestitems SET qtydelivered=qtydelivered+" . $Quantity . " @@ -368,4 +368,4 @@ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/InternalStockRequestInquiry.php =================================================================== --- trunk/InternalStockRequestInquiry.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/InternalStockRequestInquiry.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -35,10 +35,10 @@ <td>' . _('From Stock Location') . ':</td> <td><select name="StockLocation">'; $sql = "SELECT locations.loccode, locationname, canview FROM locations - INNER JOIN locationusers - ON locationusers.loccode=locations.loccode + INNER JOIN locationusers + ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' - AND locationusers.canview=1 + AND locationusers.canview=1 AND locations.internalrequest=1"; $LocResult = DB_query($sql); $LocationCounter = DB_num_rows($LocResult); @@ -55,7 +55,7 @@ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } else { - if ($LocationCounter>1 AND $locallctr == 0) {//we show All only when it is necessary + if ($LocationCounter>1 AND $locallctr == 0) {//we show All only when it is necessary echo '<option value="All">' . _('All') . '</option>'; $locallctr = 1; } @@ -71,7 +71,7 @@ $LocationCounter = DB_num_rows($authresult); if ($LocationCounter>0) { $Authorizer = true; - + while ($myrow = DB_fetch_array($authresult)) { $Locations[] = $myrow['loccode']; if (isset($_POST['StockLocation'])) { @@ -90,8 +90,8 @@ } } echo '</select></td>'; - + } else { prnMsg(_('You have no authority to do the internal request inquiry'),'error'); include('includes/footer.php'); @@ -122,16 +122,16 @@ echo '<td>' . _('Department') . '</td> <td><select name="Department">'; //now lets retrieve those deparment available for this user; - $sql = "SELECT departments.departmentid, + $sql = "SELECT departments.departmentid, departments.description - FROM departments LEFT JOIN stockrequest + FROM departments LEFT JOIN stockrequest ON departments.departmentid = stockrequest.departmentid - AND (departments.authoriser = '" . $_SESSION['UserID'] . "' OR stockrequest.initiator = '" . $_SESSION['UserID'] . "') - WHERE stockrequest.dispatchid IS NOT NULL - GROUP BY stockrequest.departmentid";//if a full request is need, the users must have all of those departments' authority + AND (departments.authoriser = '" . $_SESSION['UserID'] . "' OR stockrequest.initiator = '" . $_SESSION['UserID'] . "') + WHERE stockrequest.dispatchid IS NOT NULL + GROUP BY stockrequest.departmentid";//if a full request is need, the users must have all of those departments' authority $depresult = DB_query($sql); if (DB_num_rows($depresult)>0) { - $Departments = array(); + $Departments = array(); if (isset($_POST['Department']) AND $_POST['Department'] == 'All') { echo '<option selected="selected" value="All">' . _('All') . '</option>'; } else { @@ -161,12 +161,10 @@ $_POST['FromDate'] = ''; } echo '<td>' . _('Date From') . '</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" vaue="' . $_POST['FromDate'] .'" /></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" vaue="' . $_POST['FromDate'] .'" /></td> <td>' . _('Date To') . '</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> - <td><input type="submit" name="Search" value="' ._('Search') . '" /></td></tr></table> - - '; + <td><input type="submit" name="Search" value="' ._('Search') . '" /></td></tr></table>'; if (!isset($_POST['ShowDetails'])) { $_POST['ShowDetails'] = 1; } @@ -173,9 +171,9 @@ $Checked = ($_POST['ShowDetails'] == 1)?'checked="checked"':''; echo '<td>' . _('Show Details') . ' <input type="checkbox" ' . $Checked . ' name="ShowDetails" /> </td>'; - //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous + //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous //hereby if the authorizer is login, we only show all category available, even if there is problem, it'll be correceted later when items selected -:) - if (isset($Authorizer)) { + if (isset($Authorizer)) { $WhereAuthorizer = ''; } else { $WhereAuthorizer = " AND internalstockcatrole.secroleid = '" . $_SESSION['AccessLevel'] . "' "; @@ -193,7 +191,7 @@ if ($Cats >0) { - + echo '<br /><table class="selection"> <tr> <th colspan="6"><h3>' . _('To search for internal request for a specific part use the part selection facilities below') . '</h3></th> @@ -201,7 +199,7 @@ <tr> <td>' . _('Stock Category') . '</td> <td><select name="StockCat">'; - + if (!isset($_POST['StockCat'])) { $_POST['StockCat'] = ''; } @@ -222,7 +220,7 @@ if (!isset($_POST['Keywords'])) { $_POST['Keywords'] = ''; } - echo '<td><input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" /></td>'; + echo '<td><input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" /></td>'; echo '</tr> <tr> <td></td> @@ -254,7 +252,7 @@ } -} +} if(isset($StockItemsResult)){ @@ -297,7 +295,7 @@ echo '</table>'; } - + } elseif(isset($_POST['Search']) OR isset($StockID)) {//lets show the search result here if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { $StockID = DB_fetch_array($StockItemsResult); @@ -305,7 +303,7 @@ } if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $SQL = "SELECT stockrequest.dispatchid, + $SQL = "SELECT stockrequest.dispatchid, stockrequest.loccode, stockrequest.departmentid, departments.description, @@ -321,11 +319,10 @@ stockrequestitems.decimalplaces, uom, completed - FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid - INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode - INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid - "; + FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid + INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode + INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid"; } else { $SQL = "SELECT stockrequest.dispatchid, stockrequest.loccode, @@ -338,7 +335,7 @@ narrative, initiator FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode "; + INNER JOIN locations ON locations.loccode=stockrequest.loccode"; } //lets add the condition selected by users if (isset($_POST['RequestNo']) AND $_POST['RequestNo'] !== '') { @@ -368,9 +365,9 @@ $Departments = unserialize(base64_decode($_POST['Departments'])); $Departments = implode("','", $Departments); $SQL .= " AND stockrequest.departmentid IN ('" . $Departments . "')"; - + } //IF there are no departments set,so forgot it - + } } else { $SQL .= " AND stockrequest.departmentid='" . $_POST['Department'] . "'"; @@ -382,7 +379,7 @@ if (isset($_POST['ToDate']) AND is_date($_POST['ToDate'])) { $SQL .= " AND despatchdate<='" . $_POST['ToDate'] . "'"; } - //item selected + //item selected if (isset($StockID)) { $SQL .= " AND stockrequestitems.stockid='" . $StockID . "'"; } @@ -415,12 +412,12 @@ <th>' . _('Locations') . '</th> <th>' . _('Department') . '</th> <th>' . _('Authorization') . '</th> - <th>' . _('Dispatch Date') . '</th> + <th>' . _('Dispatch Date') . '</th> </tr>'; } if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $ID = '';//mark the ID change of the internal request + $ID = '';//mark the ID change of the internal request } $i = 0; //There are items without details AND with it @@ -443,7 +440,7 @@ $Disp = ConvertSQLDate($myrow['despatchdate']); } if (isset($ID)) { - if ($myrow['completed'] == 0) { + if ($myrow['completed'] == 0) { $Comp = _('No'); } else { $Comp = _('Yes'); @@ -484,28 +481,17 @@ }//end of while loop; $Html .= '</table>'; echo '<a href="' . $RootPath . '/InternalStockRequestInquiry.php">' . _('Select Others') . '</a>'; - + echo $Html; } else { prnMsg(_('There are no stock request available'),'warn'); - } + } +} - - - - - - - - - -} - include('includes/footer.php'); exit; function GetSearchItems ($SQLConstraint='') { - global $db; if ($_POST['Keywords'] AND $_POST['StockCode']) { echo _('Stock description keywords have been used in preference to the Stock code extract entered'); } @@ -518,7 +504,7 @@ INNER JOIN departments ON stockrequest.departmentid = departments.departmentid INNER JOIN stockmaster ON stockrequestitems.stockid = stockmaster.stockid"; - if (isset($_POST['StockCat']) + if (isset($_POST['StockCat']) AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ $WhereStockCat = ''; } else { @@ -552,4 +538,4 @@ return $StockItemsResult; } -?> +?> \ No newline at end of file Modified: trunk/MailingGroupMaintenance.php =================================================================== --- trunk/MailingGroupMaintenance.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/MailingGroupMaintenance.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -8,7 +8,7 @@ if(!isset($_POST['Clean']) and !isset($_GET['Delete']) and !isset($_GET['Edit']) and !isset($_GET['Add']) and !isset($_GET['Remove'])){ GetMailGroup(); } -//validate the input +//validate the input if(isset($_POST['Enter'])){ //user has input a new value $InputError = 0; if(!empty($_POST['MailGroup']) and mb_strlen(trim($_POST['MailGroup']))<=100 and !ContainsIllegalCharacters($_POST['MailGroup'])){ @@ -71,7 +71,7 @@ prnMsg(_('The group id must be numeric'),'error'); include('includes/footer.php'); exit; - + } } @@ -88,7 +88,7 @@ include('includes/footer.php'); exit; } - + }else{ prnMsg(_('The page must be called with a group id'),'error'); include('includes/footer.php'); @@ -95,9 +95,9 @@ exit; } GetUsers($GroupId,$GroupName); - include('includes/footer.php'); - + include('includes/footer.php'); + } //Users remove one user from the group if(isset($_GET['Remove'])){ @@ -146,7 +146,7 @@ </form> -<?php +<?php include('includes/footer.php'); } @@ -153,15 +153,8 @@ ?> - - - - - - <?php function GetMailGroup () { -global $db; //GET the mailing group data if there are any $sql = "SELECT groupname, id FROM mailgroups ORDER BY groupname"; $ErrMsg = _('Failed to retrieve mail groups information'); @@ -174,7 +167,7 @@ while($myrow = DB_fetch_array($result)){ ?> <tr><td><?php echo $myrow['groupname']; ?></td> - + <td><?php echo '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'?GroupId='.$myrow['id'].'&Edit=1&GroupName='.$myrow['groupname'].'" >' . _('Edit') . '</a>'; ?></td> <td><?php echo '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'?Id='.$myrow['id'].'&Delete=1" onclick="return confirm(\'' ._('Are you sure you wish to delete this group?').'\');">' . _('Delete') . '</a>'; ?></td> </tr> @@ -188,25 +181,24 @@ } function GetUsers ($GroupId,$GroupName) { - global $db; $sql = "SELECT userid FROM mailgroups INNER JOIN mailgroupdetails ON mailgroups.groupname=mailgroupdetails.groupname WHERE mailgroups.id = '".$GroupId."'"; $ErrMsg = _('Failed to retrieve userid'); $result = DB_query($sql,$ErrMsg); - + $UsersAssigned = array(); if(DB_num_rows($result) != 0){ - $i = 0; + $i = 0; while($myrow = DB_fetch_array($result)){ $UsersAssigned[$i] = $myrow['userid']; $i++; } } - + $sql = "SELECT userid, realname, email FROM www_users ORDER BY realname"; $ErrMsg = _('Failed to retrieve user information'); $result = DB_query($sql,$ErrMsg); if(DB_num_rows($result) != 0){ - + ?> <div class="centre"><?php echo _('Current Mail Group').' : '.$GroupName; ?></div> <div class="centre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'); ?>"><?php echo _('View All Groups'); ?></a></div> @@ -230,7 +222,7 @@ <?php $k = 0; } - + if(in_array($myrow['userid'],$UsersAssigned)){ ?> <td><?php echo $myrow['userid']; ?></td> @@ -267,4 +259,4 @@ exit; } } -?> +?> \ No newline at end of file Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/PcClaimExpensesFromTab.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -165,7 +165,7 @@ )"; $Msg = _('The expense claim on tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); $Result = DB_query($SQL); - $SelectedIndex = DB_Last_Insert_ID($db, 'pcashdetails', 'counterindex'); + $SelectedIndex = DB_Last_Insert_ID('pcashdetails', 'counterindex'); foreach ($_POST as $Index => $Value) { if (substr($Index, 0, 5) == 'index') { $Index = $Value; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/RecurringSalesOrders.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -267,7 +267,7 @@ $DbgMsg = _('The SQL that failed was'); $InsertQryResult = DB_query($HeaderSQL,$ErrMsg,$DbgMsg,true); - $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); + $RecurrOrderNo = DB_Last_Insert_ID('recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno, stkcode, Modified: trunk/RecurringSalesOrdersProcess.php =================================================================== --- trunk/RecurringSalesOrdersProcess.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/RecurringSalesOrdersProcess.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -367,7 +367,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -683,7 +683,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); $SQL = "INSERT INTO debtortranstaxes (debtortransid, @@ -724,4 +724,4 @@ }/*end while there are recurring orders due to have a new order created */ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ReverseGRN.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -257,7 +257,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result=DB_query($SQL,$ErrMsg,$DbgMsg,true); - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); if ($Controlled==true){ while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)){ @@ -463,4 +463,4 @@ } } include ('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectCreditItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1171,7 +1171,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $CreditTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $CreditTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1332,7 +1332,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the stockmoveno from above - need to ref StockMoveTaxes and possibly SerialStockMoves */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($CreditLine->Taxes as $Tax) { @@ -1613,7 +1613,7 @@ /*Its a write off too still so need to process the serial items written off */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); foreach($CreditLine->SerialItems as $Item){ /*no need to check StockSerialItems record exists @@ -2024,4 +2024,4 @@ } /*end of process credit note */ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectOrderItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1888,7 +1888,6 @@ include('includes/footer.php'); function GetCustBranchDetails($identifier) { - global $db; $sql = "SELECT custbranch.brname, custbranch.branchcode, custbranch.braddress1, @@ -1917,4 +1916,4 @@ $result = DB_query($sql,$ErrMsg,$DbgMsg); return $result; } -?> +?> \ No newline at end of file Modified: trunk/SelectQASamples.php =================================================================== --- trunk/SelectQASamples.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectQASamples.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -106,7 +106,7 @@ } else { CreateQASample($_POST['ProdSpecKey'],$_POST['LotKey'], $_POST['Identifier'], $_POST['Comments'], $_POST['Cert'], $_POST['DuplicateOK'],$db); - $SelectedSampleID=DB_Last_Insert_ID($db,'qasamples','sampleid'); + $SelectedSampleID=DB_Last_Insert_ID('qasamples','sampleid'); if ($SelectedSampleID > '') { $msg = _('Created New Sample'); prnMsg($msg , 'success'); Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockAdjustments.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -240,7 +240,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -540,4 +540,4 @@ </div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockLocTransferReceive.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -113,7 +113,7 @@ $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -267,7 +267,7 @@ /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ if($TrfLine->Controlled ==1) { Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockTransfers.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -283,7 +283,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -437,7 +437,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SupplierCredit.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1145,7 +1145,7 @@ $DbgMsg = _('The following SQL to insert the supplier credit note was used'); $Result = DB_query($SQL, $ErrMsg, $DbgMsg, True); - $SuppTransID = DB_Last_Insert_ID($db,'supptrans','id'); + $SuppTransID = DB_Last_Insert_ID('supptrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['SuppTrans']->Taxes AS $TaxTotals) { @@ -1341,4 +1341,4 @@ echo '</div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SupplierInvoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1518,7 +1518,7 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The supplier invoice transaction could not be added to the database because'); $DbgMsg = _('The following SQL to insert the supplier invoice was used'); $Result = DB_query($SQL, $ErrMsg, $DbgMsg, True); - $SuppTransID = DB_Last_Insert_ID($db,'supptrans','id'); + $SuppTransID = DB_Last_Insert_ID('supptrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['SuppTrans']->Taxes AS $TaxTotals) { @@ -1925,4 +1925,4 @@ } //end of return link for input errors include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxAuthorities.php =================================================================== --- trunk/TaxAuthorities.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxAuthorities.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -74,7 +74,7 @@ $msg = _('The new tax authority record has been added to the database'); - $NewTaxID = DB_Last_Insert_ID($db,'taxauthorities','taxid'); + $NewTaxID = DB_Last_Insert_ID('taxauthorities','taxid'); $sql = "INSERT INTO taxauthrates ( taxauthority, @@ -337,4 +337,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxCategories.php =================================================================== --- trunk/TaxCategories.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxCategories.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -88,7 +88,7 @@ $ErrMsg = _('The new tax category could not be added'); $result = DB_query($sql,$ErrMsg,true); - $LastTaxCatID = DB_Last_Insert_ID($db, 'taxcategories','taxcatid'); + $LastTaxCatID = DB_Last_Insert_ID('taxcategories','taxcatid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, @@ -256,4 +256,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxProvinces.php =================================================================== --- trunk/TaxProvinces.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxProvinces.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -90,7 +90,7 @@ $ErrMsg = _('Could not add tax province'); $result = DB_query($sql, $ErrMsg); - $TaxProvinceID = DB_Last_Insert_ID($db, 'taxprovinces', 'taxprovinceid'); + $TaxProvinceID = DB_Last_Insert_ID('taxprovinces', 'taxprovinceid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) SELECT taxauthorities.taxid, '" . $TaxProvinceID . "', taxcategories.taxcatid FROM taxauthorities CROSS JOIN taxcategories"; @@ -247,4 +247,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/WorkOrderIssue.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -233,7 +233,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($IssueItemRow['controlled'] ==1){ @@ -1190,4 +1190,4 @@ </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/WorkOrderReceive.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -492,7 +492,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($WORow['controlled'] ==1){ @@ -1021,4 +1021,4 @@ echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Z_AutoCustomerAllocations.php =================================================================== --- trunk/Z_AutoCustomerAllocations.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_AutoCustomerAllocations.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -116,7 +116,6 @@ include('includes/footer.php'); function ProcessAllocation() { - global $db; if ($InputError==0) { // //========[ START TRANSACTION ]=========== @@ -240,4 +239,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/Z_ChangeSupplierCode.php =================================================================== --- trunk/Z_ChangeSupplierCode.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ChangeSupplierCode.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -37,7 +37,6 @@ function ProcessSupplier($oldCode, $newCode) { - global $db; $table_key= array ( 'grns' => 'supplierid', 'offers'=>'supplierid', @@ -106,7 +105,6 @@ } function checkSupplierExist($codeSupplier) { - global $db; $result=DB_query("SELECT supplierid FROM suppliers WHERE supplierid='" . $codeSupplier . "'"); if (DB_num_rows($result)==0) return false; return true; @@ -121,4 +119,4 @@ } return true; } -?> +?> \ No newline at end of file Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ImportFixedAssets.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -219,7 +219,7 @@ if (DB_error_no() ==0) { //the insert of the new code worked so bang in the fixedassettrans records too - $AssetID = DB_Last_Insert_ID($db, 'fixedassets','assetid'); + $AssetID = DB_Last_Insert_ID('fixedassets','assetid'); $sql = "INSERT INTO fixedassettrans ( assetid, transtype, transno, @@ -313,4 +313,4 @@ } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportGLTransactions.php =================================================================== --- trunk/Z_ImportGLTransactions.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ImportGLTransactions.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -266,8 +266,6 @@ include('includes/footer.php'); function IsBankAccount($Account) { - global $db; - $sql ="SELECT accountcode FROM bankaccounts WHERE accountcode='" . $Account . "'"; $result = DB_query($sql); if (DB_num_rows($result)==0) { @@ -277,4 +275,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/api/api_debtortransactions.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -803,7 +803,7 @@ $Result = api_DB_query($SQL,'','',true); } /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -1088,7 +1088,7 @@ $Result = api_DB_query($SQL,'','',true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/api/api_salesorders.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -970,7 +970,7 @@ $Result = api_DB_query($SQL,'','',true); } /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -1263,7 +1263,7 @@ $Result = api_DB_query($SQL,'','',true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/doc/Change.log 2018-02-05 02:34:31 UTC (rev 7936) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. 2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) 2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_mysql.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -4,10 +4,11 @@ define('LIKE', 'LIKE'); -global $db;// Make sure it IS global, regardless of our context if(!isset($mysqlport)) { $mysqlport = 3306; } +global $db;// Make sure it IS global, regardless of our context + $db = mysql_connect($host . ':' . $mysqlport, $DBUser, $DBPassword); //this statement sets the charset to be used for sending data to and from the db server @@ -14,10 +15,6 @@ //if not set, both mysql server and mysql client/library may assume otherwise mysql_set_charset('utf8', $db); -//$varabc = mysql_client_encoding($db); -//printf("client encoding is %s\n", $varabc); - - if(!$db) { echo '<br />' . _('The configuration in the file config.php for the database user name and password do not provide the information required to connect to the database server'); session_unset(); @@ -29,10 +26,9 @@ /* Update to allow RecurringSalesOrdersProcess.php to run via cron */ if(isset($DatabaseName)) { - if(! mysql_select_db($_SESSION['DatabaseName'],$db)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } @@ -39,14 +35,12 @@ } else { if(! mysql_select_db($_SESSION['DatabaseName'],$db)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } } -require_once($PathPrefix . 'includes/MiscFunctions.php'); - //DB wrapper functions to change only once for whole application function DB_query($SQL, $ErrorMessage='', $DebugMessage= '', $Transaction=false, $TrapErrors=true) { @@ -69,12 +63,12 @@ prnMsg($ErrorMessage . '<br />' . DB_error_msg(), 'error', _('Database Error')); if($debug == 1) { prnMsg($DebugMessage . '<br />' . $SQL . '<br />', 'error', _('Database SQL Failure')); - } + } if($Transaction) { $SQL = 'rollback'; $Result = DB_query($SQL); if(DB_error_no() != 0) { - prnMsg(_('Error Rolling Back Transaction'), '', _('Database Rollback Error') ); + prnMsg(_('Error Rolling Back Transaction'), 'error', _('Database Rollback Error') ); } } if($TrapErrors) { @@ -103,7 +97,6 @@ } return $result; - } function DB_fetch_row($ResultIndex) { @@ -147,7 +140,7 @@ return mysql_error($db); } -function DB_Last_Insert_ID(&$Conn='',$table, $fieldname) { +function DB_Last_Insert_ID($table, $fieldname) { // return mysql_insert_id($db); if (isset($_SESSION['LastInsertId'])) { $Last_Insert_ID = $_SESSION['LastInsertId']; @@ -162,58 +155,58 @@ return mysql_real_escape_string($String); } -function DB_show_tables(&$Conn='') { +function DB_show_tables() { $Result = DB_query('SHOW TABLES'); return $Result; } -function DB_show_fields($TableName, &$Conn='') { +function DB_show_fields($TableName) { $Result = DB_query("DESCRIBE $TableName"); return $Result; } function interval( $val, $Inter ) { - global $DBType; - return "\n".'interval ' . $val . ' '. $Inter."\n"; + return "\n".'interval ' . $val . ' ' . $Inter . "\n"; } function DB_Maintenance() { prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); - $TablesResult = DB_query('SHOW TABLES'); + + $TablesResult = DB_show_tables(); while ($myrow = DB_fetch_row($TablesResult)) { $Result = DB_query('OPTIMIZE TABLE ' . $myrow[0]); } $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } function DB_Txn_Begin() { global $db; - mysql_query("SET autocommit=0",$db); - mysql_query("START TRANSACTION",$db); + mysql_query('SET autocommit=0',$db); + mysql_query('START TRANSACTION',$db); } function DB_Txn_Commit() { global $db; - mysql_query("COMMIT",$db); - mysql_query("SET autocommit=1",$db); + mysql_query('COMMIT',$db); + mysql_query('SET autocommit=1',$db); } function DB_Txn_Rollback() { global $db; - mysql_query("ROLLBACK",$db); + mysql_query('ROLLBACK',$db); } function DB_IgnoreForeignKeys() { global $db; - mysql_query("SET FOREIGN_KEY_CHECKS=0",$db); + mysql_query('SET FOREIGN_KEY_CHECKS=0',$db); } function DB_ReinstateForeignKeys() { global $db; - mysql_query("SET FOREIGN_KEY_CHECKS=1",$db); + mysql_query('SET FOREIGN_KEY_CHECKS=1',$db); } -?> +?> \ No newline at end of file Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_mysqli.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -15,9 +15,7 @@ global $db; // Make sure it IS global, regardless of our context $db = mysqli_connect($host , $DBUser, $DBPassword,$_SESSION['DatabaseName'], $mysqlport); -//$result=DB_query('SET sql_mode = ANSI'); - //this statement sets the charset to be used for sending data to and from the db server //if not set, both mysqli server and mysqli client/library may assume otherwise mysqli_set_charset($db, 'utf8'); @@ -40,7 +38,7 @@ if(isset($DatabaseName)) { if(!mysqli_select_db($db,$DatabaseName)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset ($DatabaseName); exit; } @@ -47,8 +45,7 @@ } else { if(!mysqli_select_db($db,$_SESSION['DatabaseName'])) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; - + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset ($_SESSION['DatabaseName']); exit; } @@ -63,7 +60,6 @@ global $db; $result = mysqli_query($db, $SQL); - $_SESSION['LastInsertId'] = mysqli_insert_id($db); if($DebugMessage == '') { @@ -111,6 +107,7 @@ } } } + return $result; } @@ -146,7 +143,6 @@ function DB_affected_rows($ResultIndex) { global $db; return mysqli_affected_rows($db); - } function DB_error_no() { @@ -159,7 +155,7 @@ return mysqli_error($db); } -function DB_Last_Insert_ID($Conn='', $Table, $FieldName) { +function DB_Last_Insert_ID($Table, $FieldName) { // return mysqli_insert_id($Conn); if(isset($_SESSION['LastInsertId'])) { $Last_Insert_ID = $_SESSION['LastInsertId']; @@ -175,33 +171,31 @@ return mysqli_real_escape_string($db, $String); } -function DB_show_tables($Conn='') { - global $db; +function DB_show_tables() { $Result = DB_query('SHOW TABLES'); return $Result; } -function DB_show_fields($TableName, $Conn='') { +function DB_show_fields($TableName) { $Result = DB_query("DESCRIBE $TableName"); return $Result; } -function interval($val, $Inter) { - global $dbtype; - return "\n".'interval ' . $val . ' ' . $Inter . "\n"; +function interval( $val, $Inter ) { + return "\n".'interval ' . $val . ' ' . $Inter . "\n"; } function DB_Maintenance() { prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); - $TablesResult = DB_query("SHOW TABLES"); + $TablesResult = DB_show_tables(); while ($myrow = DB_fetch_row($TablesResult)) { $Result = DB_query('OPTIMIZE TABLE ' . $myrow[0]); } $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } function DB_Txn_Begin() { @@ -230,4 +224,4 @@ global $db; mysqli_query($db, 'SET FOREIGN_KEY_CHECKS=1'); } -?> +?> \ No newline at end of file Modified: trunk/includes/ConnectDB_postgres.inc =================================================================== --- trunk/includes/ConnectDB_postgres.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_postgres.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -18,15 +18,15 @@ } } -global $db; // Make sure it IS global, regardless of our context +global $db; // Make sure it IS global, regardless of our context $db = pg_connect( $PgConnStr ); if( !$db ) { if($debug==1) { - echo '<BR>' . $PgConnStr . '<BR>'; + echo '<br>' . $PgConnStr . '<br>'; } - echo '<BR>' . _('The company name entered together with the configuration in the file config.php for the database user name and password do not provide the information required to connect to the database.') . '<BR><BR>' . _(' Try logging in with an alternative company name.'); - echo '<BR><A HREF="index.php">' . _('Back to login page') . '</A>'; + echo '<br>' . _('The company name entered together with the configuration in the file config.php for the database user name and password do not provide the information required to connect to the database.') . '<br><br>' . _(' Try logging in with an alternative company name.'); + echo '<br><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } @@ -48,7 +48,7 @@ if($DebugMessage == '') { $DebugMessage = _('The SQL that failed was:'); } - //if(DB_error_no($Conn) != 0) { + if( !$result AND $TrapErrors) { if($TrapErrors) { require_once($PathPrefix . 'includes/header.php'); @@ -60,7 +60,7 @@ if($Transaction) { $SQL = 'rollback'; $Result = DB_query($SQL); - if(DB_error_no($Conn) !=0) { + if(DB_error_no() !=0) { prnMsg('<br />' . _('Error Rolling Back Transaction!!'), '', _('DB DEBUG:') ); } } @@ -109,10 +109,11 @@ } function DB_error_msg() { + global $db; return pg_last_error($db); } -function DB_Last_Insert_ID(&$Conn, $table, $fieldname) { +function DB_Last_Insert_ID($table, $fieldname) { $tempres = DB_query ("SELECT currval('".$table."_".$fieldname."_seq') FROM ".$table); $Res = pg_fetch_result( $tempres, 0, 0 ); DB_free_result($tempres); @@ -124,14 +125,13 @@ } function INTERVAL( $val, $Inter ) { - global $dbtype; return "\n(CAST( (" . $val . ") as text ) || ' ". $Inter ."')::interval\n"; } -function DB_show_tables(&$Conn) { +function DB_show_tables() { $Result =DB_query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"); return $Result; } -function DB_show_fields($TableName,&$Conn) { +function DB_show_fields($TableName) { $Result = DB_query("SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_name='" . $TableName . "'"); if(DB_num_rows($Result)==1) { $Result = DB_query("SELECT column_name FROM information_schema.columns WHERE table_name ='$TableName'"); @@ -145,8 +145,8 @@ $Result = DB_query('VACUUM ANALYZE'); $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } -?> +?> \ No newline at end of file Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/DefineCartClass.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -155,7 +155,6 @@ being retrieved from the DB - dont want to add them again - would return errors anyway */ - global $db; $sql = "INSERT INTO salesorderdetails (orderlineno, orderno, stkcode, @@ -203,7 +202,6 @@ $this->LineItems[$UpdateLineNumber]->POLine = $POLine; $this->LineItems[$UpdateLineNumber]->GPPercent = $GPPercent; if ($UpdateDB=='Yes'){ - global $db; $result = DB_query("UPDATE salesorderdetails SET quantity=" . $Qty . ", unitprice=" . $Price . ", discountpercent=" . $Disc . ", @@ -223,7 +221,6 @@ return; } if ($UpdateDB=='Yes'){ - global $db; if ($this->Some_Already_Delivered($LineNumber)==0){ /* nothing has been delivered, delete it. */ $result = DB_query("DELETE FROM salesorderdetails @@ -295,9 +292,6 @@ } function GetExistingTaxes($LineNumber, $stkmoveno){ - - global $db; - /*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 */ @@ -328,9 +322,6 @@ } //end method GetExistingTaxes function GetTaxes($LineNumber){ - - global $db; - /*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 */ @@ -369,9 +360,6 @@ } //end method GetTaxes function GetFreightTaxes () { - - global $db; - /*Gets the Taxes and rates applicable to the freight based on the tax group of the branch combined with the tax category for this particular freight and SESSION['FreightTaxCategory'] the taxprovince of the dispatch location */ Modified: trunk/includes/DefineContractClass.php =================================================================== --- trunk/includes/DefineContractClass.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/DefineContractClass.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -36,7 +36,7 @@ $this->RequirementsCounter=0; $this->Status = 0; } - + function Contract() { self::__construct; } @@ -65,7 +65,6 @@ } function Remove_ContractComponent($ContractComponent_ID){ - global $db; $result = DB_query("DELETE FROM contractbom WHERE contractref='" . $this->ContractRef . "' AND stockid='" . $this->ContractBOM[$ContractComponent_ID]->StockID . "'"); @@ -89,7 +88,6 @@ } function Remove_ContractRequirement($ContractRequirementID){ - global $db; $result = DB_query("DELETE FROM contractreqts WHERE contractreqid='" . $this->ContractReqts[$ContractRequirementID]->ContractReqID . "'"); unset($this->ContractReqts[$ContractRequirementID]); } Modified:... [truncated message content] |
From: <tu...@us...> - 2018-02-05 03:09:41
|
Revision: 7937 http://sourceforge.net/p/web-erp/reponame/7937 Author: turbopt Date: 2018-02-05 03:09:39 +0000 (Mon, 05 Feb 2018) Log Message: ----------- InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. Modified Paths: -------------- trunk/InternalStockRequestInquiry.php trunk/doc/Change.log Modified: trunk/InternalStockRequestInquiry.php =================================================================== --- trunk/InternalStockRequestInquiry.php 2018-02-05 02:34:31 UTC (rev 7936) +++ trunk/InternalStockRequestInquiry.php 2018-02-05 03:09:39 UTC (rev 7937) @@ -335,7 +335,7 @@ narrative, initiator FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode"; + INNER JOIN locations ON locations.loccode=stockrequest.loccode "; } //lets add the condition selected by users if (isset($_POST['RequestNo']) AND $_POST['RequestNo'] !== '') { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-05 02:34:31 UTC (rev 7936) +++ trunk/doc/Change.log 2018-02-05 03:09:39 UTC (rev 7937) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 PaulT: InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. 2/4/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. 2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) |
From: <tu...@us...> - 2018-02-05 21:42:12
|
Revision: 7938 http://sourceforge.net/p/web-erp/reponame/7938 Author: turbopt Date: 2018-02-05 21:42:09 +0000 (Mon, 05 Feb 2018) Log Message: ----------- PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) Modified Paths: -------------- trunk/SalesGraph.php trunk/doc/Change.log Modified: trunk/SalesGraph.php =================================================================== --- trunk/SalesGraph.php 2018-02-05 03:09:39 UTC (rev 7937) +++ trunk/SalesGraph.php 2018-02-05 21:42:09 UTC (rev 7938) @@ -225,12 +225,12 @@ $result = DB_query($SQL); $fromPeriod = DB_fetch_array($result); - $_POST['FromPeriod'] = $fromPeriod['month'] . ' ' . $fromPeriod['year']; + $starting = $fromPeriod['month'] . ' ' . $fromPeriod['year']; $toPeriod = DB_fetch_array($result); - $_POST['ToPeriod'] = $toPeriod['month'] . ' ' . $toPeriod['year']; + $ending = $toPeriod['month'] . ' ' . $toPeriod['year']; - $GraphTitle .= ' ' . _('From Period') . ' ' . $_POST['FromPeriod'] . ' ' . _('to') . ' ' . $_POST['ToPeriod'] . "\n\r"; + $GraphTitle .= ' ' . _('From Period') . ' ' . $starting . ' ' . _('to') . ' ' . $ending . "\n\r"; if ($_POST['SalesArea']=='All'){ $GraphTitle .= ' ' . _('For All Sales Areas'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-05 03:09:39 UTC (rev 7937) +++ trunk/doc/Change.log 2018-02-05 21:42:09 UTC (rev 7938) @@ -1,5 +1,6 @@ webERP Change Log +2/5/18 PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) 2/4/18 PaulT: InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. 2/4/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. 2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) |
From: <tu...@us...> - 2018-02-06 19:49:27
|
Revision: 7939 http://sourceforge.net/p/web-erp/reponame/7939 Author: turbopt Date: 2018-02-06 19:49:24 +0000 (Tue, 06 Feb 2018) Log Message: ----------- MRPPlannedPurchasekOrders.php, MRPPlannedWorkOrders.php: PaulT: Add missing table cell to work orders to match recent change to planned purchase orders and replace 'where clause joins' with table join in both files. Paul B/PaulT: Apply consistent code formatting between both files. (Some consistency matters reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) Modified Paths: -------------- trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/doc/Change.log Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2018-02-05 21:42:09 UTC (rev 7938) +++ trunk/MRPPlannedPurchaseOrders.php 2018-02-06 19:49:24 UTC (rev 7939) @@ -5,19 +5,19 @@ include('includes/session.php'); -//Maybe not ANSI SQL?? $sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; +$result=DB_query($sql); -$result=DB_query($sql); if (DB_num_rows($result)==0) { $Title=_('MRP error'); include('includes/header.php'); echo '<br />'; prnMsg( _('The MRP calculation must be run before you can run this report') . '<br />' . - _('To run the MRP calculation click').' ' . '<a href="' . $RootPath .'/MRP.php">' . _('here') . '</a>', 'error'); + _('To run the MRP calculation click') . ' ' . '<a href="' . $RootPath . '/MRP.php">' . _('here') . '</a>', 'error'); include('includes/footer.php'); exit; } + if ( isset($_POST['PrintPDF']) OR isset($_POST['Review']) ) { $WhereDate = ' '; @@ -25,79 +25,80 @@ if (Is_Date($_POST['cutoffdate'])) { $FormatDate = FormatDateForSQL($_POST['cutoffdate']); $WhereDate = " AND duedate <= '" . $FormatDate . "' "; - $ReportDate = _(' Through ') . Format_Date($_POST['cutoffdate']); + $ReportDate = ' ' . _('Through') . ' ' . $_POST['cutoffdate']; } + if ($_POST['Consolidation'] == 'None') { $sql = "SELECT mrpplannedorders.*, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag IN ('B','P') + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag IN ('B','P') " . $WhereDate . " ORDER BY mrpplannedorders.part,mrpplannedorders.duedate"; } elseif ($_POST['Consolidation'] == 'Weekly') { $sql = "SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag IN ('B','P') + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag IN ('B','P') " . $WhereDate . " GROUP BY mrpplannedorders.part, - weekindex, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost + weekindex, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost ORDER BY mrpplannedorders.part,weekindex"; } else { // This else consolidates by month $sql = "SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - EXTRACT(YEAR_MONTH from duedate) AS yearmonth, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag IN ('B','P') + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + EXTRACT(YEAR_MONTH from duedate) AS yearmonth, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag IN ('B','P') " . $WhereDate . " GROUP BY mrpplannedorders.part, - yearmonth, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost - ORDER BY mrpplannedorders.part,yearmonth "; + yearmonth, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost + ORDER BY mrpplannedorders.part,yearmonth"; } $result = DB_query($sql,'','',false,true); @@ -110,7 +111,7 @@ echo '<br />' . $sql; } include('includes/footer.php'); - exit; + exit; } if (DB_num_rows($result)==0){ //then there is nothing to print @@ -125,12 +126,13 @@ if (isset($_POST['PrintPDF'])) { // Print planned purchase orders include('includes/PDFStarter.php'); + $pdf->addInfo('Title',_('MRP Planned Purchase Orders Report')); $pdf->addInfo('Subject',_('MRP Planned Purchase Orders')); + $FontSize=9; $PageNumber=1; $line_height=12; - $Xpos = $Left_Margin+1; PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, @@ -140,30 +142,30 @@ $fill = false; $pdf->SetFillColor(224,235,255); // Defines color to make alternating lines highlighted $FontSize=8; - $holdpart = ' '; - $holddescription = ' '; - $holdmbflag = ' '; - $holdcost = ' '; - $holddecimalplaces = 0; - $totalpartqty = 0; - $totalpartcost = 0; - $Total_Extcost = 0; + $HoldPart = ' '; + $HoldDescription = ' '; + $HoldMBFlag = ' '; + $HoldCost = ' '; + $HoldDecimalPlaces = 0; + $TotalPartQty = 0; + $TotalPartCost = 0; + $Total_ExtCost = 0; while ($myrow = DB_fetch_array($result)){ $YPos -=$line_height; // Print information on part break - if ($Partctr > 0 AND $holdpart != $myrow['part']) { - $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill); + if ($Partctr > 0 AND $HoldPart != $myrow['part']) { + $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill); $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); - $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty, $holddecimalplaces),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty, $HoldDecimalPlaces),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); - $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); + $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill); // Get and print supplier info for part - list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart); + list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($HoldPart); $displaydate = $lastdate; if (!Is_Date($lastdate)) { @@ -177,8 +179,8 @@ $pdf->addTextWrap(250,$YPos,60,$FontSize,$lastsupplier,'left',0,$fill); $pdf->addTextWrap(310,$YPos,120,$FontSize,_('Preferred Supplier: '),'left',0,$fill); $pdf->addTextWrap(430,$YPos,60,$FontSize,$preferredsupplier,'left',0,$fill); - $totalpartcost = 0; - $totalpartqty = 0; + $TotalPartCost = 0; + $TotalPartQty = 0; $YPos -= (2*$line_height); // Use to alternate between lines with transparent and painted background @@ -188,17 +190,14 @@ } // Parameters for addTextWrap are defined in /includes/class.pdf.php - // 1) X position 2) Y position 3) Width - // 4) Height 5) Text 6) Alignment 7) Border 8) Fill - True to use SetFillColor - // and False to set to transparent $FormatedSupDueDate = ConvertSQLDate($myrow['duedate']); $FormatedSupMRPDate = ConvertSQLDate($myrow['mrpdate']); - $extcost = $myrow['supplyquantity'] * $myrow['computedcost']; + $ExtCost = $myrow['supplyquantity'] * $myrow['computedcost']; $pdf->addTextWrap($Left_Margin,$YPos,110,$FontSize,$myrow['part'],'',0,$fill); $pdf->addTextWrap(150,$YPos,50,$FontSize,$FormatedSupDueDate,'right',0,$fill); $pdf->addTextWrap(200,$YPos,60,$FontSize,$FormatedSupMRPDate,'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($myrow['supplyquantity'],$myrow['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($extcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($myrow['supplyquantity'], $myrow['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($ExtCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); if ($_POST['Consolidation'] == 'None'){ $pdf->addTextWrap(370,$YPos,80,$FontSize,$myrow['ordertype'],'right',0,$fill); @@ -207,35 +206,35 @@ $pdf->addTextWrap(370,$YPos,100,$FontSize,$myrow['consolidatedcount'],'right',0,$fill); } - $holddescription = $myrow['description']; - $holdpart = $myrow['part']; - $holdmbflag = $myrow['mbflag']; - $holdcost = $myrow['computedcost']; - $holddecimalplaces = $myrow['decimalplaces']; - $totalpartcost += $extcost; - $totalpartqty += $myrow['supplyquantity']; + $HoldDescription = $myrow['description']; + $HoldPart = $myrow['part']; + $HoldMBFlag = $myrow['mbflag']; + $HoldCost = $myrow['computedcost']; + $HoldDecimalPlaces = $myrow['decimalplaces']; + $TotalPartCost += $ExtCost; + $TotalPartQty += $myrow['supplyquantity']; - $Total_Extcost += $extcost; + $Total_ExtCost += $ExtCost; $Partctr++; if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$ReportDate); + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$_POST['Consolidation'],$ReportDate); } } /*end while loop */ // Print summary information for last part $YPos -=$line_height; - $pdf->addTextWrap(50,$YPos,130,$FontSize,$holddescription,'',0,$fill); + $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill); $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); - $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($holdcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($totalpartqty,$holddecimalplaces),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($totalpartcost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty,$HoldDecimalPlaces),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); - $pdf->addTextWrap(400,$YPos,15,$FontSize,$holdmbflag,'right',0,$fill); + $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill); // Get and print supplier info for part - list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($holdpart); + list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($HoldPart); $displaydate = $lastdate; if (!Is_Date($lastdate)) { @@ -261,7 +260,7 @@ $pdf->addTextWrap($Left_Margin,$YPos,120,$FontSize,_('Number of Purchase Orders: '), 'left'); $pdf->addTextWrap(150,$YPos,30,$FontSize,$Partctr, 'left'); $pdf->addTextWrap(200,$YPos,100,$FontSize,_('Total Extended Cost:'), 'right'); - $DisplayTotalVal = locale_number_format($Total_Extcost,$_SESSION['CompanyRecord']['decimalplaces']); + $DisplayTotalVal = locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']); $pdf->addTextWrap(310,$YPos,60,$FontSize,$DisplayTotalVal, 'right'); $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Purchase_Orders_' . Date('Y-m-d') . '.pdf'); @@ -285,7 +284,7 @@ </th> </tr> <tr> - <th> </th> + <th></th> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('MRP Date') . '</th> @@ -301,8 +300,8 @@ $Total_ExtCost = 0; $j=1; //row ID $k=0; //row colour counter + while ($myrow = DB_fetch_array($result)){ - // Alternate row color if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -327,7 +326,7 @@ echo '<td class="number">' . $myrow['consolidatedcount'] . '</td>'; } else { - echo '<td> </td>'; // Last cell blank when Consolidation is None. + echo '<td></td>'; // Empty cell when Consolidation is None. } echo '</tr>'; @@ -383,7 +382,7 @@ <tr> <td>' . _('Cut Off Date') . ':</td> <td> - <input type ="text" required="required" class="date" alt="'.$_SESSION['DefaultDateFormat'] . '" name="cutoffdate" size="10" value="'.date($_SESSION['DefaultDateFormat']).'" /> + <input type ="text" required="required" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="cutoffdate" autofocus="autofocus" size="10" value="' . date($_SESSION['DefaultDateFormat']) . '" /> </td> </tr> </table> Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2018-02-05 21:42:09 UTC (rev 7938) +++ trunk/MRPPlannedWorkOrders.php 2018-02-06 19:49:24 UTC (rev 7939) @@ -7,15 +7,17 @@ $sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; $result=DB_query($sql); + if (DB_num_rows($result)==0) { $Title=_('MRP error'); include('includes/header.php'); echo '<br />'; prnMsg( _('The MRP calculation must be run before you can run this report') . '<br />' . - _('To run the MRP calculation click').' ' . '<a href="' . $RootPath . '/MRP.php">' . _('here') . '</a>', 'error'); + _('To run the MRP calculation click') . ' ' . '<a href="' . $RootPath . '/MRP.php">' . _('here') . '</a>', 'error'); include('includes/footer.php'); exit; } + if ( isset($_POST['PrintPDF']) OR isset($_POST['Review']) ) { $WhereDate = ' '; @@ -28,89 +30,90 @@ if ($_POST['Consolidation'] == 'None') { $sql = "SELECT mrpplannedorders.*, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag = 'M' + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag = 'M' " . $WhereDate . " ORDER BY mrpplannedorders.part,mrpplannedorders.duedate"; } elseif ($_POST['Consolidation'] == 'Weekly') { $sql = "SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag = 'M' + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + TRUNCATE(((TO_DAYS(duedate) - TO_DAYS(CURRENT_DATE)) / 7),0) AS weekindex, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag = 'M' " . $WhereDate . " GROUP BY mrpplannedorders.part, - weekindex, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost + weekindex, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost ORDER BY mrpplannedorders.part,weekindex"; } else { // This else consolidates by month $sql = "SELECT mrpplannedorders.part, - SUM(mrpplannedorders.supplyquantity) as supplyquantity, - EXTRACT(YEAR_MONTH from duedate) AS yearmonth, - MIN(mrpplannedorders.duedate) as duedate, - MIN(mrpplannedorders.mrpdate) as mrpdate, - COUNT(*) AS consolidatedcount, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - (stockmaster.materialcost + stockmaster.labourcost + - stockmaster.overheadcost ) as computedcost - FROM mrpplannedorders, stockmaster - WHERE mrpplannedorders.part = stockmaster.stockid " . $WhereDate . " - AND stockmaster.mbflag = 'M' + SUM(mrpplannedorders.supplyquantity) as supplyquantity, + EXTRACT(YEAR_MONTH from duedate) AS yearmonth, + MIN(mrpplannedorders.duedate) as duedate, + MIN(mrpplannedorders.mrpdate) as mrpdate, + COUNT(*) AS consolidatedcount, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost ) as computedcost + FROM mrpplannedorders + INNER JOIN stockmaster + ON mrpplannedorders.part = stockmaster.stockid + WHERE stockmaster.mbflag = 'M' " . $WhereDate . " GROUP BY mrpplannedorders.part, - yearmonth, - stockmaster.stockid, - stockmaster.description, - stockmaster.mbflag, - stockmaster.decimalplaces, - stockmaster.actualcost, - stockmaster.materialcost, - stockmaster.labourcost, - stockmaster.overheadcost, - computedcost + yearmonth, + stockmaster.stockid, + stockmaster.description, + stockmaster.mbflag, + stockmaster.decimalplaces, + stockmaster.actualcost, + stockmaster.materialcost, + stockmaster.labourcost, + stockmaster.overheadcost, + computedcost ORDER BY mrpplannedorders.part,yearmonth"; } $result = DB_query($sql,'','',false,true); if (DB_error_no() !=0) { - $Title = _('MRP Planned Work Orders') . ' - ' . _('Problem Report'); - include('includes/header.php'); - prnMsg( _('The MRP planned work orders could not be retrieved by the SQL because') . ' ' . DB_error_msg(),'error'); - echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu') . '</a>'; - if ($debug==1){ - echo '<br />' . $sql; - } - include('includes/footer.php'); - exit; + $Title = _('MRP Planned Work Orders') . ' - ' . _('Problem Report'); + include('includes/header.php'); + prnMsg( _('The MRP planned work orders could not be retrieved by the SQL because') . ' ' . DB_error_msg(),'error'); + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo '<br />' . $sql; + } + include('includes/footer.php'); + exit; } + if (DB_num_rows($result)==0){ //then there is nothing to print $Title = _('MRP Planned Work Orders'); include('includes/header.php'); @@ -149,63 +152,59 @@ $Total_ExtCost = 0; while ($myrow = DB_fetch_array($result)){ - $YPos -=$line_height; + $YPos -=$line_height; - // Print information on part break - if ($Partctr > 0 AND $HoldPart != $myrow['part']) { - $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill); - $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); - $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty, $HoldDecimalPlaces),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); - $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill); - $TotalPartCost = 0; - $TotalPartQty = 0; - $YPos -= (2*$line_height); + // Print information on part break + if ($Partctr > 0 AND $HoldPart != $myrow['part']) { + $pdf->addTextWrap(50,$YPos,130,$FontSize,$HoldDescription,'',0,$fill); + $pdf->addTextWrap(180,$YPos,50,$FontSize,_('Unit Cost: '),'center',0,$fill); + $pdf->addTextWrap(220,$YPos,40,$FontSize,locale_number_format($HoldCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($TotalPartQty, $HoldDecimalPlaces),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($TotalPartCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(370,$YPos,30,$FontSize,_('M/B: '),'right',0,$fill); + $pdf->addTextWrap(400,$YPos,15,$FontSize,$HoldMBFlag,'right',0,$fill); + $TotalPartCost = 0; + $TotalPartQty = 0; + $YPos -= (2*$line_height); - // Use to alternate between lines with transparent and painted background - if ($_POST['Fill'] == 'yes'){ - $fill=!$fill; - } + // Use to alternate between lines with transparent and painted background + if ($_POST['Fill'] == 'yes'){ + $fill=!$fill; } + } - // Parameters for addTextWrap are defined in /includes/class.pdf.php - // 1) X position 2) Y position 3) Width - // 4) Height 5) Text 6) Alignment 7) Border 8) Fill - True to use SetFillColor - // and False to set to transparent - $FormatedSupDueDate = ConvertSQLDate($myrow['duedate']); - $FormatedSupMRPDate = ConvertSQLDate($myrow['mrpdate']); - $ExtCost = $myrow['supplyquantity'] * $myrow['computedcost']; - $pdf->addTextWrap($Left_Margin,$YPos,110,$FontSize,$myrow['part'],'',0,$fill); - $pdf->addTextWrap(150,$YPos,50,$FontSize,$FormatedSupDueDate,'right',0,$fill); - $pdf->addTextWrap(200,$YPos,60,$FontSize,$FormatedSupMRPDate,'right',0,$fill); - $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($myrow['supplyquantity'], $myrow['decimalplaces']),'right',0,$fill); - $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($ExtCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); + // Parameters for addTextWrap are defined in /includes/class.pdf.php + $FormatedSupDueDate = ConvertSQLDate($myrow['duedate']); + $FormatedSupMRPDate = ConvertSQLDate($myrow['mrpdate']); + $ExtCost = $myrow['supplyquantity'] * $myrow['computedcost']; + $pdf->addTextWrap($Left_Margin,$YPos,110,$FontSize,$myrow['part'],'',0,$fill); + $pdf->addTextWrap(150,$YPos,50,$FontSize,$FormatedSupDueDate,'right',0,$fill); + $pdf->addTextWrap(200,$YPos,60,$FontSize,$FormatedSupMRPDate,'right',0,$fill); + $pdf->addTextWrap(260,$YPos,50,$FontSize,locale_number_format($myrow['supplyquantity'], $myrow['decimalplaces']),'right',0,$fill); + $pdf->addTextWrap(310,$YPos,60,$FontSize,locale_number_format($ExtCost,$_SESSION['CompanyRecord']['decimalplaces']),'right',0,$fill); - if ($_POST['Consolidation'] == 'None'){ - $pdf->addTextWrap(370,$YPos,80,$FontSize,$myrow['ordertype'],'right',0,$fill); - $pdf->addTextWrap(450,$YPos,80,$FontSize,$myrow['orderno'],'right',0,$fill); - } else { - $pdf->addTextWrap(370,$YPos,100,$FontSize,$myrow['consolidatedcount'],'right',0,$fill); - } + if ($_POST['Consolidation'] == 'None'){ + $pdf->addTextWrap(370,$YPos,80,$FontSize,$myrow['ordertype'],'right',0,$fill); + $pdf->addTextWrap(450,$YPos,80,$FontSize,$myrow['orderno'],'right',0,$fill); + } else { + $pdf->addTextWrap(370,$YPos,100,$FontSize,$myrow['consolidatedcount'],'right',0,$fill); + } - $HoldDescription = $myrow['description']; - $HoldPart = $myrow['part']; - $HoldMBFlag = $myrow['mbflag']; - $HoldCost = $myrow['computedcost']; - $HoldDecimalPlaces = $myrow['decimalplaces']; - $TotalPartCost += $ExtCost; - $TotalPartQty += $myrow['supplyquantity']; + $HoldDescription = $myrow['description']; + $HoldPart = $myrow['part']; + $HoldMBFlag = $myrow['mbflag']; + $HoldCost = $myrow['computedcost']; + $HoldDecimalPlaces = $myrow['decimalplaces']; + $TotalPartCost += $ExtCost; + $TotalPartQty += $myrow['supplyquantity']; - $Total_ExtCost += $ExtCost; - $Partctr++; + $Total_ExtCost += $ExtCost; + $Partctr++; - if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$ReportDate); - // include('includes/MRPPlannedWorkOrdersPageHeader.inc'); - } + if ($YPos < $Bottom_Margin + $line_height){ + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$_POST['Consolidation'],$ReportDate); + } } /*end while loop */ // Print summary information for last part @@ -221,9 +220,8 @@ $YPos -= (2*$line_height); if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$_POST['Consolidation'],$ReportDate); - // include('includes/MRPPlannedWorkOrdersPageHeader.inc'); + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$_POST['Consolidation'],$ReportDate); } /*Print out the grand totals */ @@ -235,6 +233,7 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_MRP_Planned_Work_Orders_' . Date('Y-m-d') . '.pdf'); $pdf->__destruct(); + } else { // Review planned work orders $Title = _('Review/Convert MRP Planned Work Orders'); @@ -242,13 +241,17 @@ echo '<p class="page_title_text"> <img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $Title . '</p>'; - echo '<form action="MRPConvertWorkOrders.php" method="post">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr><th colspan="9"><h3>' . _('Consolidation') . ': ' . $_POST['Consolidation'] . - " " . _('Cutoff Date') . ': ' . $_POST['cutoffdate'] . '</h3></th></tr>'; - echo '<tr> + echo '<form action="MRPConvertWorkOrders.php" method="post"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <th colspan="9"> + <h3>' . _('Consolidation') . ': ' . $_POST['Consolidation'] . ' ' + . _('Cutoff Date') . ': ' . $_POST['cutoffdate'] . '</h3> + </th> + </tr> + <tr> <th></th> <th>' . _('Code') . '</th> <th>' . _('Description') . '</th> @@ -265,8 +268,8 @@ $Total_ExtCost = 0; $j=1; //row ID $k=0; //row colour counter + while ($myrow = DB_fetch_array($result)){ - // Alternate row color if ($k==1){ echo '<tr class="EvenTableRows">'; @@ -276,8 +279,8 @@ $k++; } - echo '<td><a href="' . $RootPath . '/WorkOrderEntry.php?NewItem=' . $myrow['part'] . '&ReqQty=' . $myrow['supplyquantity'] . '&ReqDate=' . $myrow['duedate'] . '&StartDate=' . $myrow['mrpdate'] . '">' . _('Convert') . '</a></td> - <td>' . '<a href="' . $RootPath . '/SelectProduct.php?StockID=' . $myrow['part'] . '">' . $myrow['part'] . '</a>' . '<input type="hidden" name="' . $j . '_part" value="' . $myrow['part']. '" /></td> + echo '<td><a href="' . $RootPath . '/WorkOrderEntry.php?NewItem=' . urlencode($myrow['part']) . '&ReqQty=' . urlencode($myrow['supplyquantity']) . '&ReqDate=' . urlencode($myrow['duedate']) . '&StartDate=' . urlencode($myrow['mrpdate']) . '">' . _('Convert') . '</a></td> + <td>' . '<a href="' . $RootPath . '/SelectProduct.php?StockID=' . urlencode($myrow['part']) . '">' . $myrow['part'] . '</a>' . '<input type="hidden" name="' . $j . '_part" value="' . $myrow['part']. '" /></td> <td>' . $myrow['description'] . '</td> <td>' . ConvertSQLDate($myrow['mrpdate']) . '</td> <td>' . ConvertSQLDate($myrow['duedate']) . '</td> @@ -288,6 +291,9 @@ if ($_POST['Consolidation']!='None') { echo '<td class="number">' . $myrow['consolidatedcount'] . '</td>'; } + else { + echo '<td></td>'; // Empty cell when Consolidation is None. + } echo '</tr>'; $j++; @@ -297,18 +303,17 @@ // Print out the grand totals echo '<tr> - <td colspan="4" class="number">' . _('Number of Work Orders') .': ' . ($j-1) . '</td> + <td colspan="3" class="number">' . _('Number of Work Orders') .': ' . ($j-1) . '</td> <td colspan="4" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr> - </table>'; - echo '</div> - </form>'; + </table> + </div> + </form>'; echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; include('includes/footer.php'); - } - + } // end Review planned work orders } else { /*The option to print PDF was not hit so display form */ $Title=_('MRP Planned Work Orders Reporting'); @@ -316,35 +321,42 @@ echo '<p class="page_title_text"> <img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $Title . '</p>'; - echo '<br /><br /><form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; - echo '<div>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr> - <td>' . _('Consolidation') . ':</td> - <td><select required="required" name="Consolidation"> - <option selected="selected" value="None">' . _('None') . '</option> - <option value="Weekly">' . _('Weekly') . '</option> - <option value="Monthly">' . _('Monthly') . '</option> - </select></td> - </tr> - <tr> - <td>' . _('Print Option') . ':</td> - <td><select name="Fill"> - <option selected="selected" value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> - <option value="no">' . _('Plain Print') . '</option> - </select></td> - </tr> - <tr> - <td>' . _('Cut Off Date') . ':</td> - <td><input type ="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="cutoffdate" required="required" autofocus="autofocus" size="10" value="' .date($_SESSION['DefaultDateFormat']).'" /></td> - </tr> - </table> - <div class="centre"> - <input type="submit" name="Review" value="' . _('Review') . '" /> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> - </div> - </div> - </form>'; + echo '<br /><br /> + <form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <td>' . _('Consolidation') . ':</td> + <td> + <select required="required" name="Consolidation"> + <option selected="selected" value="None">' . _('None') . '</option> + <option value="Weekly">' . _('Weekly') . '</option> + <option value="Monthly">' . _('Monthly') . '</option> + </select> + </td> + </tr> + <tr> + <td>' . _('Print Option') . ':</td> + <td> + <select name="Fill"> + <option selected="selected" value="yes">' . _('Print With Alternating Highlighted Lines') . '</option> + <option value="no">' . _('Plain Print') . '</option> + </select> + </td> + </tr> + <tr> + <td>' . _('Cut Off Date') . ':</td> + <td> + <input type ="text" required="required" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="cutoffdate" autofocus="autofocus" size="10" value="' . date($_SESSION['DefaultDateFormat']) . '" /> + </td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="Review" value="' . _('Review') . '" /> <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" /> + </div> + </div> + </form>'; include('includes/footer.php'); @@ -370,6 +382,7 @@ $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); $YPos -= $line_height; + if ($consolidation == 'None') { $displayconsolidation = _('None'); } elseif ($consolidation == 'Weekly') { @@ -377,6 +390,7 @@ } else { $displayconsolidation = _('Monthly'); } + $pdf->addTextWrap($Left_Margin,$YPos,65,$FontSize,_('Consolidation').':'); $pdf->addTextWrap(110,$YPos,40,$FontSize,$displayconsolidation); @@ -390,6 +404,7 @@ $pdf->addTextWrap(200,$YPos,60,$FontSize,_('MRP Date'), 'right'); $pdf->addTextWrap(260,$YPos,50,$FontSize,_('Quantity'), 'right'); $pdf->addTextWrap(310,$YPos,60,$FontSize,_('Ext. Cost'), 'right'); + if ($consolidation == 'None') { $pdf->addTextWrap(370,$YPos,80,$FontSize,_('Source Type'), 'right'); $pdf->addTextWrap(450,$YPos,80,$FontSize,_('Source Order'), 'right'); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-05 21:42:09 UTC (rev 7938) +++ trunk/doc/Change.log 2018-02-06 19:49:24 UTC (rev 7939) @@ -1,11 +1,12 @@ webERP Change Log -2/5/18 PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) -2/4/18 PaulT: InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. -2/4/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. -2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) -2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) -2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. +6/2/18 MRPPlannedPurchasekOrders.php, MRPPlannedWorkOrders.php: PaulT: Add missing table cell to work orders to match recent change to planned purchase orders and replace 'where clause joins' with table join in both files. Paul B/PaulT: Apply consistent code formatting between both files. (Some consistency matters reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) +5/2/18 PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) +4/2/18 PaulT: InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. +4/2/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. +4/2/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) +4/2/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) +4/2/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. 2/2/18 PaulT: Dashboard.php: Replace due date handling with existing function. 2/2/18 PaulT: PrintCustTrans.php, PDFTransPageHeader.inc, PrintCustTransPortrait.php, PDFTransPageHeaderPortrait.inc: Add missing stock lot/serial info to landscape output to be consistent with portrait output (reported by HDeriauFF), add Due Date info to invoices (reported by Paul Becker), and (PaulT) add security checks to portrait file, layout improvements, change PDF initialization handling, and more. (A summary of all changes in this commit can be viewed here: http://www.weberp.org/forum/showthread.php?tid=8065&pid=14115#pid14115) 31/1/18 PaulT: Add a 'warning' case to getMsg(), as there is mixed use of 'warn' and 'warning' usage with prnMsg() calls. The 'warning' (before this change) defaults to an 'info' style message. |
From: <tu...@us...> - 2018-02-06 20:23:10
|
Revision: 7940 http://sourceforge.net/p/web-erp/reponame/7940 Author: turbopt Date: 2018-02-06 20:23:07 +0000 (Tue, 06 Feb 2018) Log Message: ----------- geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints. Modified Paths: -------------- trunk/doc/Change.log trunk/geo_displaymap_customers.php trunk/geo_displaymap_suppliers.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-06 19:49:24 UTC (rev 7939) +++ trunk/doc/Change.log 2018-02-06 20:23:07 UTC (rev 7940) @@ -1,5 +1,6 @@ webERP Change Log +6/2/18 geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints. 6/2/18 MRPPlannedPurchasekOrders.php, MRPPlannedWorkOrders.php: PaulT: Add missing table cell to work orders to match recent change to planned purchase orders and replace 'where clause joins' with table join in both files. Paul B/PaulT: Apply consistent code formatting between both files. (Some consistency matters reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 5/2/18 PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) 4/2/18 PaulT: InternalStockRequestInquiry.php: Restore ONE space to previous 7936 commit. Modified: trunk/geo_displaymap_customers.php =================================================================== --- trunk/geo_displaymap_customers.php 2018-02-06 19:49:24 UTC (rev 7939) +++ trunk/geo_displaymap_customers.php 2018-02-06 20:23:07 UTC (rev 7940) @@ -31,13 +31,13 @@ } </style> -<? +<?php echo '<script src="http://' . $Map_Host . '/maps/api/js?key=' . $Api_Key . '&sensor=false"'; -echo ' type="text/javascript"></script>'; -echo ' <script type="text/javascript">'; -echo " //<![CDATA[ "; ?> -?> +echo ' type="text/javascript"></script>';?> +<script type="text/javascript"> +//<![CDATA[ + var customIcons = { 4: { icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png' @@ -49,7 +49,7 @@ function load() { var map = new google.maps.Map(document.getElementById("map"), { -<? echo 'center:new google.maps.LatLng(' . $Center_Lat . ', ' . $Center_Long . '),'; ?> +<?php echo 'center:new google.maps.LatLng(' . $Center_Lat . ', ' . $Center_Long . '),'; ?> zoom: 4, mapTypeId: 'roadmap' }); @@ -111,10 +111,10 @@ <body onload="load()" onunload="GUnload()"> <p> - <? echo '<div class="centre" id="map" style="width: ' . $Map_Width . 'px; height: ' . $Map_Height . 'px"></div>'; ?> + <?php echo '<div class="centre" id="map" style="width: ' . $Map_Width . 'px; height: ' . $Map_Height . 'px"></div>'; ?> </p> </body> -<? +<?php echo '<div class="centre"><a href="' . $RootPath . '/GeocodeSetup.php">' . _('Go to Geocode Setup') . '</a></div></p>'; include ('includes/footer.php'); ?> Modified: trunk/geo_displaymap_suppliers.php =================================================================== --- trunk/geo_displaymap_suppliers.php 2018-02-06 19:49:24 UTC (rev 7939) +++ trunk/geo_displaymap_suppliers.php 2018-02-06 20:23:07 UTC (rev 7940) @@ -31,12 +31,11 @@ } </style> -<? +<?php echo '<script src="http://' . $Map_Host . '/maps/api/js?key=' . $Api_Key . '&sensor=false"'; -echo ' type="text/javascript"></script>'; -echo ' <script type="text/javascript">'; -echo " //<![CDATA[ "; ?> -?> +echo ' type="text/javascript"></script>';?> +<script type="text/javascript"> +//<![CDATA[ var customIcons = { 4: { @@ -49,7 +48,7 @@ function load() { var map = new google.maps.Map(document.getElementById("map"), { - <? echo 'center:new google.maps.LatLng(' . $Center_Lat . ', ' . $Center_Long . '),'; ?> + <?php echo 'center:new google.maps.LatLng(' . $Center_Lat . ', ' . $Center_Long . '),'; ?> zoom: 4, mapTypeId: 'roadmap' }); @@ -111,10 +110,10 @@ <body onload="load()" onunload="GUnload()"> <p> - <? echo '<div class="centre" id="map" style="width: ' . $Map_Width . 'px; height: ' . $Map_Height . 'px"></div>'; ?> + <?php echo '<div class="centre" id="map" style="width: ' . $Map_Width . 'px; height: ' . $Map_Height . 'px"></div>'; ?> </p> </body> -<? +<?php echo '<div class="centre"><a href="' . $RootPath . '/GeocodeSetup.php">' . _('Go to Geocode Setup') . '</a></div></p>'; include ('includes/footer.php'); ?> |
From: <tu...@us...> - 2018-02-07 21:26:17
|
Revision: 7941 http://sourceforge.net/p/web-erp/reponame/7941 Author: turbopt Date: 2018-02-07 21:26:15 +0000 (Wed, 07 Feb 2018) Log Message: ----------- Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) Modified Paths: -------------- trunk/UserSettings.php trunk/doc/Change.log Modified: trunk/UserSettings.php =================================================================== --- trunk/UserSettings.php 2018-02-06 20:23:07 UTC (rev 7940) +++ trunk/UserSettings.php 2018-02-07 21:26:15 UTC (rev 7941) @@ -106,10 +106,6 @@ echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') { - $_POST['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax']; -} - echo '<table class="selection"> <tr> <td>', _('User ID'), ':</td> @@ -120,7 +116,7 @@ <td>', $_SESSION['UsersRealName'], '<input name="RealName" type="hidden" value="', $_SESSION['UsersRealName'], '" /></td></tr> <tr> <td>', _('Maximum Number of Records to Display'), ':</td> - <td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_POST['DisplayRecordsMax'], '" /></td> + <td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_SESSION['DisplayRecordsMax'], '" /></td> </tr>'; // Select language: @@ -253,4 +249,4 @@ </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-06 20:23:07 UTC (rev 7940) +++ trunk/doc/Change.log 2018-02-07 21:26:15 UTC (rev 7941) @@ -1,5 +1,6 @@ webERP Change Log +7/2/18 Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) 6/2/18 geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints. 6/2/18 MRPPlannedPurchasekOrders.php, MRPPlannedWorkOrders.php: PaulT: Add missing table cell to work orders to match recent change to planned purchase orders and replace 'where clause joins' with table join in both files. Paul B/PaulT: Apply consistent code formatting between both files. (Some consistency matters reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 5/2/18 PaulT: SalesGraph.php: Rework previous 7908 implementation that caused graphing to break. (Reported broken in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8071) |
From: <tu...@us...> - 2018-02-08 01:31:16
|
Revision: 7942 http://sourceforge.net/p/web-erp/reponame/7942 Author: turbopt Date: 2018-02-08 01:31:13 +0000 (Thu, 08 Feb 2018) Log Message: ----------- Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) Modified Paths: -------------- trunk/Z_SalesIntegrityCheck.php trunk/doc/Change.log Modified: trunk/Z_SalesIntegrityCheck.php =================================================================== --- trunk/Z_SalesIntegrityCheck.php 2018-02-07 21:26:15 UTC (rev 7941) +++ trunk/Z_SalesIntegrityCheck.php 2018-02-08 01:31:13 UTC (rev 7942) @@ -142,7 +142,7 @@ echo ', <div style="color:red">' . _('Has no Sales Order') . '</div>'; } - $sumsql = "SELECT SUM( qtyinvoiced * unitprice ) AS InvoiceTotal + $sumsql = "SELECT ROUND(SUM(qtyinvoiced * unitprice * (1 - discountpercent)), 3) AS InvoiceTotal FROM salesorderdetails WHERE orderno = '" . $myrow['orderno'] . "'"; $sumresult = DB_query($sumsql); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-07 21:26:15 UTC (rev 7941) +++ trunk/doc/Change.log 2018-02-08 01:31:13 UTC (rev 7942) @@ -1,5 +1,6 @@ webERP Change Log +7/2/18 Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) 7/2/18 Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) 6/2/18 geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints. 6/2/18 MRPPlannedPurchasekOrders.php, MRPPlannedWorkOrders.php: PaulT: Add missing table cell to work orders to match recent change to planned purchase orders and replace 'where clause joins' with table join in both files. Paul B/PaulT: Apply consistent code formatting between both files. (Some consistency matters reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) |
From: <tu...@us...> - 2018-02-09 05:30:42
|
Revision: 7943 http://sourceforge.net/p/web-erp/reponame/7943 Author: turbopt Date: 2018-02-09 05:30:40 +0000 (Fri, 09 Feb 2018) Log Message: ----------- Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-08 01:31:13 UTC (rev 7942) +++ trunk/doc/Change.log 2018-02-09 05:30:40 UTC (rev 7943) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit. 7/2/18 Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) 7/2/18 Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) 6/2/18 geo_displaymap_customers.php, geo_displaymap_suppliers.php: Fix a few PHP short-tags, and move some javascript from PHP output to fix 'missing tag' validation complaints. Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2018-02-08 01:31:13 UTC (rev 7942) +++ trunk/includes/ConnectDB_mysql.inc 2018-02-09 05:30:40 UTC (rev 7943) @@ -209,4 +209,16 @@ mysql_query('SET FOREIGN_KEY_CHECKS=1',$db); } +function DB_table_exists($TableName) { + global $db; + + $SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'"; + $Result = DB_query($SQL); + + if (DB_num_rows($Result) > 0) { + return True; + } else { + return False; + } +} ?> \ No newline at end of file Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2018-02-08 01:31:13 UTC (rev 7942) +++ trunk/includes/ConnectDB_mysqli.inc 2018-02-09 05:30:40 UTC (rev 7943) @@ -224,4 +224,17 @@ global $db; mysqli_query($db, 'SET FOREIGN_KEY_CHECKS=1'); } + +function DB_table_exists($TableName) { + global $db; + + $SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'"; + $Result = DB_query($SQL); + + if (DB_num_rows($Result) > 0) { + return True; + } else { + return False; + } +} ?> \ No newline at end of file Modified: trunk/includes/ConnectDB_postgres.inc =================================================================== --- trunk/includes/ConnectDB_postgres.inc 2018-02-08 01:31:13 UTC (rev 7942) +++ trunk/includes/ConnectDB_postgres.inc 2018-02-09 05:30:40 UTC (rev 7943) @@ -149,4 +149,16 @@ WHERE confname = 'DB_Maintenance_LastRun'"); } +function DB_table_exists($TableName) { + global $db; + + $SQL = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = '" . $TableName . "'"; + $Result = DB_query($SQL); + + if (DB_num_rows($Result) > 0) { + return True; + } else { + return False; + } +} ?> \ No newline at end of file |
From: <tu...@us...> - 2018-02-09 19:48:24
|
Revision: 7945 http://sourceforge.net/p/web-erp/reponame/7945 Author: turbopt Date: 2018-02-09 19:48:22 +0000 (Fri, 09 Feb 2018) Log Message: ----------- Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939. Modified Paths: -------------- trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/doc/Change.log Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2018-02-09 18:22:45 UTC (rev 7944) +++ trunk/MRPPlannedPurchaseOrders.php 2018-02-09 19:48:22 UTC (rev 7945) @@ -5,10 +5,7 @@ include('includes/session.php'); -$sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; -$result=DB_query($sql); - -if (DB_num_rows($result)==0) { +if ( !DB_table_exists('mrprequirements') ) { $Title=_('MRP error'); include('includes/header.php'); echo '<br />'; @@ -291,9 +288,11 @@ <th>' . _('Due Date') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit Cost') . '</th> - <th>' . _('Ext. Cost') . '</th> - <th>' . _('Consolidations') . '</th> - </tr>'; + <th>' . _('Ext. Cost') . '</th>'; + if ($_POST['Consolidation']!='None') { + echo '<th>' . _('Consolidations') . '</th>'; + } + echo '</tr>'; $TotalPartQty = 0; $TotalPartCost = 0; @@ -317,9 +316,6 @@ if ($_POST['Consolidation']!='None') { echo '<td class="number">' . $myrow['consolidatedcount'] . '</td>'; } - else { - echo '<td></td>'; // Empty cell when Consolidation is None. - } echo '</tr>'; $j++; @@ -330,13 +326,13 @@ // Print out the grand totals echo '<tr> <td colspan="3" class="number">' . _('Number of Purchase Orders') .': ' . ($j-1) . '</td> - <td colspan="4" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td colspan="5" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr> </table> </div> </form>'; - echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; + echo '<br /><a class="noprint" href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '">', _('Select different criteria.'), '</a>'; include('includes/footer.php'); } // end Review planned purchase orders @@ -477,7 +473,7 @@ return $PartInfo; } else { - return array('','','',''); + return array('','','',1); } } Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2018-02-09 18:22:45 UTC (rev 7944) +++ trunk/MRPPlannedWorkOrders.php 2018-02-09 19:48:22 UTC (rev 7945) @@ -5,10 +5,7 @@ include('includes/session.php'); -$sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; -$result=DB_query($sql); - -if (DB_num_rows($result)==0) { +if ( !DB_table_exists('mrprequirements') ) { $Title=_('MRP error'); include('includes/header.php'); echo '<br />'; @@ -259,9 +256,11 @@ <th>' . _('Due Date') . '</th> <th>' . _('Quantity') . '</th> <th>' . _('Unit Cost') . '</th> - <th>' . _('Ext. Cost') . '</th> - <th>' . _('Consolidations') . '</th> - </tr>'; + <th>' . _('Ext. Cost') . '</th>'; + if ($_POST['Consolidation'] != 'None') { + echo '<th>' . _('Consolidations') . '</th>'; + } + echo '</tr>'; $TotalPartQty = 0; $TotalPartCost = 0; @@ -280,12 +279,9 @@ <td class="number">' . locale_number_format($myrow['computedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format($myrow['supplyquantity'] * $myrow['computedcost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; - if ($_POST['Consolidation']!='None') { + if ($_POST['Consolidation'] != 'None') { echo '<td class="number">' . $myrow['consolidatedcount'] . '</td>'; } - else { - echo '<td></td>'; // Empty cell when Consolidation is None. - } echo '</tr>'; $j++; @@ -296,13 +292,13 @@ // Print out the grand totals echo '<tr> <td colspan="3" class="number">' . _('Number of Work Orders') .': ' . ($j-1) . '</td> - <td colspan="4" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td colspan="5" class="number">' . _('Total Extended Cost') . ': ' . locale_number_format($Total_ExtCost,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr> </table> </div> </form>'; - echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; + echo '<br /><a class="noprint" href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '">', _('Select different criteria.'), '</a>'; include('includes/footer.php'); } // end Review planned work orders Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-09 18:22:45 UTC (rev 7944) +++ trunk/doc/Change.log 2018-02-09 19:48:22 UTC (rev 7945) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939. 9/2/18 PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later. 9/2/18 Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit. 7/2/18 Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) |
From: <tu...@us...> - 2018-02-10 00:05:34
|
Revision: 7946 http://sourceforge.net/p/web-erp/reponame/7946 Author: turbopt Date: 2018-02-10 00:05:31 +0000 (Sat, 10 Feb 2018) Log Message: ----------- Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086) Modified Paths: -------------- trunk/InternalStockRequestFulfill.php trunk/doc/Change.log Modified: trunk/InternalStockRequestFulfill.php =================================================================== --- trunk/InternalStockRequestFulfill.php 2018-02-09 19:48:22 UTC (rev 7945) +++ trunk/InternalStockRequestFulfill.php 2018-02-10 00:05:31 UTC (rev 7946) @@ -24,6 +24,8 @@ $Department = $_POST[$RequestID.'Department'.$LineID]; $Tag = $_POST[$RequestID.'Tag'.$LineID]; $RequestedQuantity = filter_number_format($_POST[$RequestID.'RequestedQuantity'.$LineID]); + $Controlled = $_POST[$RequestID.'Controlled'.$LineID]; + $SerialNo = $_POST[$RequestID.'Ser'.$LineID]; if (isset($_POST[$RequestID.'Completed'.$LineID])) { $Completed=True; } else { @@ -93,6 +95,36 @@ /*Get the ID of the StockMove... */ $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); + + if ($Controlled == 1) { + /*We need to add the StockSerialItem record and the StockSerialMoves as well */ + + $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Quantity . " + WHERE stockid='" . $StockID . "' + AND loccode='" . $Location . "' + AND serialno='" . $SerialNo . "'"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); + $DbgMsg = _('The following SQL to update the serial stock item record was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + + /* now insert the serial stock movement */ + + $SQL = "INSERT INTO stockserialmoves (stockmoveno, + stockid, + serialno, + moveqty) + VALUES ('" . $StkMoveNo . "', + '" . $StockID . "', + '" . $SerialNo . "', + '" . -$Quantity . "')"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); + $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + } /*end if the orderline is a controlled item */ + + $SQL="UPDATE stockrequestitems SET qtydelivered=qtydelivered+" . $Quantity . " WHERE dispatchid='" . $RequestID . "' @@ -296,7 +328,7 @@ <td>' . $myrow['dispatchid'] . '</td> <td>' . $myrow['description'] . '</td> <td>' . $myrow['locationname'] . '</td> - <td>' . ConvertSQLDate($myrow['despatchdate']) . '</td> + <td class="centre">' . ConvertSQLDate($myrow['despatchdate']) . '</td> <td>' . $myrow['narrative'] . '</td> </tr>'; $LineSQL="SELECT stockrequestitems.dispatchitemsid, @@ -306,7 +338,8 @@ stockrequestitems.uom, stockmaster.description, stockrequestitems.quantity, - stockrequestitems.qtydelivered + stockrequestitems.qtydelivered, + stockmaster.controlled FROM stockrequestitems LEFT JOIN stockmaster ON stockmaster.stockid=stockrequestitems.stockid @@ -323,6 +356,7 @@ <th>' . _('Quantity') . '<br />' . _('Required') . '</th> <th>' . _('Quantity') . '<br />' . _('Delivered') . '</th> <th>' . _('Units') . '</th> + <th>' . _('Lot/Batch/Serial') . '</th> <th>' . _('Completed') . '</th> <th>' . _('Tag') . '</th> </tr>'; @@ -331,9 +365,14 @@ echo '<tr> <td>' . $LineRow['description'] . '</td> <td class="number">' . locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']) . '</td> - <td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Qty'. $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" /></td> - <td>' . $LineRow['uom'] . '</td> - <td><input type="checkbox" name="'. $LineRow['dispatchid'] . 'Completed'. $LineRow['dispatchitemsid'] . '" /></td> + <td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Qty' . $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" /></td> + <td>' . $LineRow['uom'] . '</td>'; + if ($LineRow['controlled'] == 1) { + echo '<td class="number"><input type="text" class="number" name="'. $LineRow['dispatchid'] . 'Ser' . $LineRow['dispatchitemsid'] .'" /></td>'; + } else { + echo '<td>' . _('Stock item is not controlled') . '</td>'; + } + echo '<td class="centre"><input type="checkbox" name="'. $LineRow['dispatchid'] . 'Completed'. $LineRow['dispatchitemsid'] . '" /></td> <td><select name="'. $LineRow['dispatchid'] . 'Tag'. $LineRow['dispatchitemsid'] . '">'; $SQL = "SELECT tagref, @@ -357,6 +396,7 @@ echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Location'. $LineRow['dispatchitemsid'] . '" value="'.$_POST['Location'].'" />'; echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'RequestedQuantity'. $LineRow['dispatchitemsid'] . '" value="'.locale_number_format($LineRow['quantity']-$LineRow['qtydelivered'],$LineRow['decimalplaces']).'" />'; echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Department'. $LineRow['dispatchitemsid'] . '" value="'.$myrow['description'].'" />'; + echo '<input type="hidden" class="number" name="'. $LineRow['dispatchid'] . 'Controlled'. $LineRow['dispatchitemsid'] . '" value="'.$LineRow['controlled'].'" />'; } // end while order line detail echo '</table></td></tr>'; } //end while header loop Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-09 19:48:22 UTC (rev 7945) +++ trunk/doc/Change.log 2018-02-10 00:05:31 UTC (rev 7946) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086) 9/2/18 Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939. 9/2/18 PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later. 9/2/18 Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit. |
From: <tu...@us...> - 2018-02-10 00:49:33
|
Revision: 7947 http://sourceforge.net/p/web-erp/reponame/7947 Author: turbopt Date: 2018-02-10 00:49:30 +0000 (Sat, 10 Feb 2018) Log Message: ----------- Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) Modified Paths: -------------- trunk/StockLocMovements.php trunk/StockMovements.php trunk/doc/Change.log Modified: trunk/StockLocMovements.php =================================================================== --- trunk/StockLocMovements.php 2018-02-10 00:05:31 UTC (rev 7946) +++ trunk/StockLocMovements.php 2018-02-10 00:49:30 UTC (rev 7947) @@ -71,10 +71,12 @@ stockmoves.price, stockmoves.discountpercent, stockmoves.newqoh, - stockmaster.decimalplaces + stockmaster.decimalplaces, + stockserialmoves.serialno FROM stockmoves INNER JOIN systypes ON stockmoves.type=systypes.typeid INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN stockserialmoves ON stockmoves.stkmoveno=stockserialmoves.stockmoveno WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' AND stockmoves.trandate >= '". $SQLAfterDate . "' AND stockmoves.trandate <= '" . $SQLBeforeDate . "' @@ -96,7 +98,8 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Quantity on Hand') . '</th> - </tr>'; + <th>' . _('Serial No.') . '</th> + </tr>'; echo $tableheader; $j = 1; @@ -116,6 +119,7 @@ <td class="number">%s</td> <td class="number">%s</td> <td class="number">%s</td> + <td class="number">%s</td> </tr>', mb_strtoupper($myrow['stockid']), mb_strtoupper($myrow['stockid']), @@ -128,7 +132,8 @@ $myrow['reference'], locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), + $myrow['serialno']); $j++; If ($j == 16){ $j=1; Modified: trunk/StockMovements.php =================================================================== --- trunk/StockMovements.php 2018-02-10 00:05:31 UTC (rev 7946) +++ trunk/StockMovements.php 2018-02-10 00:49:30 UTC (rev 7947) @@ -33,7 +33,7 @@ } echo '<br /> <table class="selection">'; -echo '<tr><th colspan="10">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; +echo '<tr><th colspan="12">' . _('Stock Code') . ':<input type="text" name="StockID" size="21" value="' . $StockID . '" maxlength="20" />'; echo ' ' . _('From Stock Location') . ':<select name="StockLocation"> '; @@ -64,7 +64,7 @@ echo '</select></th> </tr>'; echo '<tr> - <th colspan="10">' . _('Show Movements between') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /> ' . _('and') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> + <th colspan="12">' . _('Show Movements between') . ': <input type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['AfterDate'] . '" /> ' . _('and') . ': <input type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="12" value="' . $_POST['BeforeDate'] . '" /><input type="submit" name="ShowMoves" value="' . _('Show Stock Movements') . '" /></th> </tr>'; $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); @@ -83,10 +83,12 @@ stockmoves.price, stockmoves.discountpercent, stockmoves.newqoh, - stockmaster.decimalplaces + stockmaster.decimalplaces, + stockserialmoves.serialno FROM stockmoves INNER JOIN systypes ON stockmoves.type=systypes.typeid INNER JOIN stockmaster ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN stockserialmoves ON stockmoves.stkmoveno=stockserialmoves.stockmoveno WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "' AND stockmoves.trandate >= '". $SQLAfterDate . "' AND stockmoves.stockid = '" . $StockID . "' @@ -111,6 +113,7 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('New Qty') . '</th> + <th>' . _('Serial No.') . '</th> </tr>'; echo $tableheader; @@ -135,6 +138,7 @@ <td class="number">%s</td> <td class="number">%s%%</td> <td class="number">%s</td> + <td class="number">%s</td> </tr>', $RootPath, $myrow['transno'], @@ -148,7 +152,8 @@ $myrow['reference'], locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), + $myrow['serialno']); } elseif ($myrow['type']==11){ @@ -164,6 +169,7 @@ <td class="number">%s</td> <td class="number">%s%%</td> <td class="number">%s</td> + <td class="number">%s</td> </tr>', $RootPath, $myrow['transno'], @@ -177,7 +183,8 @@ $myrow['reference'], locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), + $myrow['serialno']); } else { printf('<tr class="striped_row"> @@ -192,6 +199,7 @@ <td class="number">%s</td> <td class="number">%s%%</td> <td class="number">%s</td> + <td class="number">%s</td> </tr>', $myrow['typename'], $myrow['transno'], @@ -203,7 +211,8 @@ $myrow['reference'], locale_number_format($myrow['price'],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($myrow['discountpercent']*100,2), - locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); + locale_number_format($myrow['newqoh'],$myrow['decimalplaces']), + $myrow['serialno']); } //end of page full new headings if } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-10 00:05:31 UTC (rev 7946) +++ trunk/doc/Change.log 2018-02-10 00:49:30 UTC (rev 7947) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) 9/2/18 Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086) 9/2/18 Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939. 9/2/18 PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later. |
From: <tu...@us...> - 2018-02-10 01:46:03
|
Revision: 7948 http://sourceforge.net/p/web-erp/reponame/7948 Author: turbopt Date: 2018-02-10 01:46:00 +0000 (Sat, 10 Feb 2018) Log Message: ----------- PaulT: Remove the last of the remaining URL 'SID' references. Modified Paths: -------------- trunk/FixedAssetRegister.php trunk/FormDesigner.php trunk/MRPReschedules.php trunk/SuppShiptChgs.php trunk/SupplierCredit.php trunk/Z_DataExport.php trunk/Z_ImportGLAccountGroups.php trunk/Z_ImportGLAccountSections.php trunk/Z_ImportPartCodes.php trunk/Z_MakeNewCompany.php trunk/Z_ReApplyCostToSA.php trunk/Z_RemovePurchaseBackOrders.php trunk/Z_Upgrade3.10.php trunk/Z_Upgrade_3.04-3.05.php trunk/Z_Upgrade_3.05-3.06.php trunk/Z_Upgrade_3.07-3.08.php trunk/Z_Upgrade_3.08-3.09.php trunk/Z_Upgrade_3.09-3.10.php trunk/Z_Upgrade_3.10-3.11.php trunk/Z_Upgrade_3.11-4.00.php trunk/Z_poAddLanguage.php trunk/Z_poAdmin.php trunk/Z_poEditLangHeader.php trunk/Z_poEditLangRemaining.php trunk/Z_poRebuildDefault.php trunk/doc/Change.log Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/FixedAssetRegister.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -76,7 +76,7 @@ } elseif (isset($_POST['csv'])) { $csv_output = "'Asset ID','Description','Serial Number','Location','Date Acquired','Cost B/Fwd','Period Additions','Depn B/Fwd','Period Depreciation','Cost C/Fwd', 'Accum Depn C/Fwd','NBV','Disposal Value'\n"; } else { - echo '<form id="RegisterForm" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '"> + echo '<form id="RegisterForm" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '"> <div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<div class="centre">' ._('From') . ':' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate'] . '</div>'; Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/FormDesigner.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -147,25 +147,25 @@ $FormDesign->asXML(sys_get_temp_dir().'/'.$_POST['FormName']); switch ($_POST['FormName']) { case 'PurchaseOrder.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PO_PDFPurchOrder.php?' . SID .'OrderNo=Preview">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PO_PDFPurchOrder.php?OrderNo=Preview">'; break; case 'GoodsReceived.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFGrn.php?GRNNo=Preview&PONo=1">'; break; case 'PickingList.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFPickingList.php?' . SID .'TransNo=Preview">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFPickingList.php?TransNo=Preview">'; break; case 'QALabel.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFQALabel.php?' . SID .'GRNNo=Preview&PONo=1">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFQALabel.php?GRNNo=Preview&PONo=1">'; break; case 'WOPaperwork.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFWOPrint.php?' . SID .'WO=Preview">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFWOPrint.php?WO=Preview">'; break; case 'FGLabel.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFFGLabel.php?' . SID .'WO=Preview">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFFGLabel.php?WO=Preview">'; break; case 'ShippingLabel.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFShipLabel.php?' . SID .'ORD=Preview">'; + echo '<meta http-equiv="Refresh" content="0; url=' . $RootPath . '/PDFShipLabel.php?ORD=Preview">'; break; } } else { @@ -183,7 +183,7 @@ * drop down list of possible forms */ if (empty($_POST['FormName'])) { echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p><br />'; - echo '<form method="post" id="ChooseForm" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '">'; + echo '<form method="post" id="ChooseForm" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr>'; @@ -219,7 +219,7 @@ _('All coordinates are measured from the lower left corner of the sheet to the top left corner of the element.') . '</div><br />'; $Papers=array('A4_Landscape', 'A4_Portrait', 'A5_Landscape', 'A5_Portrait', 'A6_Landscape', 'A3_Landscape', 'A3_Portrait', 'Letter_Portrait', 'Letter_Landscape', 'Legal_Portrait', 'Legal_Landscape'); // Possible paper sizes/orientations -echo '<form method="post" id="Form" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '">'; +echo '<form method="post" id="Form" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input name="FormName" type="hidden" value="'.$_POST['FormName'].'" />'; Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/MRPReschedules.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -12,7 +12,7 @@ include('includes/header.php'); echo '<br />'; prnMsg( _('The MRP calculation must be run before you can run this report') . '<br />' . - _('To run the MRP calculation click').' ' . '<a href='.$RootPath .'/MRP.php?' . SID .'>' . _('here') . '</a>', 'error'); + _('To run the MRP calculation click').' ' . '<a href="'.$RootPath .'/MRP.php">' . _('here') . '</a>', 'error'); include('includes/footer.php'); exit; } @@ -55,7 +55,7 @@ $Title = _('MRP Reschedules') . ' - ' . _('Problem Report'); include('includes/header.php'); prnMsg( _('No MRP reschedule retrieved'), 'warn'); - echo '<br /><a href="' .$RootPath .'/index.php?' . SID . '">' . _('Back to the menu') . '</a>'; + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu') . '</a>'; if ($debug==1){ echo '<br />' . $sql; } Modified: trunk/SuppShiptChgs.php =================================================================== --- trunk/SuppShiptChgs.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/SuppShiptChgs.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -87,7 +87,7 @@ echo '<tr><td>' . $EnteredShiptRef->ShiptRef . '</td> <td class="number">' . locale_number_format($EnteredShiptRef->Amount,2) . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '&Delete=' . $EnteredShiptRef->Counter . '">' . _('Delete') . '</a></td></tr>'; + <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $EnteredShiptRef->Counter . '">' . _('Delete') . '</a></td></tr>'; $TotalShiptValue = $TotalShiptValue + $EnteredShiptRef->Amount; Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/SupplierCredit.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -30,9 +30,6 @@ include('includes/header.php'); include('includes/SQL_CommonFunctions.inc'); -//this is available from the menu on this page already -//echo "<a href='" . $RootPath . '/SelectSupplier.php?' . SID . "'>" . _('Back to Suppliers') . '</a><br />'; - if (isset($_GET['New'])) { unset($_SESSION['SuppTrans']); } Modified: trunk/Z_DataExport.php =================================================================== --- trunk/Z_DataExport.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_DataExport.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -69,7 +69,7 @@ $Title = _('Price List Export Problem ....'); include('includes/header.php'); prnMsg( _('The Price List could not be retrieved by the SQL because'). ' - ' . DB_error_msg(), 'error'); - echo '<br /><a href="' .$RootPath .'/index.php?' . SID . '">' . _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />' . $SQL; } @@ -344,7 +344,7 @@ $Title = _('Security Token List Export Problem ....'); include('includes/header.php'); prnMsg( _('The Security Token List could not be retrieved by the SQL because'). ' - ' . DB_error_msg(), 'error'); - echo '<br /><a href="' .$RootPath .'/index.php?' . SID . '">' . _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />' . $SQL; } @@ -416,7 +416,7 @@ $Title = _('Security Group List Export Problem ....'); include('includes/header.php'); prnMsg( _('The Security Group List could not be retrieved by the SQL because'). ' - ' . DB_error_msg(), 'error'); - echo '<br /><a href="' .$RootPath .'/index.php?' . SID . '">' . _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />' . $SQL; } Modified: trunk/Z_ImportGLAccountGroups.php =================================================================== --- trunk/Z_ImportGLAccountGroups.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_ImportGLAccountGroups.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -66,7 +66,7 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>' . _('File to import') . '</td>' . Modified: trunk/Z_ImportGLAccountSections.php =================================================================== --- trunk/Z_ImportGLAccountSections.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_ImportGLAccountSections.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -70,7 +70,7 @@ prnMsg( _('Select a csv file containing the details of the account sections that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=accountsection">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>' . _('File to import') . '</td>' . Modified: trunk/Z_ImportPartCodes.php =================================================================== --- trunk/Z_ImportPartCodes.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_ImportPartCodes.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -77,7 +77,7 @@ prnMsg( _('Select a csv file containing the details of the parts that you wish to import into webERP. '). '<br />' . _('The first line must contain the field names that you wish to import. '). '<a href ="Z_DescribeTable.php?table=stockmaster">' . _('The field names can be found here'). '</a>', 'info'); - echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' .SID .'">'; + echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><td>' . _('File to import') . '</td>' . Modified: trunk/Z_MakeNewCompany.php =================================================================== --- trunk/Z_MakeNewCompany.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_MakeNewCompany.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -9,7 +9,7 @@ if (isset($_POST['EnterCompanyDetails'])) { - header ('Location:' . $RootPath . '/CompanyPreferences.php?' . SID); + header ('Location:' . $RootPath . '/CompanyPreferences.php'); exit; } $Title = _('Make New Company Database Utility'); @@ -31,7 +31,7 @@ prnMsg(_('Company database must not contain spaces, \& or " or \''),'error'); } else { $_POST['NewDatabase'] = strtolower($_POST['NewDatabase']); - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '">'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /* check for directory existence */ @@ -229,7 +229,7 @@ prnMsg (_('This utility will create a new company') . '<br /><br />' . _('If the company name already exists then you cannot recreate it'), 'info', _('PLEASE NOTE')); echo '<br /></div>'; -echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '" enctype="multipart/form-data">'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" enctype="multipart/form-data">'; echo '<div class="centre">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/Z_ReApplyCostToSA.php =================================================================== --- trunk/Z_ReApplyCostToSA.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_ReApplyCostToSA.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -8,7 +8,7 @@ $Period = 42; -echo "<form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/Z_RemovePurchaseBackOrders.php =================================================================== --- trunk/Z_RemovePurchaseBackOrders.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_RemovePurchaseBackOrders.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -6,7 +6,7 @@ $Title=_('Remove Purchase Order Back Orders'); include('includes/header.php'); -echo "<form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> Modified: trunk/Z_Upgrade3.10.php =================================================================== --- trunk/Z_Upgrade3.10.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade3.10.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -9,7 +9,7 @@ prnMsg(_('This script will perform any modifications to the database since v 3.10 required to allow the additional functionality in version 3.10 scripts'),'info'); if (!isset($_POST['DoUpgrade'])) { - echo "<br /><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; + echo '<br /><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<div class="centre"><input type="submit" name=DoUpgrade value="' . _('Perform Upgrade') . '" /></div>'; echo '</form>'; Modified: trunk/Z_Upgrade_3.04-3.05.php =================================================================== --- trunk/Z_Upgrade_3.04-3.05.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.04-3.05.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -9,8 +9,8 @@ prnMsg(_('This script will run perform any modifications to the database required to allow the additional functionality in version 3.05 scripts'),'info'); -echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" />'; echo '</form>'; Modified: trunk/Z_Upgrade_3.05-3.06.php =================================================================== --- trunk/Z_Upgrade_3.05-3.06.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.05-3.06.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -8,7 +8,7 @@ prnMsg(_('This script will run perform any modifications to the database since v 3.06 required to allow the additional functionality in version 3.07 scripts'),'info'); -echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" />'; echo '</form>'; Modified: trunk/Z_Upgrade_3.07-3.08.php =================================================================== --- trunk/Z_Upgrade_3.07-3.08.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.07-3.08.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -8,7 +8,7 @@ prnMsg(_('This script will run perform any modifications to the database since v 3.071 required to allow the additional functionality in version 3.08 scripts'),'info'); -echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" />'; echo '</form>'; Modified: trunk/Z_Upgrade_3.08-3.09.php =================================================================== --- trunk/Z_Upgrade_3.08-3.09.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.08-3.09.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -8,8 +8,8 @@ prnMsg(_('This script will run perform any modifications to the database since v 3.08 required to allow the additional functionality in version 3.09 scripts'),'info'); -echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" />'; echo '</form>'; Modified: trunk/Z_Upgrade_3.09-3.10.php =================================================================== --- trunk/Z_Upgrade_3.09-3.10.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.09-3.10.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -8,8 +8,8 @@ prnMsg(_('This script will run perform any modifications to the database since v 3.09 required to allow the additional functionality in version 3.09 scripts'),'info'); -echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" />'; echo '</form>'; Modified: trunk/Z_Upgrade_3.10-3.11.php =================================================================== --- trunk/Z_Upgrade_3.10-3.11.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.10-3.11.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -9,7 +9,7 @@ if (empty($_POST['DoUpgrade'])){ prnMsg(_('This script will run perform any modifications to the database since v 3.10 required to allow the additional functionality in version 3.11 scripts'),'info'); - echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; + echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<div class="centre"?><input type="submit" name=DoUpgrade value="' . _('Perform Upgrade') . '" /></div>'; echo '</form>'; Modified: trunk/Z_Upgrade_3.11-4.00.php =================================================================== --- trunk/Z_Upgrade_3.11-4.00.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_Upgrade_3.11-4.00.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -9,7 +9,7 @@ if (empty($_POST['DoUpgrade'])){ prnMsg(_('This script will run perform any modifications to the database since v 3.11 required to allow the additional functionality in version 4.00 scripts'),'info'); - echo "<p><form method='post' action='" . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . "'>"; + echo '<p><form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<div class="centre"?><input type="submit" name="DoUpgrade" value="' . _('Perform Upgrade') . '" /></div>'; echo '</form>'; Modified: trunk/Z_poAddLanguage.php =================================================================== --- trunk/Z_poAddLanguage.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_poAddLanguage.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -12,7 +12,7 @@ if (isset($_POST['cancel'])) { - header ('Location:' . $RootPath . '/Z_poAdmin.php?' . SID); + header ('Location:' . $RootPath . '/Z_poAdmin.php'); exit; } @@ -50,7 +50,7 @@ echo '<div class="centre">'; echo '<br />'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -87,7 +87,7 @@ prnMsg (_('This utility will create a new language and a new language translation file for it from the system default') . '<br /><br />' . _('If the language already exists then you cannot recreate it'), 'info', _('PLEASE NOTE')); echo '<br /></div>'; -echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; +echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr>'; Modified: trunk/Z_poAdmin.php =================================================================== --- trunk/Z_poAdmin.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_poAdmin.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -25,13 +25,13 @@ if (!is_writable('./locale/' . $_SESSION['Language'])) { prnMsg(_('You do not have write access to the required files please contact your system administrator'),'error'); } else { - echo '<p><a href="' . $RootPath . '/Z_poRebuildDefault.php?' . SID . '">' . _('Rebuild the System Default Language File') . '</a>'; - echo '<p><a href="' . $RootPath . '/Z_poAddLanguage.php?' . SID . '">' . _('Add a New Language to the System') . '</a>'; - echo '<p><a href="' . $RootPath . '/Z_poEditLangHeader.php?' . SID . '">' . _('Edit a Language File Header') . '</a>'; - echo '<p><a href="' . $RootPath . '/Z_poEditLangModule.php?' . SID . '">' . _('Edit a Language File Module') . '</a>'; - echo '<p><a href="' . $RootPath . '/Z_poEditLangRemaining.php?' . SID . '">' . _('Edit Remaining Strings For This Language') . '</a>'; - echo '<p><a href="' . $RootPath . '/locale/'.$_SESSION['Language'].'/LC_MESSAGES/messages.po' . SID . '">' . _('Download messages.po file') . '</a>'; - echo '<p><a href="' . $RootPath . '/locale/'.$_SESSION['Language'].'/LC_MESSAGES/messages.mo' . SID . '">' . _('Download messages.mo file') . '</a>'; + echo '<p><a href="' . $RootPath . '/Z_poRebuildDefault.php">' . _('Rebuild the System Default Language File') . '</a>'; + echo '<p><a href="' . $RootPath . '/Z_poAddLanguage.php">' . _('Add a New Language to the System') . '</a>'; + echo '<p><a href="' . $RootPath . '/Z_poEditLangHeader.php">' . _('Edit a Language File Header') . '</a>'; + echo '<p><a href="' . $RootPath . '/Z_poEditLangModule.php">' . _('Edit a Language File Module') . '</a>'; + echo '<p><a href="' . $RootPath . '/Z_poEditLangRemaining.php">' . _('Edit Remaining Strings For This Language') . '</a>'; + echo '<p><a href="' . $RootPath . '/locale/'.$_SESSION['Language'].'/LC_MESSAGES/messages.po">' . _('Download messages.po file') . '</a>'; + echo '<p><a href="' . $RootPath . '/locale/'.$_SESSION['Language'].'/LC_MESSAGES/messages.mo">' . _('Download messages.mo file') . '</a>'; } include('includes/footer.php'); Modified: trunk/Z_poEditLangHeader.php =================================================================== --- trunk/Z_poEditLangHeader.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_poEditLangHeader.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -33,7 +33,7 @@ if (isset($_POST['submit'])) { echo '<br /><table><tr><td>'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /* write the new header then the rest of the language file to a new file */ @@ -90,7 +90,7 @@ prnMsg (_('Your existing translation file (messages.po) will be backed up as messages.po.old') . '<br /><br />' . _('Make sure you know what you are doing BEFORE you edit the header'), 'info', _('PLEASE NOTE')); echo '<br /></div>'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table><tr><th" colspan="2" ALIGN="center">' . _('Language File Header for') . ' "' . $_POST['language'] . '"</th></tr>'; Modified: trunk/Z_poEditLangRemaining.php =================================================================== --- trunk/Z_poEditLangRemaining.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_poEditLangRemaining.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -38,7 +38,7 @@ // save the modifications echo '<br /><table><tr><td>'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /* write the new language file */ @@ -105,7 +105,7 @@ prnMsg (_('Your existing translation file (messages.po) will be saved as messages.po.old') . '<br />', 'info', _('PLEASE NOTE')); echo '<br />'; echo '</div>'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table>'; Modified: trunk/Z_poRebuildDefault.php =================================================================== --- trunk/Z_poRebuildDefault.php 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/Z_poRebuildDefault.php 2018-02-10 01:46:00 UTC (rev 7948) @@ -32,7 +32,7 @@ if (isset($_POST['submit'])) { echo '<br /><table><tr><td>'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; prnMsg (_('Rebuilding the default language file ') . '.....<br />', 'info', ' '); $Result = rename($PathToDefault, $PathToDefault . '.old');// Renames pot file to bak. @@ -51,7 +51,7 @@ _('This is not usually necessary but if done before a new language is created then that language will have any new or recently modified strings') . '.<br />' . _('Existing languages are not affected.') . '.', 'info', _('PLEASE NOTE')); echo '<br />'; - echo '<form method="post" action=' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' . SID . '>'; + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<input type="submit" name="submit" value="' . _('Proceed') . '" /> '; echo '</form>'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-10 00:49:30 UTC (rev 7947) +++ trunk/doc/Change.log 2018-02-10 01:46:00 UTC (rev 7948) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 PaulT: Remove the last of the remaining URL 'SID' references. 9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) 9/2/18 Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086) 9/2/18 Tim/PaulT: MRPPlannedPurchaseOrders.php, MRPPlannedWorkOrders.php: Fix conversion factor matter noted by Tim, use DB_table_exists() from commit 7943 to replace table check query, and minor rework to 'missing cell' handling from commit 7939. |
From: <tu...@us...> - 2018-02-10 02:36:30
|
Revision: 7949 http://sourceforge.net/p/web-erp/reponame/7949 Author: turbopt Date: 2018-02-10 02:36:28 +0000 (Sat, 10 Feb 2018) Log Message: ----------- PaulT: MRPReschedules.php, MRPShortages.php: Use DB_table_exists() from commit 7943 to replace table check query. Modified Paths: -------------- trunk/MRPReschedules.php trunk/MRPShortages.php trunk/doc/Change.log Modified: trunk/MRPReschedules.php =================================================================== --- trunk/MRPReschedules.php 2018-02-10 01:46:00 UTC (rev 7948) +++ trunk/MRPReschedules.php 2018-02-10 02:36:28 UTC (rev 7949) @@ -5,9 +5,7 @@ include('includes/session.php'); -$sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; -$result=DB_query($sql); -if (DB_num_rows($result)==0) { +if ( !DB_table_exists('mrprequirements') ) { $Title='MRP error'; include('includes/header.php'); echo '<br />'; Modified: trunk/MRPShortages.php =================================================================== --- trunk/MRPShortages.php 2018-02-10 01:46:00 UTC (rev 7948) +++ trunk/MRPShortages.php 2018-02-10 02:36:28 UTC (rev 7949) @@ -4,11 +4,7 @@ include('includes/session.php'); -//ANSI SQL??? -$sql = "SELECT TABLE_NAME FROM information_schema.tables WHERE TABLE_SCHEMA = '" . $_SESSION['DatabaseName'] . "' AND TABLE_NAME = 'mrprequirements'"; - -$result=DB_query($sql); -if (DB_num_rows($result)==0) { +if ( !DB_table_exists('mrprequirements') ) { $Title=_('MRP error'); include('includes/header.php'); echo '<br />'; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-10 01:46:00 UTC (rev 7948) +++ trunk/doc/Change.log 2018-02-10 02:36:28 UTC (rev 7949) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 PaulT: MRPReschedules.php, MRPShortages.php: Use DB_table_exists() from commit 7943 to replace table check query. 9/2/18 PaulT: Remove the last of the remaining URL 'SID' references. 9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) 9/2/18 Paul Becker (PaulT commit): InternalStockRequestFulfill.php: Add controlled stock handling within this script. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8086) |
From: <tu...@us...> - 2018-02-11 04:11:07
|
Revision: 7950 http://sourceforge.net/p/web-erp/reponame/7950 Author: turbopt Date: 2018-02-11 04:11:05 +0000 (Sun, 11 Feb 2018) Log Message: ----------- PaulT: Remove a few lingering $k and $j variables left behind from 7944 commit. Modified Paths: -------------- trunk/GLAccountCSV.php trunk/GLAccountReport.php trunk/doc/Change.log trunk/includes/OutputSerialItems.php Modified: trunk/GLAccountCSV.php =================================================================== --- trunk/GLAccountCSV.php 2018-02-10 02:36:28 UTC (rev 7949) +++ trunk/GLAccountCSV.php 2018-02-11 04:11:05 UTC (rev 7950) @@ -204,9 +204,6 @@ $PeriodTotal = 0; $PeriodNo = -9999; - $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($TransResult)) { if ($myrow['periodno']!=$PeriodNo){ Modified: trunk/GLAccountReport.php =================================================================== --- trunk/GLAccountReport.php 2018-02-10 02:36:28 UTC (rev 7949) +++ trunk/GLAccountReport.php 2018-02-11 04:11:05 UTC (rev 7950) @@ -132,9 +132,6 @@ $PeriodTotal = 0; $PeriodNo = -9999; - $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($TransResult)) { if ($myrow['periodno']!=$PeriodNo){ @@ -352,4 +349,4 @@ $YPos =$YPos - (2*$line_height); } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-10 02:36:28 UTC (rev 7949) +++ trunk/doc/Change.log 2018-02-11 04:11:05 UTC (rev 7950) @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 PaulT: Remove lingering $k and $j variable left behind from 7944 commit. 9/2/18 PaulT: MRPReschedules.php, MRPShortages.php: Use DB_table_exists() from commit 7943 to replace table check query. 9/2/18 PaulT: Remove the last of the remaining URL 'SID' references. 9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) Modified: trunk/includes/OutputSerialItems.php =================================================================== --- trunk/includes/OutputSerialItems.php 2018-02-10 02:36:28 UTC (rev 7949) +++ trunk/includes/OutputSerialItems.php 2018-02-11 04:11:05 UTC (rev 7950) @@ -131,8 +131,6 @@ $TotalQuantity = 0; /*Variable to accumulate total quantity received */ $RowCounter =0; -$k=0; - $StartAddingAt = 0; if ($EditControlled){ foreach ($LineItem->SerialItems as $Bundle){ |
From: <tu...@us...> - 2018-02-11 04:33:19
|
Revision: 7951 http://sourceforge.net/p/web-erp/reponame/7951 Author: turbopt Date: 2018-02-11 04:33:16 +0000 (Sun, 11 Feb 2018) Log Message: ----------- PaulT: Remove $db parameter from all GetStockGLCode() functions. Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/ContractCosting.php trunk/CounterReturns.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/InternalStockRequestFulfill.php trunk/PDFStockCheckComparison.php trunk/SelectCreditItems.php trunk/ShipmentCosting.php trunk/StockAdjustments.php trunk/StockLocTransferReceive.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/doc/Change.log trunk/includes/SQL_CommonFunctions.inc Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/ConfirmDispatch_Invoice.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1427,7 +1427,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*now the stock entry - this is set to the cost act in the case of a fixed asset disposal */ - $StockGLCode = GetStockGLCode($OrderLine->StockID,$db); + $StockGLCode = GetStockGLCode($OrderLine->StockID); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/ContractCosting.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -231,7 +231,7 @@ include('includes/SQL_CommonFunctions.inc'); - $GLCodes = GetStockGLCode($_SESSION['Contract'.$identifier]->ContractRef,$db); + $GLCodes = GetStockGLCode($_SESSION['Contract'.$identifier]->ContractRef); //Compare actual costs to original budgeted contract costs - if actual > budgeted - CR WIP and DR usage variance $Variance = ($OtherReqtsBudget+$ContractBOMBudget)-($OtherReqtsActual+$ContractBOMActual); Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/CounterReturns.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1313,7 +1313,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*now the stock entry*/ - $StockGLCode = GetStockGLCode($ReturnItemLine->StockID,$db); + $StockGLCode = GetStockGLCode($ReturnItemLine->StockID); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/CounterSales.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1766,7 +1766,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*now the stock entry*/ - $StockGLCode = GetStockGLCode($OrderLine->StockID,$db); + $StockGLCode = GetStockGLCode($OrderLine->StockID); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/Credit_Invoice.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1350,7 +1350,7 @@ '" . $_SESSION['CreditItems' . $identifier]->DebtorNo . " - " . $CreditLine->StockID . " x " . $CreditLine->QtyDispatched . " @ " . $CreditLine->StandardCost . "', '" . round($CreditLine->StandardCost * $CreditLine->QtyDispatched,$_SESSION['CompanyRecord']['decimalplaces']) . "')"; } else { - $StockGLCode = GetStockGLCode($CreditLine->StockID, $db); + $StockGLCode = GetStockGLCode($CreditLine->StockID); $SQL = "INSERT INTO gltrans(type, typeno, trandate, Modified: trunk/InternalStockRequestFulfill.php =================================================================== --- trunk/InternalStockRequestFulfill.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/InternalStockRequestFulfill.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -145,7 +145,7 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $StandardCost > 0){ - $StockGLCodes = GetStockGLCode($StockID,$db); + $StockGLCodes = GetStockGLCode($StockID); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/PDFStockCheckComparison.php =================================================================== --- trunk/PDFStockCheckComparison.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/PDFStockCheckComparison.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -132,7 +132,7 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $myrow['standardcost'] > 0){ - $StockGLCodes = GetStockGLCode($myrow['stockid'],$db); + $StockGLCodes = GetStockGLCode($myrow['stockid']); $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction entries could not be added because'); $DbgMsg = _('The following SQL to insert the GL entries was used'); Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/SelectCreditItems.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1838,7 +1838,7 @@ } else { /*the goods are coming back into stock so debit the stock account*/ - $StockGLCode = GetStockGLCode($CreditLine->StockID, $db); + $StockGLCode = GetStockGLCode($CreditLine->StockID); $SQL = "INSERT INTO gltrans (type, typeno, trandate, Modified: trunk/ShipmentCosting.php =================================================================== --- trunk/ShipmentCosting.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/ShipmentCosting.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -217,7 +217,7 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1){ - $StockGLCodes = GetStockGLCode($myrow['itemcode'],$db); + $StockGLCodes = GetStockGLCode($myrow['itemcode']); } /*GL journals depend on the costing method used currently: Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/StockAdjustments.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -319,7 +319,7 @@ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $_SESSION['Adjustment' . $identifier]->StandardCost > 0){ - $StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID,$db); + $StockGLCodes = GetStockGLCode($_SESSION['Adjustment' . $identifier]->StockID); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/StockLocTransferReceive.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -204,7 +204,7 @@ if($_SESSION['Transfer']->StockLocationFromAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationFromAccount; } else { - $StockGLCode = GetStockGLCode($TrfLine->StockID, $db);// Get Category's account codes. + $StockGLCode = GetStockGLCode($TrfLine->StockID);// Get Category's account codes. $AccountCode = $StockGLCode['stockact'];// Select account code for stock. } // Get the item cost: @@ -357,7 +357,7 @@ if($_SESSION['Transfer']->StockLocationToAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationToAccount; } else { - $StockGLCode = GetStockGLCode($TrfLine->StockID, $db);// Get Category's account codes. + $StockGLCode = GetStockGLCode($TrfLine->StockID);// Get Category's account codes. $AccountCode = $StockGLCode['stockact'];// Select account code for stock. } // Get the item cost: Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/StockTransfers.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -221,7 +221,7 @@ if($_SESSION['Transfer']->StockLocationToAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationToAccount; } else { - $StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID, $db);// Get Category's account codes. + $StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID);// Get Category's account codes. $AccountCode = $StockGLCode['stockact'];// Select account code for stock. } // Get the item cost: @@ -377,7 +377,7 @@ if($_SESSION['Transfer']->StockLocationToAccount !='') { $AccountCode = $_SESSION['Transfer']->StockLocationToAccount; } else { - $StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID, $db);// Get Category's account codes. + $StockGLCode = GetStockGLCode($_SESSION['Transfer']->TransferItem[0]->StockID);// Get Category's account codes. $AccountCode = $StockGLCode['stockact'];// Select account code for stock. } // Get the item cost: Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/SupplierCredit.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -860,7 +860,7 @@ if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */ /*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */ - $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db); + $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode); /*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */ Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/SupplierInvoice.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1261,7 +1261,7 @@ if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */ /*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */ - $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db); + $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode); /*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */ Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/WorkOrderIssue.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -168,7 +168,7 @@ $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); //backdate $SQLIssuedDate = FormatDateForSQL($_POST['IssuedDate']); - $StockGLCode = GetStockGLCode($_POST['IssueItem'],$db); + $StockGLCode = GetStockGLCode($_POST['IssueItem']); if ($IssueItemRow['mbflag']=='M' OR $IssueItemRow['mbflag']=='B'){ @@ -491,7 +491,7 @@ $_POST['IssueItem'] = $itm['item']; $QuantityIssued = $itm['qty']; $IssueItemRow['mbflag'] = $itm['mbflag']; - $StockGLCode = GetStockGLCode($_POST['IssueItem'],$db); + $StockGLCode = GetStockGLCode($_POST['IssueItem']); $IssueItemRow['cost'] = $itm['cost']; if ($IssueItemRow['mbflag']=='M' OR $IssueItemRow['mbflag']=='B'){ /* Need to get the current location quantity will need it later for the stock movement */ Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/WorkOrderReceive.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -208,7 +208,7 @@ } $SQLReceivedDate = FormatDateForSQL($_POST['ReceivedDate']); - $StockGLCode = GetStockGLCode($_POST['StockID'],$db); + $StockGLCode = GetStockGLCode($_POST['StockID']); //Recalculate the standard for the item if there were no items previously received against the work order if ($WORow['qtyrecd']==0){ Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/api/api_debtortransactions.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -935,7 +935,7 @@ $Result = api_DB_query($SQL,'','',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); + $StockGLCode = GetStockGLCode($CN_Line['stockid']); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/api/api_salesorders.php 2018-02-11 04:33:16 UTC (rev 7951) @@ -1104,7 +1104,7 @@ $Result = api_DB_query($SQL,'','',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); + $StockGLCode = GetStockGLCode($OrderLineRow['stkcode']); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/doc/Change.log 2018-02-11 04:33:16 UTC (rev 7951) @@ -1,6 +1,7 @@ webERP Change Log -9/2/18 PaulT: Remove lingering $k and $j variable left behind from 7944 commit. +10/2/18 PaulT: Remove $db parameter from all GetStockGLCode() functions. +10/2/18 PaulT: Remove variables left behind from 7944 commit. 9/2/18 PaulT: MRPReschedules.php, MRPShortages.php: Use DB_table_exists() from commit 7943 to replace table check query. 9/2/18 PaulT: Remove the last of the remaining URL 'SID' references. 9/2/18 Paul Becker (PaulT commit): StockLocMovements.php, StockMovements.php: Add serial number column to output. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8088) Modified: trunk/includes/SQL_CommonFunctions.inc =================================================================== --- trunk/includes/SQL_CommonFunctions.inc 2018-02-11 04:11:05 UTC (rev 7950) +++ trunk/includes/SQL_CommonFunctions.inc 2018-02-11 04:33:16 UTC (rev 7951) @@ -31,7 +31,7 @@ } -Function GetStockGLCode ($StockID, &$db){ +Function GetStockGLCode ($StockID){ /*Gets the GL Codes relevant to the stock item account from the stock category record */ $QuerySQL = "SELECT stockact, @@ -158,7 +158,7 @@ $CostUpdateNo = GetNextTransNo(35, $db); $PeriodNo = GetPeriod(date($_SESSION['DefaultDateFormat']), $db); - $StockGLCode = GetStockGLCode($StockID,$db); + $StockGLCode = GetStockGLCode($StockID); $ValueOfChange = $QOH * ($NewCost - $OldCost); @@ -503,4 +503,4 @@ } //$myrow[0]>0 } -?> +?> \ No newline at end of file |
From: <tu...@us...> - 2018-02-11 18:54:56
|
Revision: 7954 http://sourceforge.net/p/web-erp/reponame/7954 Author: turbopt Date: 2018-02-11 18:54:53 +0000 (Sun, 11 Feb 2018) Log Message: ----------- Contracts.php: Move closing form tag outside of condition. Fixes view page source message: "Saw a form start tag, but there was already an active form element. Nested forms are not allowed. Ignoring the tag." reported in Firefox. Modified Paths: -------------- trunk/Contracts.php trunk/doc/Change.log Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2018-02-11 05:06:14 UTC (rev 7953) +++ trunk/Contracts.php 2018-02-11 18:54:53 UTC (rev 7954) @@ -812,9 +812,11 @@ } //end of while loop - echo '</table></form>'; + echo '</table>'; }//end if results to show + echo '</form>'; + //end if RequireCustomerSelection } else { /*A customer is already selected so get into the contract setup proper */ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-11 05:06:14 UTC (rev 7953) +++ trunk/doc/Change.log 2018-02-11 18:54:53 UTC (rev 7954) @@ -1,5 +1,6 @@ webERP Change Log +11/2/18 PaulT: Contracts.php: Move closing form tag outside of condition. Fixes view page source message "Saw a form start tag, but there was already an active form element. Nested forms are not allowed. Ignoring the tag." reported in Firefox. 10/2/18 PaulT: Remove $db parameter from WoRealRequirements(), EnsureGLEntriesBalance(), and CreateQASample() functions. 10/2/18 PaulT: Remove $db parameter from BomMaterialCost(), GetTaxRate(), GetTaxes(), GetCreditAvailable(), ItemCostUpdateGL(), and UpdateCost() functions. 10/2/18 PaulT: Remove $db parameter from all GetStockGLCode() functions. |
From: <tu...@us...> - 2018-02-11 19:10:28
|
Revision: 7955 http://sourceforge.net/p/web-erp/reponame/7955 Author: turbopt Date: 2018-02-11 19:10:26 +0000 (Sun, 11 Feb 2018) Log Message: ----------- SellThroughSupport.php: Remove redundant hidden FormID input. Modified Paths: -------------- trunk/SellThroughSupport.php trunk/doc/Change.log Modified: trunk/SellThroughSupport.php =================================================================== --- trunk/SellThroughSupport.php 2018-02-11 18:54:53 UTC (rev 7954) +++ trunk/SellThroughSupport.php 2018-02-11 19:10:26 UTC (rev 7955) @@ -154,8 +154,8 @@ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <table cellpadding="2" colspan="7" class="selection">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $TableHeader = '<tr> + + $TableHeader = '<tr> <th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-11 18:54:53 UTC (rev 7954) +++ trunk/doc/Change.log 2018-02-11 19:10:26 UTC (rev 7955) @@ -1,5 +1,6 @@ webERP Change Log +11/2/18 PaulT: SellThroughSupport.php: Remove redundant hidden FormID input. 11/2/18 PaulT: Contracts.php: Move closing form tag outside of condition. Fixes view page source message "Saw a form start tag, but there was already an active form element. Nested forms are not allowed. Ignoring the tag." reported in Firefox. 10/2/18 PaulT: Remove $db parameter from WoRealRequirements(), EnsureGLEntriesBalance(), and CreateQASample() functions. 10/2/18 PaulT: Remove $db parameter from BomMaterialCost(), GetTaxRate(), GetTaxes(), GetCreditAvailable(), ItemCostUpdateGL(), and UpdateCost() functions. |
From: <tu...@us...> - 2018-02-11 19:21:55
|
Revision: 7956 http://sourceforge.net/p/web-erp/reponame/7956 Author: turbopt Date: 2018-02-11 19:21:52 +0000 (Sun, 11 Feb 2018) Log Message: ----------- PaulT: SellThroughSupport.php: Remove (another) redundant hidden FormID input. (there were two, overlooked the 2nd one earlier) Modified Paths: -------------- trunk/SellThroughSupport.php trunk/doc/Change.log Modified: trunk/SellThroughSupport.php =================================================================== --- trunk/SellThroughSupport.php 2018-02-11 19:10:26 UTC (rev 7955) +++ trunk/SellThroughSupport.php 2018-02-11 19:21:52 UTC (rev 7956) @@ -190,7 +190,6 @@ <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <table cellpadding="3" colspan="4" class="selection"> <tr> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> <td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</td> <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> <td><b>' . _('OR') . '</b></td> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-11 19:10:26 UTC (rev 7955) +++ trunk/doc/Change.log 2018-02-11 19:21:52 UTC (rev 7956) @@ -1,5 +1,6 @@ webERP Change Log +11/2/18 PaulT: SellThroughSupport.php: Remove (another) redundant hidden FormID input. (there were two, overlooked the 2nd one earlier) 11/2/18 PaulT: SellThroughSupport.php: Remove redundant hidden FormID input. 11/2/18 PaulT: Contracts.php: Move closing form tag outside of condition. Fixes view page source message "Saw a form start tag, but there was already an active form element. Nested forms are not allowed. Ignoring the tag." reported in Firefox. 10/2/18 PaulT: Remove $db parameter from WoRealRequirements(), EnsureGLEntriesBalance(), and CreateQASample() functions. |