From: <rc...@us...> - 2016-11-21 14:55:39
|
Revision: 7675 http://sourceforge.net/p/web-erp/reponame/7675 Author: rchacon Date: 2016-11-21 14:55:36 +0000 (Mon, 21 Nov 2016) Log Message: ----------- Fix and standardise texts. Modified Paths: -------------- trunk/AgedDebtors.php trunk/PDFCustomerList.php trunk/PcAuthorizeExpenses.php trunk/SalesInquiry.php trunk/SelectCustomer.php trunk/WorkOrderEntry.php trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/AgedDebtors.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -1,10 +1,10 @@ <?php - /* $Id$ */ + /* Lists customer account balances in detail or summary in selected currency */ include('includes/session.inc'); -if (isset($_POST['PrintPDF']) +if(isset($_POST['PrintPDF']) and isset($_POST['FromCriteria']) and mb_strlen($_POST['FromCriteria'])>=1 and isset($_POST['ToCriteria']) @@ -18,15 +18,15 @@ $line_height = 12; /*Now figure out the aged analysis for the customer range under review */ - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $_POST['Salesman'] = $_SESSION['SalesmanLogin']; } - if (trim($_POST['Salesman'])!=''){ + if(trim($_POST['Salesman'])!='') { $SalesLimit = " AND debtorsmaster.debtorno IN (SELECT DISTINCT debtorno FROM custbranch WHERE salesman = '".$_POST['Salesman']."') "; } else { $SalesLimit = ""; } - if ($_POST['All_Or_Overdues']=='All'){ + if($_POST['All_Or_Overdues']=='All') { $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, @@ -46,7 +46,7 @@ ELSE 0 END ELSE CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END ) AS due, @@ -97,7 +97,7 @@ HAVING ROUND(ABS(SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)),currencies.decimalplaces) > 0"; - } elseif ($_POST['All_Or_Overdues']=='OverduesOnly') { + } elseif($_POST['All_Or_Overdues']=='OverduesOnly') { $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, @@ -117,7 +117,7 @@ THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END ) AS due, @@ -180,7 +180,7 @@ END ) > 0.01"; - } elseif ($_POST['All_Or_Overdues']=='HeldOnly'){ + } elseif($_POST['All_Or_Overdues']=='HeldOnly') { $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, @@ -264,12 +264,12 @@ } $CustomerResult = DB_query($SQL,'','',False,False); /*dont trap errors handled below*/ - if (DB_error_no() !=0) { + if(DB_error_no() !=0) { $Title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '.... '; include('includes/header.inc'); prnMsg(_('The customer details 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){ + if($debug==1) { echo '<br />' . $SQL; } include('includes/footer.inc'); @@ -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,$db)) { $CurrDecimalPlaces = $AgedAnalysis['decimalplaces']; $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); @@ -309,12 +309,12 @@ $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayOverdue2,'right'); $YPos -=$line_height; - if ($YPos < $Bottom_Margin + $line_height){ + if($YPos < $Bottom_Margin + $line_height) { include('includes/PDFAgedDebtorsPageHeader.inc'); } - if ($_POST['DetailedReport']=='Yes'){ + if($_POST['DetailedReport']=='Yes') { /*draw a line under the customer aged analysis*/ $pdf->line($Page_Width-$Right_Margin, $YPos+10,$Left_Margin, $YPos+10); @@ -361,24 +361,24 @@ AND debtortrans.debtorno = '" . $AgedAnalysis['debtorno'] . "' AND ABS(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)>0.004"; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } $DetailResult = DB_query($sql,'','',False,False); /*Dont trap errors */ - if (DB_error_no() !=0) { + if(DB_error_no() !=0) { $Title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg(_('The details of outstanding transactions for customer') . ' - ' . $AgedAnalysis['debtorno'] . ' ' . _('could not be retrieved because') . ' - ' . DB_error_msg(),'error'); echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>'; - if ($debug==1){ + if($debug==1) { echo '<br />' . _('The SQL that failed was') . '<br />' . $sql; } include('includes/footer.inc'); exit; } - while ($DetailTrans = DB_fetch_array($DetailResult)){ + while ($DetailTrans = DB_fetch_array($DetailResult)) { $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos,60,$FontSize,$DetailTrans['typename'],'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,60,$FontSize,$DetailTrans['transno'],'left'); @@ -398,7 +398,7 @@ $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayOverdue2,'right'); $YPos -=$line_height; - if ($YPos < $Bottom_Margin + $line_height){ + if($YPos < $Bottom_Margin + $line_height) { include('includes/PDFAgedDebtorsPageHeader.inc'); } @@ -410,10 +410,10 @@ } /*end customer aged analysis while loop */ $YPos -=$line_height; - if ($YPos < $Bottom_Margin + (2*$line_height)){ + if($YPos < $Bottom_Margin + (2*$line_height)) { $PageNumber++; include('includes/PDFAgedDebtorsPageHeader.inc'); - } elseif ($_POST['DetailedReport']=='Yes') { + } elseif($_POST['DetailedReport']=='Yes') { //dont do a line if the totals have to go on a new page $pdf->line($Page_Width-$Right_Margin, $YPos+10 ,220, $YPos+10); } @@ -430,7 +430,7 @@ $LeftOvers = $pdf->addTextWrap(400,$YPos,60,$FontSize,$DisplayTotOverdue1,'right'); $LeftOvers = $pdf->addTextWrap(460,$YPos,60,$FontSize,$DisplayTotOverdue2,'right'); - if ($ListCount == 0) { + if($ListCount == 0) { $Title = _('Aged Customer Account Analysis') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg(_('There are no customers with balances meeting the criteria specified to list'),'info'); @@ -453,7 +453,7 @@ echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p><br />'; - if ((!isset($_POST['FromCriteria']) or !isset($_POST['ToCriteria']))) { + if((!isset($_POST['FromCriteria']) or !isset($_POST['ToCriteria']))) { /*if $FromCriteria is not set then show a form to allow input */ @@ -480,7 +480,7 @@ </tr> <tr> <td>' . _('Only Show Customers Of') . ':' . '</td>'; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { echo '<td>'; echo $_SESSION['UsersRealName']; echo '</td>'; @@ -490,8 +490,8 @@ $sql = "SELECT salesmancode, salesmanname FROM salesman"; $result=DB_query($sql); - echo '<option value="">' . _('All Sales people') . '</option>'; - while ($myrow=DB_fetch_array($result)){ + echo '<option value="">' . _('All Salespeople') . '</option>'; + while ($myrow=DB_fetch_array($result)) { echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } echo '</select></td>'; @@ -504,8 +504,8 @@ $sql = "SELECT currency, currabrev FROM currencies"; $result=DB_query($sql); - while ($myrow=DB_fetch_array($result)){ - if ($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']){ + while ($myrow=DB_fetch_array($result)) { + if($myrow['currabrev'] == $_SESSION['CompanyRecord']['currencydefault']) { echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; } else { echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>'; Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/PDFCustomerList.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -1,13 +1,13 @@ <?php - /* $Id$*/ +/* Creates a report of the customer and branch information held. This report has options to print only customer branches in a specified sales area and sales person. Additional option allows to list only those customers with activity either under or over a specified amount, since a specified date. */ include('includes/session.inc'); $ViewTopic = 'ARReports'; $BookMark = 'CustomerListing'; - -if (isset($_POST['PrintPDF'])){ +if(isset($_POST['PrintPDF'])) { + include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Customer Listing') ); $pdf->addInfo('Subject', _('Customer Listing') ); @@ -15,8 +15,8 @@ $PageNumber = 0; $FontSize=10; - if ($_POST['Activity']!='All'){ - if (!is_numeric($_POST['ActivityAmount'])){ + if($_POST['Activity']!='All') { + if(!is_numeric($_POST['ActivityAmount'])) { $Title = _('Customer List') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); echo '<p />'; @@ -28,8 +28,8 @@ /* Now figure out the customer data to report for the selections made */ - if (in_array('All', $_POST['Areas'])){ - if (in_array('All', $_POST['SalesPeople'])){ + if(in_array('All', $_POST['Areas'])) { + if(in_array('All', $_POST['SalesPeople'])) { $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, debtorsmaster.address1, @@ -101,8 +101,8 @@ WHERE ("; $i=0; - foreach ($_POST['SalesPeople'] as $Salesperson){ - if ($i>0){ + foreach ($_POST['SalesPeople'] as $Salesperson) { + if($i>0) { $SQL .= " OR "; } $i++; @@ -115,7 +115,7 @@ custbranch.branchcode"; } /*end if SalesPeople =='All' */ } else { /* not all sales areas has been selected so need to build the where clause */ - if (in_array('All', $_POST['SalesPeople'])){ + if(in_array('All', $_POST['SalesPeople'])) { $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, debtorsmaster.address1, @@ -150,8 +150,8 @@ WHERE ("; $i=0; - foreach ($_POST['Areas'] as $Area){ - if ($i>0){ + foreach ($_POST['Areas'] as $Area) { + if($i>0) { $SQL .= " OR "; } $i++; @@ -198,8 +198,8 @@ WHERE ("; $i=0; - foreach ($_POST['Areas'] as $Area){ - if ($i>0){ + foreach ($_POST['Areas'] as $Area) { + if($i>0) { $SQL .= " OR "; } $i++; @@ -209,8 +209,8 @@ $SQL .= ") AND ("; $i=0; - foreach ($_POST['SalesPeople'] as $Salesperson){ - if ($i>0){ + foreach ($_POST['SalesPeople'] as $Salesperson) { + if($i>0) { $SQL .= " OR "; } $i++; @@ -228,19 +228,19 @@ $CustomersResult = DB_query($SQL); - if (DB_error_no() !=0) { + if(DB_error_no() !=0) { $Title = _('Customer List') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('The customer List could not be retrieved by the SQL because') . ' - ' . DB_error_msg() ); echo '<br /><a href="' .$RootPath .'/index.php">' . _('Back to the menu'). '</a>'; - if ($debug==1){ + if($debug==1) { echo '<br />' . $SQL; } include('includes/footer.inc'); exit; } - if (DB_num_rows($CustomersResult) == 0) { + if(DB_num_rows($CustomersResult) == 0) { $Title = _('Customer List') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('This report has no output because there were no customers retrieved'), 'error' ); @@ -255,9 +255,9 @@ $Area =''; $SalesPerson=''; - While ($Customers = DB_fetch_array($CustomersResult,$db)){ + while($Customers = DB_fetch_array($CustomersResult,$db)) { - if ($_POST['Activity']!='All'){ + if($_POST['Activity']!='All') { /*Get the total turnover in local currency for the customer/branch since the date entered */ @@ -273,14 +273,14 @@ $ActivityRow = DB_fetch_row($ActivityResult); $LocalCurrencyTurnover = $ActivityRow[0]; - if ($_POST['Activity'] =='GreaterThan'){ - if ($LocalCurrencyTurnover > $_POST['ActivityAmount']){ + if($_POST['Activity'] =='GreaterThan') { + if($LocalCurrencyTurnover > $_POST['ActivityAmount']) { $PrintThisCustomer = true; } else { $PrintThisCustomer = false; } - } elseif ($_POST['Activity'] =='LessThan'){ - if ($LocalCurrencyTurnover < $_POST['ActivityAmount']){ + } elseif($_POST['Activity'] =='LessThan') { + if($LocalCurrencyTurnover < $_POST['ActivityAmount']) { $PrintThisCustomer = true; } else { $PrintThisCustomer = false; @@ -290,11 +290,11 @@ $PrintThisCustomer = true; } - if ($PrintThisCustomer){ - if ($Area!=$Customers['area']){ + if($PrintThisCustomer) { + if($Area!=$Customers['area']) { $FontSize=10; $YPos -=$line_height; - if ($YPos < ($Bottom_Margin + 80)){ + if($YPos < ($Bottom_Margin + 80)) { include('includes/PDFCustomerListPageHeader.inc'); } $pdf->setFont('','B'); @@ -305,10 +305,10 @@ $YPos -=$line_height; } - if ($SalesPerson!=$Customers['salesman']){ + if($SalesPerson!=$Customers['salesman']) { $FontSize=10; $YPos -=($line_height); - if ($YPos < ($Bottom_Margin + 80)){ + if($YPos < ($Bottom_Margin + 80)) { include('includes/PDFCustomerListPageHeader.inc'); } $pdf->setFont('','B'); @@ -333,7 +333,7 @@ $LeftOvers = $pdf->addTextWrap(230,$YPos,60,$FontSize,$Customers['branchcode']); $LeftOvers = $pdf->addTextWrap(230,$YPos-10,60,$FontSize, _('Price List') . ': ' . $Customers['salestype']); - if ($_POST['Activity']!='All'){ + if($_POST['Activity']!='All') { $LeftOvers = $pdf->addTextWrap(230,$YPos-20,60,$FontSize,_('Turnover'),'right'); $LeftOvers = $pdf->addTextWrap(230,$YPos-30,60,$FontSize,locale_number_format($LocalCurrencyTurnover,0), 'right'); } @@ -353,7 +353,7 @@ $pdf->line($Page_Width-$Right_Margin, $YPos-32,$Left_Margin, $YPos-32); $YPos -=40; - if ($YPos < ($Bottom_Margin +30)){ + if($YPos < ($Bottom_Margin +30)) { include('includes/PDFCustomerListPageHeader.inc'); } } /*end if $PrintThisCustomer == true */ @@ -381,19 +381,19 @@ echo '<option selected="selected" value="All">' . _('All Areas') . '</option>'; - While ($myrow = DB_fetch_array($AreasResult)){ + while($myrow = DB_fetch_array($AreasResult)) { echo '<option value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>'; } echo '</select></td></tr>'; echo '<tr><td>' . _('For Sales folk'). ':</td> <td><select name="SalesPeople[]" multiple="multiple"> - <option selected="selected" value="All">' . _('All sales folk') . '</option>'; + <option selected="selected" value="All">' . _('All Salespeople') . '</option>'; $sql = "SELECT salesmancode, salesmanname FROM salesman"; $SalesFolkResult = DB_query($sql); - While ($myrow = DB_fetch_array($SalesFolkResult)){ + while($myrow = DB_fetch_array($SalesFolkResult)) { echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/PcAuthorizeExpenses.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -1,67 +1,68 @@ <?php /* $Id$*/ +/* */ include('includes/session.inc'); $Title = _('Authorisation of Petty Cash Expenses'); -/* webERP manual links before header.inc */ $ViewTopic= 'PettyCash'; $BookMark = 'AuthorizeExpense'; include('includes/header.inc'); + include('includes/SQL_CommonFunctions.inc'); -if (isset($_POST['SelectedTabs'])){ +if(isset($_POST['SelectedTabs'])) { $SelectedTabs = mb_strtoupper($_POST['SelectedTabs']); -} elseif (isset($_GET['SelectedTabs'])){ +} elseif(isset($_GET['SelectedTabs'])) { $SelectedTabs = mb_strtoupper($_GET['SelectedTabs']); } -if (isset($_POST['SelectedIndex'])){ +if(isset($_POST['SelectedIndex'])) { $SelectedIndex = $_POST['SelectedIndex']; -} elseif (isset($_GET['SelectedIndex'])){ +} elseif(isset($_GET['SelectedIndex'])) { $SelectedIndex = $_GET['SelectedIndex']; } -if (isset($_POST['Days'])){ +if(isset($_POST['Days'])) { $Days = filter_number_format($_POST['Days']); -} elseif (isset($_GET['Days'])){ +} elseif(isset($_GET['Days'])) { $Days = filter_number_format($_GET['Days']); } -if (isset($_POST['Process'])) { - if ($SelectedTabs=='') { +if(isset($_POST['Process'])) { + if($SelectedTabs=='') { prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'),'error'); unset($SelectedTabs); } } -if (isset($_POST['Go'])) { - if ($Days<=0) { +if(isset($_POST['Go'])) { + if($Days<=0) { prnMsg(_('The number of days must be a positive number'),'error'); $Days=30; } } -if (isset($SelectedTabs)) { +if(isset($SelectedTabs)) { echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Petty Cash') . - '" alt="" />' . _('Authorisation Of Petty Cash Expenses') . ' '.$SelectedTabs . '</p>'; + '" alt="" />', _('Authorisation of Petty Cash Expenses'), ' ', $SelectedTabs, '</p>'; } else { echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/magnifier.png" title="' . _('Petty Cash') . - '" alt="" />' . _('Authorisation Of Petty Cash Expenses') . '</p>'; + '" alt="" />', _('Authorisation of Petty Cash Expenses'), '</p>'; } -if (isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { +if(isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - if(!isset ($Days)){ + if(!isset ($Days)) { $Days=30; } echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" /> <br /> <table class="selection"> <tr> - <th colspan="7">' . _('Detail Of Movement For Last ') .':<input type="text" class="intger" name="Days" value="' . $Days . '" maxlength="3" size="4" />' . _('Days'); + <th colspan="7">', _('Detail Of Movement For Last '), ':<input class="integer" maxlength="3" name="Days" size="4" type="text" value="', $Days, '" />', _('Days'); echo '<input type="submit" name="Go" value="' . _('Go') . '" /></th> </tr>'; @@ -101,22 +102,22 @@ $k=0; //row colour counter - while ($myrow=DB_fetch_array($result)) { + while($myrow=DB_fetch_array($result)) { $CurrDecimalPlaces = $myrow['decimalplaces']; //update database if update pressed - if (isset($_POST['Submit']) + if(isset($_POST['Submit']) AND $_POST['Submit']==_('Update') - AND isset($_POST[$myrow['counterindex']])){ + AND isset($_POST[$myrow['counterindex']])) { $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); - if ($myrow['rate'] == 1){ // functional currency + if($myrow['rate'] == 1) { // functional currency $Amount = $myrow['amount']; }else{ // other currencies $Amount = $myrow['amount']/$myrow['rate']; } - if ($myrow['codeexpense'] == 'ASSIGNCASH'){ + if($myrow['codeexpense'] == 'ASSIGNCASH') { $type = 2; $AccountFrom = $myrow['glaccountassignment']; $AccountTo = $myrow['glaccountpcash']; @@ -139,7 +140,7 @@ $typeno = GetNextTransNo($type,$db); //build narrative - $Narrative= _('PettyCash') . ' - '. $myrow['tabcode'] . ' - ' . $myrow['codeexpense'] . ' - ' . DB_escape_string($myrow['notes']) . ' - ' . $myrow['receipt']; + $Narrative = _('Petty Cash') . ' - '. $myrow['tabcode'] . ' - ' . $myrow['codeexpense'] . ' - ' . DB_escape_string($myrow['notes']) . ' - ' . $myrow['receipt']; //insert to gltrans DB_Txn_Begin(); @@ -197,7 +198,7 @@ $ResultTo = DB_query($sqlTo,'', '', true); - if ($myrow['codeexpense'] == 'ASSIGNCASH'){ + if($myrow['codeexpense'] == 'ASSIGNCASH') { // if it's a cash assignation we need to updated banktrans table as well. $ReceiptTransNo = GetNextTransNo( 2, $db); $SQLBank= "INSERT INTO banktrans (transno, @@ -235,14 +236,14 @@ DB_Txn_Commit(); } - if ($k==1){ + if($k==1) { echo '<tr class="EvenTableRows">'; $k=0; } else { echo '<tr class="OddTableRows">'; $k=1; } - if ($myrow['posted']==0) { + if($myrow['posted']==0) { $Posted=_('No'); } else { $Posted=_('Yes'); @@ -254,11 +255,11 @@ <td>' .$myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td>'; - if (isset($_POST[$myrow['counterindex']])){ + if(isset($_POST[$myrow['counterindex']])) { echo'<td>' . ConvertSQLDate(Date('Y-m-d')); }else{ //compare against raw SQL format date, then convert for display. - if(($myrow['authorized']!='0000-00-00')){ + if(($myrow['authorized']!='0000-00-00')) { echo'<td>' . ConvertSQLDate($myrow['authorized']); }else{ echo '<td align="right"><input type="checkbox" name="'.$myrow['counterindex'].'" />'; @@ -278,7 +279,7 @@ $ResultAmount = DB_query($sqlamount); $Amount=DB_fetch_array($ResultAmount); - if (!isset($Amount['0'])) { + if(!isset($Amount['0'])) { $Amount['0']=0; } @@ -315,10 +316,10 @@ <td>' . _('Authorise expenses to Petty Cash Tab') . ':</td> <td><select name="SelectedTabs" required="required" autofocus="autofocus" >'; - while ($myrow = DB_fetch_array($result)) { + while($myrow = DB_fetch_array($result)) { $Authorisers = explode(',',$myrow['authorizer']); - if (in_array($_SESSION['UserID'],$Authorisers)) { - if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + if(in_array($_SESSION['UserID'],$Authorisers)) { + if(isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected="selected" value="'; } else { echo '<option value="'; @@ -340,5 +341,6 @@ </div> </form>'; } /*end of else not submit */ + include('includes/footer.inc'); ?> Modified: trunk/SalesInquiry.php =================================================================== --- trunk/SalesInquiry.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/SalesInquiry.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -1,6 +1,6 @@ <?php - /* $Id$*/ +/* */ // SalesInquiry.php // Inquiry on Sales Orders - If Date Type is Order Date, salesorderdetails is the main table // If Date Type is Invoice, stockmoves is the main table @@ -10,43 +10,43 @@ include('includes/header.inc'); # Sets default date range for current month -if (!isset($_POST['FromDate'])){ +if(!isset($_POST['FromDate'])) { $_POST['FromDate']=Date($_SESSION['DefaultDateFormat'], mktime(0,0,0,Date('m'),1,Date('Y'))); } -if (!isset($_POST['ToDate'])){ +if(!isset($_POST['ToDate'])) { $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); } -if (isset($_POST['PartNumber'])){ +if(isset($_POST['PartNumber'])) { $PartNumber = trim(mb_strtoupper($_POST['PartNumber'])); -} elseif (isset($_GET['PartNumber'])){ +} elseif(isset($_GET['PartNumber'])) { $PartNumber = trim(mb_strtoupper($_GET['PartNumber'])); } # Part Number operator - either LIKE or = -if (isset($_POST['PartNumberOp'])){ +if(isset($_POST['PartNumberOp'])) { $PartNumberOp = $_POST['PartNumberOp']; } else { $PartNumberOp = '='; } -if (isset($_POST['DebtorNo'])){ +if(isset($_POST['DebtorNo'])) { $DebtorNo = trim(mb_strtoupper($_POST['DebtorNo'])); -} elseif (isset($_GET['DebtorNo'])){ +} elseif(isset($_GET['DebtorNo'])) { $DebtorNo = trim(mb_strtoupper($_GET['DebtorNo'])); } -if (isset($_POST['DebtorNoOp'])){ +if(isset($_POST['DebtorNoOp'])) { $DebtorNoOp = $_POST['DebtorNoOp']; } else { $DebtorNoOp = '='; } -if (isset($_POST['DebtorName'])){ +if(isset($_POST['DebtorName'])) { $DebtorName = trim(mb_strtoupper($_POST['DebtorName'])); -} elseif (isset($_GET['DebtorName'])){ +} elseif(isset($_GET['DebtorName'])) { $DebtorName = trim(mb_strtoupper($_GET['DebtorName'])); } -if (isset($_POST['DebtorNameOp'])){ +if(isset($_POST['DebtorNameOp'])) { $DebtorNameOp = $_POST['DebtorNameOp']; } else { $DebtorNameOp = '='; @@ -54,13 +54,13 @@ // Save $_POST['SummaryType'] in $SaveSummaryType because change $_POST['SummaryType'] when // create $sql -if (isset($_POST['SummaryType'])){ +if(isset($_POST['SummaryType'])) { $SaveSummaryType = $_POST['SummaryType']; } else { $SaveSummaryType = 'name'; } -if (isset($_POST['submit'])) { +if(isset($_POST['submit'])) { submit($db,$PartNumber,$PartNumberOp,$DebtorNo,$DebtorNoOp,$DebtorName,$DebtorNameOp,$SaveSummaryType); } else { display($db); @@ -77,22 +77,22 @@ //first off validate inputs sensible - if (!Is_Date($_POST['FromDate'])) { + if(!Is_Date($_POST['FromDate'])) { $InputError = 1; prnMsg(_('Invalid From Date'),'error'); } - if (!Is_Date($_POST['ToDate'])) { + if(!Is_Date($_POST['ToDate'])) { $InputError = 1; prnMsg(_('Invalid To Date'),'error'); } - if ($_POST['ReportType'] == 'Summary' AND $_POST['DateType'] == 'Order' AND $_POST['SummaryType'] == 'transno') { + if($_POST['ReportType'] == 'Summary' AND $_POST['DateType'] == 'Order' AND $_POST['SummaryType'] == 'transno') { $InputError = 1; prnMsg(_('Cannot summarize by transaction number with a date type of Order Date'),'error'); return; } - if ($_POST['ReportType'] == 'Detail' AND $_POST['DateType'] == 'Order' AND $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { + if($_POST['ReportType'] == 'Detail' AND $_POST['DateType'] == 'Order' AND $_POST['SortBy'] == 'tempstockmoves.transno,salesorderdetails.stkcode') { $InputError = 1; prnMsg(_('Cannot sort by transaction number with a date type of Order Date'),'error'); return; @@ -100,44 +100,44 @@ // TempStockmoves function creates a temporary table of stockmoves that is used when the DateType // is Invoice Date - if ($_POST['DateType'] == 'Invoice') { + if($_POST['DateType'] == 'Invoice') { TempStockmoves($db); } # Add more to WHERE statement, if user entered something for the part number,debtorno, name // Variables that end with Op - meaning operator - are either = or LIKE $WherePart = ' '; - if (mb_strlen($PartNumber) > 0 AND $PartNumberOp == 'LIKE') { + if(mb_strlen($PartNumber) > 0 AND $PartNumberOp == 'LIKE') { $PartNumber = $PartNumber . '%'; } else { $PartNumberOp = '='; } - if (mb_strlen($PartNumber) > 0) { + if(mb_strlen($PartNumber) > 0) { $WherePart = " AND salesorderdetails.stkcode " . $PartNumberOp . " '" . $PartNumber . "' "; } $WhereDebtorNo = ' '; - if ($DebtorNoOp == 'LIKE') { + if($DebtorNoOp == 'LIKE') { $DebtorNo = $DebtorNo . '%'; } else { $DebtorNoOp = '='; } - if (mb_strlen($DebtorNo) > 0) { + if(mb_strlen($DebtorNo) > 0) { $WhereDebtorNo = " AND salesorders.debtorno " . $DebtorNoOp . " '" . $DebtorNo . "' "; } else { $WhereDebtorNo = ' '; } $WhereDebtorName = ' '; - if (mb_strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { + if(mb_strlen($DebtorName) > 0 AND $DebtorNameOp == 'LIKE') { $DebtorName = $DebtorName . '%'; } else { $DebtorNameOp = '='; } - if (mb_strlen($DebtorName) > 0) { + if(mb_strlen($DebtorName) > 0) { $WhereDebtorName = " AND debtorsmaster.name " . $DebtorNameOp . " '" . $DebtorName . "' "; } - if (mb_strlen($_POST['OrderNo']) > 0) { + if(mb_strlen($_POST['OrderNo']) > 0) { $WhereOrderNo = " AND salesorderdetails.orderno = " . " '" . $_POST['OrderNo'] . "' "; } else { $WhereOrderNo = " "; @@ -147,7 +147,7 @@ # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] #in WHERE clause because the WHERE clause did not recognize # that had used the IF statement to create a field caused linestatus - if ($_POST['LineStatus'] != 'All') { + if($_POST['LineStatus'] != 'All') { $WhereLineStatus = " AND IF(salesorderdetails.quantity = salesorderdetails.qtyinvoiced || salesorderdetails.completed = 1,'Completed','Open') = '" . $_POST['LineStatus'] . "'"; } @@ -156,35 +156,35 @@ // for multiple selections from Areas - decided to just allow selection of one Area at // a time, so used simpler code $WhereArea = ' '; - if ($_POST['Area'] != 'All') { + if($_POST['Area'] != 'All') { $WhereArea = " AND custbranch.area = '" . $_POST['Area'] . "'"; } $WhereSalesman = ' '; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $WhereSalesman .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; - }elseif ($_POST['Salesman'] != 'All') { + }elseif($_POST['Salesman'] != 'All') { $WhereSalesman = " AND custbranch.salesman = '" . $_POST['Salesman'] . "'"; } $WhereCategory = ' '; - if ($_POST['Category'] != 'All') { + if($_POST['Category'] != 'All') { $WhereCategory = " AND stockmaster.categoryid = '" . $_POST['Category'] . "'"; } // Only used for Invoice Date type where tempstockmoves is the main table $WhereType = " AND (tempstockmoves.type='10' OR tempstockmoves.type='11')"; - if ($_POST['InvoiceType'] != 'All') { + if($_POST['InvoiceType'] != 'All') { $WhereType = " AND tempstockmoves.type = '" . $_POST['InvoiceType'] . "'"; } - if ($InputError !=1) { + if($InputError !=1) { $FromDate = FormatDateForSQL($_POST['FromDate']); $ToDate = FormatDateForSQL($_POST['ToDate']); - if ($_POST['ReportType'] == 'Detail') { - if ($_POST['DateType'] == 'Order') { + if($_POST['ReportType'] == 'Detail') { + if($_POST['DateType'] == 'Order') { $sql = "SELECT salesorderdetails.orderno, salesorderdetails.stkcode, salesorderdetails.itemdue, @@ -274,12 +274,12 @@ // The following is because the 'extprice' summary is a special case - with the other // summaries, you group and order on the same field; with 'extprice', you are actually // grouping on the stkcode and ordering by extprice descending - if ($_POST['SummaryType'] == 'extprice') { + if($_POST['SummaryType'] == 'extprice') { $_POST['SummaryType'] = 'stkcode'; $orderby = 'extprice DESC'; } - if ($_POST['DateType'] == 'Order') { - if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { + if($_POST['DateType'] == 'Order') { + if($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -312,7 +312,7 @@ stockmaster.description, stockmaster.decimalplaces ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'orderno') { + } elseif($_POST['SummaryType'] == 'orderno') { $sql = "SELECT salesorderdetails.orderno, salesorders.debtorno, debtorsmaster.name, @@ -344,8 +344,8 @@ ",salesorders.debtorno, debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { - if ($_POST['SummaryType'] == 'name') { + } elseif($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { + if($_POST['SummaryType'] == 'name') { $orderby = 'name'; } $sql = "SELECT debtorsmaster.debtorno, @@ -377,7 +377,7 @@ "GROUP BY debtorsmaster.debtorno ,debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'month') { + } elseif($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, SUM(salesorderdetails.quantity) as quantity, @@ -407,7 +407,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",monthname ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'categoryid') { + } elseif($_POST['SummaryType'] == 'categoryid') { $sql = "SELECT stockmaster.categoryid, stockcategory.categorydescription, SUM(salesorderdetails.quantity) as quantity, @@ -438,7 +438,7 @@ ",categorydescription ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'salesman') { + } elseif($_POST['SummaryType'] == 'salesman') { $sql = "SELECT custbranch.salesman, salesman.salesmanname, SUM(salesorderdetails.quantity) as quantity, @@ -468,7 +468,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",salesmanname ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'area') { + } elseif($_POST['SummaryType'] == 'area') { $sql = "SELECT custbranch.area, areas.areadescription, SUM(salesorderdetails.quantity) as quantity, @@ -501,7 +501,7 @@ } } else { // Selects by tempstockmoves.trandate not order date - if ($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { + if($_POST['SummaryType'] == 'extprice' OR $_POST['SummaryType'] == 'stkcode') { $sql = "SELECT salesorderdetails.stkcode, SUM(salesorderdetails.quantity) as quantity, SUM(salesorderdetails.qtyinvoiced) as qtyinvoiced, @@ -536,7 +536,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",stockmaster.description ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'orderno') { + } elseif($_POST['SummaryType'] == 'orderno') { $sql = "SELECT salesorderdetails.orderno, salesorders.debtorno, debtorsmaster.name, @@ -573,8 +573,8 @@ ",salesorders.debtorno, debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { - if ($_POST['SummaryType'] == 'name') { + } elseif($_POST['SummaryType'] == 'debtorno' OR $_POST['SummaryType'] == 'name') { + if($_POST['SummaryType'] == 'name') { $orderby = 'name'; } $sql = "SELECT debtorsmaster.debtorno, @@ -611,7 +611,7 @@ "GROUP BY debtorsmaster.debtorno" . ' ' . ",debtorsmaster.name ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'month') { + } elseif($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from salesorders.orddate) as month, CONCAT(MONTHNAME(salesorders.orddate),' ',YEAR(salesorders.orddate)) as monthname, SUM(salesorderdetails.quantity) as quantity, @@ -646,7 +646,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",monthname ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'categoryid') { + } elseif($_POST['SummaryType'] == 'categoryid') { $sql = "SELECT stockmaster.categoryid, stockcategory.categorydescription, SUM(salesorderdetails.quantity) as quantity, @@ -681,7 +681,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",categorydescription ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'salesman') { + } elseif($_POST['SummaryType'] == 'salesman') { $sql = "SELECT custbranch.salesman, salesman.salesmanname, SUM(salesorderdetails.quantity) as quantity, @@ -716,7 +716,7 @@ "GROUP BY " . $_POST['SummaryType'] . ",salesmanname ORDER BY " . $orderby; - } elseif ($_POST['SummaryType'] == 'area') { + } elseif($_POST['SummaryType'] == 'area') { $sql = "SELECT custbranch.area, areas.areadescription, SUM(salesorderdetails.quantity) as quantity, @@ -753,7 +753,7 @@ ORDER BY " . $orderby; } } - } // End of if ($_POST['ReportType'] + } // End of if($_POST['ReportType'] //echo "<br/>$sql<br/>"; $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$ErrMsg); @@ -783,26 +783,26 @@ $Detail_Array['tempstockmoves.transno,salesorderdetails.stkcode'] = _('Transaction Number'); // Display Header info - if ($_POST['ReportType'] == 'Summary') { + if($_POST['ReportType'] == 'Summary') { $SortBy_Display = $Summary_Array[$SaveSummaryType]; } else { $SortBy_Display = $Detail_Array[$_POST['SortBy']]; } echo ' ' . _('Sales Inquiry') . ' - ' . $_POST['ReportType'] . ' ' . _('By') . ' ' . $SortBy_Display . '<br/>'; - if ($_POST['OrderType'] == '0') { + if($_POST['OrderType'] == '0') { echo ' ' . _('Order Type - Sales Orders') . '<br/>'; } else { echo ' ' . _('Order Type - Quotations') . '<br/>'; } echo ' ' . _('Date Type') . ' - ' . $_POST['DateType'] . '<br/>'; echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . ' ' . _('To') . ' ' . $_POST['ToDate'] . '<br/>'; - if (mb_strlen(trim($PartNumber)) > 0) { + if(mb_strlen(trim($PartNumber)) > 0) { echo ' ' . _('Stock Code') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; } - if (mb_strlen(trim($_POST['DebtorNo'])) > 0) { + if(mb_strlen(trim($_POST['DebtorNo'])) > 0) { echo ' ' . _('Customer Code') . ' - ' . $_POST['DebtorNoOp'] . ' ' . $_POST['DebtorNo'] . '<br/>'; } - if (mb_strlen(trim($_POST['DebtorName'])) > 0) { + if(mb_strlen(trim($_POST['DebtorName'])) > 0) { echo ' ' . _('Customer Name') . ' - ' . $_POST['DebtorNameOp'] . ' ' . $_POST['DebtorName'] . '<br/>'; } echo ' ' . _('Line Item Status') . ' - ' . $_POST['LineStatus'] . '<br/>'; @@ -811,16 +811,16 @@ echo ' ' . _('Sales Area') . ' - ' . $_POST['Area'] . '<br/>'; If ($_POST['DateType'] != 'Order') { $itype = 'All'; - if ($_POST['InvoiceType'] == '10') { + if($_POST['InvoiceType'] == '10') { $itype = 'Sales Invoice'; - } elseif ($_POST['InvoiceType'] == '11') { + } elseif($_POST['InvoiceType'] == '11') { $itype = 'Credit Notes'; } echo ' ' . _('Invoice Type') . ' - ' . $itype . '<br/>'; } echo '<br/><br/>'; - if ($_POST['ReportType'] == 'Detail') { - if ($_POST['DateType'] == 'Order') { + if($_POST['ReportType'] == 'Detail') { + if($_POST['DateType'] == 'Order') { printf('%10s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', _('Order No'), _('Stock Code'), @@ -860,7 +860,7 @@ $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; - if ($_POST['DateType'] == 'Order') { + if($_POST['DateType'] == 'Order') { printf('%10s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %14s | %12s | %-10s | %-10s | %-10s | %-40s ', $myrow['orderno'], $myrow['stkcode'], @@ -906,7 +906,7 @@ $TotalInvQty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - if ($_POST['DateType'] == 'Order') { + if($_POST['DateType'] == 'Order') { printf('%10s | %-20s | %10s | %-10s | %-30s | %-30s | %12s | %14s | %14s | %14s | %12s | %-10s | %-40s ', _('Totals'), _('Lines - ') . $linectr, @@ -944,50 +944,50 @@ $SummaryType = $_POST['SummaryType']; $columnheader7 = ' '; // Set up description based on the Summary Type - if ($SummaryType == 'name') { + if($SummaryType == 'name') { $SummaryType = 'name'; $Description = 'debtorno'; $SummaryHeader = _('Customer Name'); $Descriptionheader = _('Customer Code'); } - if ($SummaryType == 'stkcode' OR $SummaryType == 'extprice') { + if($SummaryType == 'stkcode' OR $SummaryType == 'extprice') { $Description = 'Description'; $SummaryHeader = _('Stock Code'); $Descriptionheader = _('Item Description'); } - if ($SummaryType == 'transno') { + if($SummaryType == 'transno') { $Description = 'name'; $SummaryHeader = _('Transaction Number'); $Descriptionheader = _('Customer Name'); $columnheader7 = _('Order Number'); } - if ($SummaryType == 'debtorno') { + if($SummaryType == 'debtorno') { $Description = 'name'; $SummaryHeader = _('Customer Code'); $Descriptionheader = _('Customer Name'); } - if ($SummaryType == 'orderno') { + if($SummaryType == 'orderno') { $Description = 'debtorno'; $SummaryHeader = _('Order Number'); $Descriptionheader = _('Customer Code'); $columnheader7 = _('Customer Name'); } - if ($SummaryType == 'categoryid') { + if($SummaryType == 'categoryid') { $Description = 'categorydescription'; $SummaryHeader = _('Stock Category'); $Descriptionheader = _('Category Description'); } - if ($SummaryType == 'salesman') { + if($SummaryType == 'salesman') { $Description = 'salesmanname'; $SummaryHeader = _('Salesman Code'); $Descriptionheader = _('Salesman Name'); } - if ($SummaryType == 'area') { + if($SummaryType == 'area') { $Description = 'areadescription'; $SummaryHeader = _('Sales Area'); $Descriptionheader = _('Area Description'); } - if ($SummaryType == 'month') { + if($SummaryType == 'month') { $Description = 'monthname'; $SummaryHeader = _('Month'); $Descriptionheader = _('Month'); @@ -1006,13 +1006,13 @@ $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; - if ($SummaryType == 'orderno') { + if($SummaryType == 'orderno') { $column7 = $myrow['name']; } - if ($SummaryType == 'transno') { + if($SummaryType == 'transno') { $column7 = $myrow['orderno']; } - if ($_POST['DateType'] == 'Order') { + if($_POST['DateType'] == 'Order') { // quantity is from salesorderdetails $DisplayQty = $myrow['quantity']; } else { @@ -1044,7 +1044,7 @@ locale_number_format($TotalInvQty,2), ' '); echo '</pre>'; - } // End of if ($_POST['ReportType'] + } // End of if($_POST['ReportType'] } // End of if inputerror != 1 } // End of function submit() @@ -1107,7 +1107,7 @@ <td>' . _('To') . ':</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '" /></td> </tr>'; - if (!isset($_POST['PartNumber'])){ + if(!isset($_POST['PartNumber'])) { $_POST['PartNumber']=''; } echo '<tr> @@ -1119,7 +1119,7 @@ <td> </td> <td><input type="text" name="PartNumber" size="20" maxlength="20" value="'. $_POST['PartNumber'] . '" /></td> </tr>'; - if (!isset($_POST['DebtorNo'])){ + if(!isset($_POST['DebtorNo'])) { $_POST['DebtorNo']=''; } echo '<tr> @@ -1131,7 +1131,7 @@ <td> </td> <td><input type="text" name="DebtorNo" size="10" maxlength="10" value="' . $_POST['DebtorNo'] . '" /></td> </tr>'; - if (!isset($_POST['DebtorName'])){ + if(!isset($_POST['DebtorName'])) { $_POST['DebtorName']=''; } echo '<tr> @@ -1143,7 +1143,7 @@ <td> </td> <td><input type="text" name="DebtorName" size="30" maxlength="30" value="' . $_POST['DebtorName'] .'" /></td> </tr>'; - if (!isset($_POST['OrderNo'])){ + if(!isset($_POST['OrderNo'])) { $_POST['OrderNo']=''; } echo '<tr> @@ -1169,7 +1169,7 @@ $CategoryResult= DB_query("SELECT categoryid, categorydescription FROM stockcategory"); echo '<option selected="selected" value="All">' . _('All Categories') . '</option>'; - While ($myrow = DB_fetch_array($CategoryResult)){ + while($myrow = DB_fetch_array($CategoryResult)) { echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } echo '</select></td> @@ -1177,7 +1177,7 @@ echo '<tr> <td>' . _('For Sales Person') . ':</td>'; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { echo '<td>'; echo $_SESSION['UsersRealName']; echo '</td>'; @@ -1185,8 +1185,8 @@ echo '<td><select name="Salesman">'; $sql="SELECT salesmancode, salesmanname FROM salesman"; $SalesmanResult= DB_query($sql); - echo '<option selected="selected" value="All">' . _('All Salesmen') . '</option>'; - While ($myrow = DB_fetch_array($SalesmanResult)){ + echo '<option selected="selected" value="All">' . _('All Salespeople') . '</option>'; + while($myrow = DB_fetch_array($SalesmanResult)) { echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>'; } echo '</select></td>'; @@ -1198,7 +1198,7 @@ <td><select name="Area">'; $AreasResult= DB_query("SELECT areacode, areadescription FROM areas"); echo '<option selected="selected" value="All">' . _('All Areas') . '</option>'; - While ($myrow = DB_fetch_array($AreasResult)){ + while($myrow = DB_fetch_array($AreasResult)) { echo '<option value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/SelectCustomer.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -206,7 +206,7 @@ echo '</td><td valign="top" class="select">'; // Customer transactions options: echo '<a href="', $RootPath, '/SelectSalesOrder.php?SelectedCustomer=', urlencode($_SESSION['CustomerID']), '">' . _('Modify Outstanding Sales Orders') . '</a><br />'; - echo '<a title="' . _('This allows the deposits received from the customer to be matched against invoices') . '" href="', $RootPath, '/CustomerAllocations.php?DebtorNo=', urlencode($_SESSION['CustomerID']), '">' . _('Allocate Receipts OR Credit Notes') . '</a><br />'; + echo '<a title="' . _('This allows the deposits received from the customer to be matched against invoices') . '" href="', $RootPath, '/CustomerAllocations.php?DebtorNo=', urlencode($_SESSION['CustomerID']), '">' . _('Allocate Receipts or Credit Notes') . '</a><br />'; if(isset($_SESSION['CustomerID']) AND isset($_SESSION['BranchCode'])) { echo '<a href="', $RootPath, '/CounterSales.php?DebtorNo=', urlencode($_SESSION['CustomerID']), '&BranchNo=' . $_SESSION['BranchCode'] . '">' . _('Create a Counter Sale for this Customer') . '</a><br />'; } Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2016-11-21 00:08:18 UTC (rev 7674) +++ trunk/WorkOrderEntry.php 2016-11-21 14:55:36 UTC (rev 7675) @@ -1,37 +1,38 @@ <?php - /* $Id$*/ +/* Entry of new work orders */ include('includes/session.inc'); $Title = _('Work Order Entry'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -echo '<p class="page_title_text"> - <img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title.' - </p>'; +echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme, + '/images/transactions.png" title="', // Icon image. + $Title, '" /> ', // Icon title. + $Title, '</p>';// Page title. -if (isset($_GET['WO'])) { +if(isset($_GET['WO'])) { $SelectedWO = $_GET['WO']; -} elseif (isset($_POST['WO'])){ +} elseif(isset($_POST['WO'])) { $SelectedWO = $_POST['WO']; } else { unset($SelectedWO); } -if (isset($_GET['ReqDate'])){ +if(isset($_GET['ReqDate'])) { $ReqDate = $_GET['ReqDate']; } else { $ReqDate=Date('Y-m-d'); } -if (isset($_GET['StartDate'])){ +if(isset($_GET['StartDate'])) { $StartDate = $_GET['StartDate']; } else { $StartDate=Date('Y-m-d'); } -if (isset($_GET['loccode'])){ +if(isset($_GET['loccode'])) { $LocCode = $_GET['loccode']; } else { $LocCode=$_SESSION['UserStockLocation']; @@ -44,7 +45,7 @@ WHERE locations.loccode='" . $LocCode . "'"); $LocRow = DB_fetch_array($LocResult); -if (is_null($LocRow['loccode']) OR $LocRow['loccode']==''){ +if(is_null($LocRow['loccode']) OR $LocRow['loccode']=='') { prnMsg(_('Your security settings do not allow you to create or update new Work Order at this location') . ' ' . $LocCode,'error'); echo '<br /><a href="' . $RootPath . '/SelectWorkOrder.php">' . _('Select an existing work order') . '</a>'; include('includes/footer.inc'); @@ -52,24 +53,24 @@ } foreach ($_POST as $key=>$value) { - if (substr($key, 0, 9)=='OutputQty' OR substr($key, 0, 7)=='RecdQty') { + if(substr($key, 0, 9)=='OutputQty' OR substr($key, 0, 7)=='RecdQty') { $_POST[$key] = filter_number_format($value); } } // check for new or modify condition -if (isset($SelectedWO) AND$SelectedWO!=''){ +if(isset($SelectedWO) AND$SelectedWO!='') { // modify $_POST['WO'] = (int)$SelectedWO; $EditingExisting = true; } else { - if (!isset($_POST['Ref'])) { + if(!isset($_POST['Ref'])) { $Ref = ''; } - if (!isset($_POST['Remark'])) { + if(!isset($_POST['Remark'])) { $Remark = ''; } - + // new $_POST['WO'] = GetNextTransNo(40,$db); $SQL = "INSERT INTO workorders (wo, @@ -89,34 +90,34 @@ } -if (isset($_GET['NewItem'])){ +if(isset($_GET['NewItem'])) { $NewItem = $_GET['NewItem']; } -if (isset($_GET['ReqQty'])){ +if(isset($_GET['ReqQty'])) { $ReqQty = $_GET['ReqQty']; } -if (!isset($_POST['StockLocation'])){ - if (isset($LocCode)){ +if(!isset($_POST['StockLocation'])) { + if(isset($LocCode)) { $_POST['StockLocation']=$LocCode; - } elseif (isset($_SESSION['UserStockLocation'])){ + } elseif(isset($_SESSION['UserStockLocation'])) { $_POST['StockLocation']=$_SESSION['UserStockLocation']; } } -if (isset($_POST['Search']) OR isset($_POST['Prev']) OR isset($_POST['Next'])){ +if(isset($_POST['Search']) OR isset($_POST['Prev']) OR isset($_POST['Next'])) { If ($_POST['Keywords'] AND $_POST['StockCode']) { prnMsg(_('Stock description keywords have been used in preference to the Stock code extract entered'),'warn'); } - if (mb_strlen($_POST['SO'])>0) { + if(mb_strlen($_POST['SO'])>0) { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, stockmaster.controlled, salesorderdetails.quantity - FROM salesorderdetails + FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid WHERE salesorderdetails.orderno='" . $_POST['SO'] . "' @@ -140,7 +141,7 @@ $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - if ($_POST['StockCat']=='All'){ + if($_POST['StockCat']=='All') { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, @@ -169,13 +170,13 @@ ORDER BY stockmaster.stockid"; } - } elseif (mb_strlen($_POST['StockCode'])>0){ + } elseif(mb_strlen($_POST['StockCode'])>0) { $_POST['StockCode'] = mb_strtoupper($_POST['StockCode']); $SearchString = '%' . $_POST['StockCode'] . '%'; /* Only items of stock type F finished goods or M - raw materials can have work orders created - raw materials can include the manufacture of components (as noted by Bob Thomas! */ - if ($_POST['StockCat']=='All'){ + if($_POST['StockCat']=='All') { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, @@ -204,7 +205,7 @@ ORDER BY stockmaster.stockid"; } } else { - if ($_POST['StockCat']=='All'){ + if($_POST['StockCat']=='All') { $SQL = "SELECT stockmaster.stockid, stockmaster.description, stockmaster.units, @@ -242,26 +243,26 @@ DB_free_result($SearchResult); unset($SearchResult); $ListCount = $myrow[0]; - if ($ListCount>0){ + if($ListCount>0) { $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax'])-1; } else { $ListPageMax =1; } - if (isset($_POST['Next'])) { + if(isset($_POST['Next'])) { $Offset = $_POST['CurrPage']+1; } - if (isset($_POST['Prev'])) { + if(isset($_POST['Prev'])) { $Offset = $_POST['CurrPage']-1; } - if (!isset($Offset)) { + if(!isset($Offset)) { $Offset=0; } - if($Offset<0){ + if($Offset<0) { $Offset=0; } - if($Offset>$ListPageMax){ + if($Offset>$ListPageMax) { $Offset=$ListPageMax; } $SQL = $SQL . ' LIMIT ' . $_SESSION['DisplayRecordsMax'].' OFFSET ' . strval($_SESSION['DisplayRecordsMax']*$Offset); @@ -271,29 +272,29 @@ $DbgMsg = _('The SQL used to get the part selection was'); $SearchResult = DB_query($SQL,$ErrMsg, $DbgMsg); - if (DB_num_rows($SearchResult)==0 ){ + if(DB_num_rows($SearchResult)==0 ) { prnMsg (_('There are no products available meeting the criteria specified'),'info'); - if ($debug==1){ + if($debug==1) { prnMsg(_('The SQL statement used was') . ':<br />' . $SQL,'info'); } } - if (DB_num_rows($SearchResult)==1){ + if(DB_num_rows($SearchResult)==1) { $myrow=DB_fetch_array($SearchResult); $NewItem = $myrow['stockid']; - if (isset($myrow['quantity'])) { + if(isset($myrow['quantity'])) { $ReqQty = $myrow['quantity']; } DB_data_seek($SearchResult,0); } } //end of if search -if (isset($_POST['Add'])) { - foreach($_POST as $key=>$value){ - if (strpos($key,'Check_')!==false){ +if(isset($_POST['Add'])) { + foreach($_POST as $key=>$value) { + if(strpos($key,'Check_')!==false) { $NewItem[] = array('item'=>$value,'qty'=>0); } - if (strpos($key,'Qty_') !== false AND $value>0) { + if(strpos($key,'Qty_') !== false AND $value>0) { $No = substr($key,4); $NewItem[] = array('item'=>$_POST['Item_'.$No],'qty'=>$value); } @@ -301,25 +302,25 @@ } -if (isset($NewItem) AND isset($_POST['WO'])){ - if (!is_array($NewItem)) { +if(isset($NewItem) AND isset($_POST['WO'])) { + if(!is_array($NewItem)) { $InputError=false; $CheckItemResult = DB_query("SELECT mbflag, eoq, controlled FROM stockmaster WHERE stockid='" . $NewItem . "'"); - if (DB_num_rows($CheckItemResult)==1){ + if(DB_num_rows($CheckItemResult)==1) { $CheckItemRow = DB_fetch_array($CheckItemResult); - if ($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1){ //need to add serial nos or batches to determine quantity + if($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity $EOQ = 0; } else { - if (!isset($ReqQty)) { + if(!isset($ReqQty)) { $ReqQty=$CheckItemRow['eoq']; } $EOQ = $ReqQty; } - if ($CheckItemRow['mbflag']!='M'){ + if($CheckItemRow['mbflag']!='M') { prnMsg(_('The item selected cannot be added to a work order because it is not a manufactured item'),'warn'); $InputError=true; } @@ -331,13 +332,13 @@ FROM woitems WHERE stockid='" . $NewItem . "' AND wo='" .$_POST['WO'] . "'"); - if (DB_num_rows($CheckItemResult)==1){ + if(DB_num_rows($CheckItemResult)==1) { prnMsg(_('This item is already on the work order and cannot be added again'),'warn'); $InputError=true; } - if ($InputError==false){ + if($InputError==false) { $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, bom.loccode FROM stockmaster @@ -348,16 +349,16 @@ AND bom.effectiveafter<='" . Date('Y-m-d') . "' AND bom.effectiveto>='" . Date('Y-m-d') . "'"); $CostRow = DB_fetch_array($CostResult); - if (is_null($CostRow['cost'])){ + if(is_null($CostRow['cost'])) { $Cost =0; prnMsg(_('The cost of this item as accumulated from the sum of the component costs is nil. This could be because there is no bill of material set up ... you may wish to double check this'),'warn'); - } elseif ($CostRow['cost'] == 0) { + } elseif($CostRow['cost'] == 0) { $Cost = 0; prnMsg(_('The cost of this item as accumulated from the sum of the component costs is zero'),'warn'); } else { $Cost = $CostRow['cost']; } - if (!isset($EOQ)){ + if(!isset($EOQ)) { $EOQ=1; } @@ -388,7 +389,7 @@ DB_txn_begin($db); foreach ($NewItem as $ItemDetail) { $Itm = $ItemDetail['item']; - if ($ItemDetail['qty']>0) { + if($ItemDetail['qty']>0) { $ReqQty = $ItemDetail['qty']; } $InputError=false; @@ -398,17 +399,17 @@ FROM stockmaster WHERE stockid='" . $Itm . "'", $db); - if (DB_num_rows($CheckItemResult)==1){ + if(DB_num_rows($CheckItemResult)==1) { $CheckItemRow = DB_fetch_array($CheckItemResult); - if ($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1){ //need to add serial nos or batches to determine quantity + if($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity $EOQ = 0; } else { - if (!isset($ReqQty)) { + if(!isset($ReqQty)) { $ReqQty=$CheckItemRow['eoq']; } $EOQ = $ReqQty; } - if ($CheckItemRow['mbflag']!='M'){ + if($CheckItemRow['mbflag']!='M') { prnMsg(_('The item selected cannot be added to a work order because it is not a manufactured item'),'warn'); $InputError=true; } @@ -421,13 +422,13 @@ WHERE stockid='" . $Itm . "' AND wo='" .$_POST['WO'] . "'" ); - if (DB_num_rows($CheckItemResult)==1){ + if(DB_num_rows($CheckItemResult)==1) { prnMsg(_('This item is already on the work order and cannot be added again'),'warn'); $InputError=true; } - if ($InputError==false){ + if($InputError==false) { $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, bom.loccode FROM stockmaster @@ -438,18 +439,18 @@ AND bom.effectiveafter<='" . Date('Y-m-d') . "' AND bom.effectiveto>='" . Date('Y-m-d') . "'", $db); - + $CostRow = DB_fetch_array($CostResult); - if (is_null($CostRow['cost'])){ + if(is_null($CostRow['cost'])) { $Cost =0; prnMsg(_('The cost of this item as accumulated from the sum of the component costs is nil. This could be because there is no bill of material set up ... you may wish to double check this'),'warn'); - } elseif ($CostRow['cost'] == 0) { + } elseif($CostRow['cost'] == 0) { $Cost = 0; prnMsg(_('The The cost of this item as accumulated from the sum of the component costs is zero'),'warn'); } else { $Cost = $CostRow['cost']; } - if (!isset($EOQ)){ + if(!isset($EOQ)) { $EOQ=1; } @@ -474,45 +475,45 @@ DB_txn_rollback($db); } }//end of foreach loop; - + DB_txn_commit($db); unset($NewItem); } } //adding a new item to the work order -if (isset($_POST['submit']) OR isset($_POST['Search'])) { //The update button has been clicked +if(isset($_POST['submit']) OR isset($_POST['Search'])) { //The update button has been click... [truncated message content] |