From: <ex...@us...> - 2016-07-27 07:19:18
|
Revision: 7574 http://sourceforge.net/p/web-erp/reponame/7574 Author: exsonqu Date: 2016-07-27 07:19:16 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. Modified Paths: -------------- trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2016-07-27 07:03:27 UTC (rev 7573) +++ trunk/SelectOrderItems.php 2016-07-27 07:19:16 UTC (rev 7574) @@ -1025,7 +1025,11 @@ /*There is a new price being input for the line item */ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); + if ($_POST['Discount_' . $OrderLine->LineNumber] < 100) {//to avoid divided by zero error $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100)/100); + } else { + $_POST['GPPercent_' . $OrderLine->LineNumber] = 0; + } } elseif (ABS($OrderLine->GPPercent - filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]))>=0.01) { /* A GP % has been input so need to do a recalculation of the price at this new GP Percentage */ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 07:03:27 UTC (rev 7573) +++ trunk/doc/Change.log 2016-07-27 07:19:16 UTC (rev 7574) @@ -1,5 +1,6 @@ webERP Change Log +27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. 25/07/16 Exson: Add InternalStockRequestInquiry.php script. 22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php |
From: <ex...@us...> - 2016-07-27 09:27:08
|
Revision: 7575 http://sourceforge.net/p/web-erp/reponame/7575 Author: exsonqu Date: 2016-07-27 09:27:05 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. Modified Paths: -------------- trunk/Credit_Invoice.php trunk/doc/Change.log Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2016-07-27 07:19:16 UTC (rev 7574) +++ trunk/Credit_Invoice.php 2016-07-27 09:27:05 UTC (rev 7575) @@ -230,7 +230,7 @@ if(isset($_POST['ChargeFreightCost'])) { $_SESSION['CreditItems' . $identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); - if (($TotalQtyCredit + abs($_POST['ChargeFreightCost']))<=0) { + if (($TotalQtyCredited + abs($_POST['ChargeFreightCost']))<=0) { prnMsg(_('There are no item quantity or freight charge input'),'error'); if (isset($_POST['ProcessCredit'])) { unset($_POST['ProcessCredit']); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 07:19:16 UTC (rev 7574) +++ trunk/doc/Change.log 2016-07-27 09:27:05 UTC (rev 7575) @@ -1,5 +1,5 @@ webERP Change Log - +27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. 25/07/16 Exson: Add InternalStockRequestInquiry.php script. |
From: <ex...@us...> - 2016-07-27 10:10:06
|
Revision: 7576 http://sourceforge.net/p/web-erp/reponame/7576 Author: exsonqu Date: 2016-07-27 10:10:03 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php Modified Paths: -------------- trunk/WorkOrderCosting.php trunk/WorkOrderIssue.php trunk/doc/Change.log Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/WorkOrderCosting.php 2016-07-27 10:10:03 UTC (rev 7576) @@ -413,14 +413,18 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } + if ($TotalOnHand>0) {//to avoid negative quantity make cost data abnormal + $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand; + } else { + $NewCost = $WORow['currcost']; + } - $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand; - $SQL = "UPDATE stockmaster SET materialcost='" . $NewCost . "', labourcost=0, overheadcost=0, - lastcost='" . $WORow['currcost'] . "' + lastcost='" . $WORow['currcost'] . "', + lastcostupdate = '" . Date('Y-m-d') . "' WHERE stockid='" . $WORow['stockid'] . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); @@ -515,9 +519,9 @@ } // end loop around the items on the work order $CloseWOResult =DB_query("UPDATE workorders SET closed=1, closecomments = '". $_POST['CloseComments'] ."' WHERE wo='" .$_POST['WO'] . "'", - _('Could not update the work order to closed because:'), - _('The SQL used to close the work order was:'), - true); + _('Could not update the work order to closed because:'), + _('The SQL used to close the work order was:'), + true); $DeleteAnyWOSerialNos = DB_query("DELETE FROM woserialnos WHERE wo='" . $_POST['WO'] . "'", _('Could not delete the predefined work order serial numbers'), _('The SQL used to delete the predefined serial numbers was:'), @@ -550,7 +554,6 @@ echo '<tr> <td colspan="9"> - <div class="centre"> <textarea ' . $ReadOnly . ' style="width:100%" rows="5" cols="80" name="CloseComments" >' . $_POST['CloseComments'] . '</textarea> </div> Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/WorkOrderIssue.php 2016-07-27 10:10:03 UTC (rev 7576) @@ -87,10 +87,10 @@ $Result = DB_query($SQL); $IssueItemRow = DB_fetch_array($Result); //now lets get the decimalplaces needed - if ($IssueItemRow['decimalplaces'] <=4) { + if ($IssueItemRow['decimalplaces'] <=3) { $VarianceAllowed = 0.0001; } else { - $VarianceAllowed = pow(10,-$IssueItemRow['decimalplaces']); + $VarianceAllowed = pow(10,-(1+$IssueItemRow['decimalplaces'])); } $QuantityIssued =0; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/doc/Change.log 2016-07-27 10:10:03 UTC (rev 7576) @@ -1,4 +1,6 @@ webERP Change Log + +27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. |
From: <ex...@us...> - 2016-08-02 06:29:21
|
Revision: 7577 http://sourceforge.net/p/web-erp/reponame/7577 Author: exsonqu Date: 2016-08-02 06:29:19 +0000 (Tue, 02 Aug 2016) Log Message: ----------- 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. Modified Paths: -------------- trunk/SelectGLAccount.php trunk/doc/Change.log Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2016-07-27 10:10:03 UTC (rev 7576) +++ trunk/SelectGLAccount.php 2016-08-02 06:29:19 UTC (rev 7577) @@ -52,6 +52,10 @@ chartmaster.accountcode"; } elseif (mb_strlen($_POST['GLCode'])>0){ + if (!empty($_POST['GLCode'])) { + header('location:' . $RootPath . '/GLAccountInquiry.php?Account=' . $_POST['GLCode'] . '&Show=Yes'); + exit; + } $SQL = "SELECT chartmaster.accountcode, chartmaster.accountname, @@ -69,6 +73,11 @@ } if (isset($SQL) and $SQL!=''){ $result = DB_query($SQL); + if (DB_num_rows($result) == 1) { + $AccountRow = DB_fetch_row($result); + header('location:' . $RootPath . '/GLAccountInquiry.php?Account=' . $AccountRow[0] . '&Show=Yes'); + exit; + } } } //end of if search @@ -178,4 +187,4 @@ } //end AccountID already selected include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 10:10:03 UTC (rev 7576) +++ trunk/doc/Change.log 2016-08-02 06:29:19 UTC (rev 7577) @@ -1,5 +1,5 @@ webERP Change Log - +02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. |
From: <ex...@us...> - 2016-08-02 10:02:34
|
Revision: 7578 http://sourceforge.net/p/web-erp/reponame/7578 Author: exsonqu Date: 2016-08-02 10:02:32 +0000 (Tue, 02 Aug 2016) Log Message: ----------- 02/08/16 Exson: Make GLJournalInquiry.php workable for all transaction types and printable. Merge Chinese format GL Journal from cncerp. Modified Paths: -------------- trunk/GLJournalInquiry.php trunk/PDFGLJournal.php trunk/includes/PDFStarter.php trunk/includes/tcpdf/include/tcpdf_static.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Added Paths: ----------- trunk/PDFGLJournalCN.php trunk/includes/PDFGLJournalHeaderCN.inc Modified: trunk/GLJournalInquiry.php =================================================================== --- trunk/GLJournalInquiry.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/GLJournalInquiry.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -17,11 +17,28 @@ echo '<table class="selection">'; echo '<tr><th colspan="3">' . _('Selection Criteria') . '</th></tr>'; - $sql = "SELECT typeno FROM systypes WHERE typeid=0"; + $sql = "SELECT typeid,systypes.typeno,typename FROM + systypes INNER JOIN gltrans ON systypes.typeid=gltrans.type + GROUP BY typeid"; $result = DB_query($sql); - $myrow = DB_fetch_array($result); - $MaxJournalNumberUsed = $myrow['typeno']; + if (DB_num_rows($result)>0) { + echo '<tr> + <td>' . _('Transaction Type') . ' </td> + <td> <select name="TransType">'; + while ($myrow = DB_fetch_array($result)) { + if (!isset($MaxJournalNumberUsed)) { + $MaxJournalNumberUsed = $myrow['typeno']; + } else { + $MaxJournalNumberUsed = ($myrow['typeno']>$MaxJournalNumberUsed)?$myrow['typeno']:$MaxJournalNumberUsed; + } + echo '<option value="' . $myrow['typeid'] . '">' . _($myrow['typename']) . '</option>'; + } + echo '</select></td> + </tr>'; + + } + echo '<tr> <td>' . _('Journal Number Range') . ' (' . _('Between') . ' 1 ' . _('and') . ' ' . $MaxJournalNumberUsed . ')</td> <td>' . _('From') . ':'. '<input type="text" class="number" name="NumberFrom" size="10" maxlength="11" value="1" />' . '</td> @@ -64,7 +81,7 @@ ON gltrans.account=chartmaster.accountcode LEFT JOIN tags ON gltrans.tag=tags.tagref - WHERE gltrans.type='0' + WHERE gltrans.type='" . $_POST['TransType'] . "' AND gltrans.trandate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' AND gltrans.trandate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' AND gltrans.typeno>='" . $_POST['NumberFrom'] . "' @@ -87,7 +104,7 @@ </tr>'; $LastJournal = 0; - + $i = 0; while ($myrow = DB_fetch_array($result)){ if ($myrow['tag']==0) { @@ -95,12 +112,21 @@ } if ($myrow['typeno']!=$LastJournal) { - echo '<tr><td colspan="8"</td></tr><tr> + if ($i == 0) { + $RowClass = 'class="OddTableRows"'; + $i = 1; + } else { + $RowClass = 'class="EvenTableRows"'; + $i = 0; + } + + echo '<tr ' . $RowClass . '><td colspan="8"></td></tr><tr> + <tr ' . $RowClass . '> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . $myrow['typeno'] . '</td>'; } else { - echo '<tr><td colspan="2"></td>'; + echo '<tr ' . $RowClass . '><td colspan="2"></td>'; } // if user is allowed to see the account we show it, other wise we show "OTHERS ACCOUNTS" @@ -125,9 +151,15 @@ <td class="number">' . locale_number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $myrow['tag'] . ' - ' . $myrow['tagdescription'] . '</td>'; - if ($myrow['typeno']!=$LastJournal) { - echo '<td class="number"><a href="PDFGLJournal.php?JournalNo='.$myrow['typeno'].'">' . _('Print') . '</a></td></tr>'; - + if ($myrow['typeno']!=$LastJournal AND $CheckRow[0]>0) { + if ($_SESSION['Language'] == 'zh_CN.utf8' OR $_SESSION['Language'] =='zh_hk.utf8') { + echo '<td class="number"><a href="PDFGLJournalCN.php?JournalNo='.$myrow['typeno'].'&Type=' . $_POST['TransType'] . '">' . _('Print') . '</a></td></tr>'; + } else { + echo '<td class="number"><a href="PDFGLJournal.php?JournalNo='.$myrow['typeno'].'">' . _('Print') . '</a></td></tr>'; + } + + + $LastJournal = $myrow['typeno']; } else { echo '<td colspan="1"></td></tr>'; @@ -144,4 +176,4 @@ } include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/PDFGLJournal.php =================================================================== --- trunk/PDFGLJournal.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/PDFGLJournal.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -8,11 +8,18 @@ if (isset($_POST['JournalNo'])) { $JournalNo=$_POST['JournalNo']; + $Type = $_POST['Type']; } else if (isset($_GET['JournalNo'])) { $JournalNo=$_GET['JournalNo']; + $Type = $_GET['Type']; } else { $JournalNo=''; } +if (empty($JournalNo) OR empty($Type)) { + prnMsg(_('This page should be called with Journal No and Type'),'error'); + include('includes/footer.inc'); + exit; +} if ($JournalNo=='Preview') { $FormDesign = simplexml_load_file(sys_get_temp_dir().'/Journal.xml'); @@ -44,8 +51,9 @@ ON gltrans.account=chartmaster.accountcode LEFT JOIN tags ON gltrans.tag=tags.tagref - WHERE gltrans.type='0' + WHERE gltrans.type='" . $Type . "' AND gltrans.typeno='" . $JournalNo . "'"; + $result=DB_query($sql); $LineCount = DB_num_rows($result); // UldisN $myrow=DB_fetch_array($result); @@ -104,4 +112,4 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Journal_' . date('Y-m-d').'.pdf');//UldisN $pdf->__destruct(); //UldisN } -?> \ No newline at end of file +?> Added: trunk/PDFGLJournalCN.php =================================================================== --- trunk/PDFGLJournalCN.php (rev 0) +++ trunk/PDFGLJournalCN.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -0,0 +1,156 @@ +<?php /* $Id$*/ + +/* $Revision: 1.5 $2012.2CQZ二次修改 */ + +include('includes/session.inc'); +if (isset($_POST['JournalNo'])) { + $JournalNo=$_POST['JournalNo']; + $TypeID=$_POST['Type']; +} else if (isset($_GET['JournalNo'])) { + $JournalNo=$_GET['JournalNo']; + $TypeID=$_GET['Type']; +} else { + $JournalNo=''; + $TypeID=''; +} +if ($JournalNo=='Preview') { + $FormDesign = simplexml_load_file(sys_get_temp_dir().'/Journalc.xml'); +} else { + $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/Journalc.xml'); +} + +// Set the paper size/orintation +$PaperSize = $FormDesign->PaperSize; +$PageNumber=1; +$line_height=$FormDesign->LineHeight; +include('includes/PDFStarter.php'); +$pdf->addInfo('Title', _('中国(甲式10)会计凭证') ); +$pdf->addInfo('Author','webERP ' . 'CQZ二次修改'); +$pdf->addInfo('Subject',_('会计凭证——中国式会计凭证--登录ERP打印或下载此凭证的用户:').$_SESSION['UsersRealName']); +$pdf->SetProtection(array('modify','copy','annot-forms'), ''); + +if ($JournalNo=='Preview') { + $LineCount = 2; // UldisN +} else { + $sql="SELECT gltrans.type, + gltrans.typeno, + gltrans.trandate, + gltrans.account, + systypes.typename, + chartmaster.accountname, + gltrans.narrative, + gltrans.amount, + gltrans.tag, + tags.tagdescription, + gltrans.jobref + FROM gltrans + INNER JOIN chartmaster + ON gltrans.account=chartmaster.accountcode + INNER JOIN systypes + ON gltrans.type=systypes.typeid + LEFT JOIN tags + ON gltrans.tag=tags.tagref + WHERE gltrans.type='".$TypeID."' + AND gltrans.typeno='" . $JournalNo . "'"; + $result=DB_query($sql); + $LineCount = DB_num_rows($result); // UldisN + $myrow=DB_fetch_array($result); + $JournalDate=$myrow['trandate']; + DB_data_seek($result, 0); + $Typemame=$myrow['typename']; + include('includes/PDFGLJournalHeaderCN.inc'); +} +$counter=1; +$YPos=$FormDesign->Data->y; +while ($counter<=$LineCount) { + if ($JournalNo=='Preview') { + $AccountCode=str_pad('',10,'x'); + $Date='1/1/1900'; + $Description=str_pad('',30,'x'); + $Narrative=str_pad('',30,'x'); + $Amount='XXXX.XX'; + $Tag=str_pad('',25,'x'); + $JobRef=str_pad('',25,'x'); + } else { + $myrow=DB_fetch_array($result); + if ($myrow['tag']==0) { + $myrow['tagdescription']='None'; + } + $AccountCode = $myrow['account']; + $Description = $myrow['accountname']; + $Date = $myrow['trandate']; + $Narrative = $myrow['narrative']; + $Amount = $myrow['amount']; + $Tag = $myrow['tag'].' - '.$myrow['tagdescription']; + $JobRef = $myrow['jobref']; + } + + if ( $myrow['amount'] > 0) { + $DebitAmount = locale_number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); + $DebitTotal += $myrow['amount']; + $CreditAmount = ' '; + } else { + $CreditAmount = locale_number_format(-$myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); + $CreditTotal += $myrow['amount']; + $DebitAmount = ' '; + } + $pdf->SetTextColor(0,0,0); + if((mb_strlen($Narrative,'GB2312')+ substr_count($Narrative," "))>40){ + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x+3,$Page_Height-$YPos-5,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $Narrative); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x+3,$Page_Height-$YPos+3,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $AccountCode); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x+3,$Page_Height-$YPos+3,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Description); + }else{ + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x+3,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $Narrative); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x+3,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $AccountCode); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x+3,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Description); + } + $pdf->SetFont('helvetica', '', 10); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x+3,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize,$DebitAmount , 'right'); + + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x+3,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $CreditAmount, 'right'); + + + $YPos += $line_height; + $counter++; + + $DebitTotal1=locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces'], 'right'); + $CreditTotal1=locale_number_format(-$CreditTotal,$_SESSION['CompanyRecord']['decimalplaces'], 'right'); + + $pdf->SetFont('javiergb', '', 10); + + if ($YPos >= $FormDesign->LineAboveFooter->starty){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$FormDesign->Data->y; + include ('includes/PDFGLJournalHeaderCN.inc'); + } +} +$pdf->setlineStyle(array('width'=>0.8)); +$pdf->SetLineStyle(array('color'=>array(0,0,0))); +$pdf->Line($XPos=540, $Page_Height-$YPos+15, $FormDesign->Column33->endx,$Page_Height - $FormDesign->Column33->endy); + +//end if need a new page headed up + + +//$pdf->addJpegFromFile('hjje.jpg',$FormDesign->Headings->Column7->x+3+20,$Page_Height - 282,110,28); +$pdf->SetTextColor(0,0,255); +$pdf->addText($FormDesign->Headings->Column7->x+3,$Page_Height-$FormDesign->Headings->Column7->y,$FormDesign->Headings->Column7->FontSize, _('合 计 金 额'));//$FormDesign->Headings->Column7->name +$pdf->SetTextColor(0,0,0); +$pdf->SetFont('helvetica', '', 10); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column8->x+3,$Page_Height - $FormDesign->Headings->Column8->y, $FormDesign->Headings->Column8->Length,$FormDesign->Headings->Column8->FontSize, $DebitTotal1, 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column9->x+3,$Page_Height - $FormDesign->Headings->Column9->y, $FormDesign->Headings->Column9->Length,$FormDesign->Headings->Column9->FontSize, $CreditTotal1, 'right'); +$pdf->SetFont('javiergb', '', 10); + +if ($LineCount == 0) { //UldisN + $title = _('GRN Error'); + include('includes/header.inc'); + prnMsg(_('There were no GRN to print'),'warn'); + echo '<br /><a href="'.$rootpath.'/index.php">'. _('Back to the menu').'</a>'; + include('includes/footer.inc'); + exit; +} else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN +} +?> + Added: trunk/includes/PDFGLJournalHeaderCN.inc =================================================================== --- trunk/includes/PDFGLJournalHeaderCN.inc (rev 0) +++ trunk/includes/PDFGLJournalHeaderCN.inc 2016-08-02 10:02:32 UTC (rev 7578) @@ -0,0 +1,124 @@ +<?php +/* $Id$*/ +/*PDF page header for price list report */ +if ($PageNumber>1){ + $pdf->newPage(); +} + +$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x+3,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); +$pdf->SetTextColor(0,0,255); +$LeftOvers = $pdf->addText($FormDesign->CompanyName->x+3,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber2->x+3,$Page_Height-$FormDesign->GRNNumber2->y,$FormDesign->GRNNumber2->FontSize, '凭证类型:'.$Typemame,'right' ); +$JournalNo=str_pad($JournalNo, 9, '0', STR_PAD_LEFT); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber->x+3,$Page_Height-$FormDesign->GRNNumber->y,$FormDesign->GRNNumber->FontSize, '凭证编号:'.$JournalNo,'right' ); +$LeftOvers = $pdf->addText($FormDesign->OrderNumber->x+3,$Page_Height-$FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, '记 账 凭 证 '); +$LeftOvers = $pdf->addText($FormDesign->PrintDate->x+3,$Page_Height-$FormDesign->PrintDate->y,$FormDesign->PrintDate->FontSize, _('Printed').':' . Date($_SESSION['DefaultDateFormat']), 'right'); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +/*Draw a rectangle to put the headings in */ +$pdf->Rectangle($FormDesign->HeaderRectangle->x+3, $Page_Height - $FormDesign->HeaderRectangle->y, $FormDesign->HeaderRectangle->width,$FormDesign->HeaderRectangle->height); + +/*set up the headings */ +$LeftOvers = $pdf->addText($FormDesign->Headings->Column1->x+3,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, '摘 要'); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column2->x+3,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, '科目代码'); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column3->x+3,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, '科目名称'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x+3,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->Length,$FormDesign->Headings->Column4->FontSize, '借方金额 贷方金额', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x+3,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->Length,$FormDesign->Headings->Column5->FontSize, '千百十万千.百十元角分', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column6->x+3,$Page_Height - $FormDesign->Headings->Column6->y, $FormDesign->Headings->Column6->Length,$FormDesign->Headings->Column6->FontSize, '千百十万千.百十元角分', 'right'); + + + +$LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x+3,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, '记账日期: '.ConvertSQLDate($JournalDate)); + +$tmpX=$FormDesign->SignedFor->x+3; +$tmpY=$Page_Height-$FormDesign->SignedFor->y; +$tmpFz=$FormDesign->SignedFor->FontSize; +$LeftOvers = $pdf->addText($tmpX,$tmpY,$tmpFz, '会计主管:'); +$LeftOvers = $pdf->addText($tmpX+220,$tmpY,$tmpFz, '复核:'); +$LeftOvers = $pdf->addText($tmpX+405,$tmpY,$tmpFz, '制单:'); + +if ($JournalNo=='Preview') { + $realname = 'cncerp'; +} else { + //list($userid,$realname,$stepdate)=getTransBy($TypeID,$JournalNo);// +} +$pdf->addText($tmpX+430,$tmpY,$tmpFz, $realname); + +$pdf->addText($tmpX+50,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+250,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+335,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+450,$tmpY,$tmpFz, ''); + +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column7->x+3,$Page_Height - $FormDesign->Headings->Column7->y, $FormDesign->Headings->Column7->Length,$FormDesign->Headings->Column7->FontSize, '过次页', 'right'); +/*Draw a rectangle to put the data in */ +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->Rectangle($FormDesign->DataRectangle->x+3, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->Line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx,$Page_Height - $FormDesign->LineAboveFooter->endy); + +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->Line($FormDesign->Column1->startx, $Page_Height - $FormDesign->Column1->starty, $FormDesign->Column1->endx,$Page_Height - $FormDesign->Column1->endy); +$pdf->Line($FormDesign->Column2->startx, $Page_Height - $FormDesign->Column2->starty, $FormDesign->Column2->endx,$Page_Height - $FormDesign->Column2->endy); +$pdf->Line($FormDesign->Column3->startx, $Page_Height - $FormDesign->Column3->starty, $FormDesign->Column3->endx,$Page_Height - $FormDesign->Column3->endy); +$pdf->Line($FormDesign->Column4->startx, $Page_Height - $FormDesign->Column4->starty, $FormDesign->Column4->endx,$Page_Height - $FormDesign->Column4->endy); +$pdf->Line($FormDesign->Column5->startx, $Page_Height - $FormDesign->Column5->starty, $FormDesign->Column5->endx,$Page_Height - $FormDesign->Column5->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column6->startx, $Page_Height - $FormDesign->Column6->starty, $FormDesign->Column6->endx,$Page_Height - $FormDesign->Column6->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column7->startx, $Page_Height - $FormDesign->Column7->starty, $FormDesign->Column7->endx,$Page_Height - $FormDesign->Column7->endy); +$pdf->Line($FormDesign->Column8->startx, $Page_Height - $FormDesign->Column8->starty, $FormDesign->Column8->endx,$Page_Height - $FormDesign->Column8->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column9->startx, $Page_Height - $FormDesign->Column9->starty, $FormDesign->Column9->endx,$Page_Height - $FormDesign->Column9->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column10->startx, $Page_Height - $FormDesign->Column10->starty, $FormDesign->Column10->endx,$Page_Height - $FormDesign->Column10->endy); +$pdf->Line($FormDesign->Column11->startx, $Page_Height - $FormDesign->Column11->starty, $FormDesign->Column11->endx,$Page_Height - $FormDesign->Column11->endy); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(255,50,0))); +$pdf->Line($FormDesign->Column12->startx, $Page_Height - $FormDesign->Column12->starty, $FormDesign->Column12->endx,$Page_Height - $FormDesign->Column12->endy); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +$pdf->Line($FormDesign->Column13->startx, $Page_Height - $FormDesign->Column13->starty, $FormDesign->Column13->endx,$Page_Height - $FormDesign->Column13->endy); +$pdf->Line($FormDesign->Column14->startx, $Page_Height - $FormDesign->Column14->starty, $FormDesign->Column14->endx,$Page_Height - $FormDesign->Column14->endy); +$pdf->Line($FormDesign->Column15->startx, $Page_Height - $FormDesign->Column15->starty, $FormDesign->Column15->endx,$Page_Height - $FormDesign->Column15->endy); +$pdf->Line($FormDesign->Column16->startx, $Page_Height - $FormDesign->Column16->starty, $FormDesign->Column16->endx,$Page_Height - $FormDesign->Column16->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column17->startx, $Page_Height - $FormDesign->Column17->starty, $FormDesign->Column17->endx,$Page_Height - $FormDesign->Column17->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column18->startx, $Page_Height - $FormDesign->Column18->starty, $FormDesign->Column18->endx,$Page_Height - $FormDesign->Column18->endy); +$pdf->Line($FormDesign->Column19->startx, $Page_Height - $FormDesign->Column19->starty, $FormDesign->Column19->endx,$Page_Height - $FormDesign->Column19->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column20->startx, $Page_Height - $FormDesign->Column20->starty, $FormDesign->Column20->endx,$Page_Height - $FormDesign->Column20->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column21->startx, $Page_Height - $FormDesign->Column21->starty, $FormDesign->Column21->endx,$Page_Height - $FormDesign->Column21->endy); +$pdf->Line($FormDesign->Column22->startx, $Page_Height - $FormDesign->Column22->starty, $FormDesign->Column22->endx,$Page_Height - $FormDesign->Column22->endy); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(255,50,0))); +$pdf->Line($FormDesign->Column23->startx, $Page_Height - $FormDesign->Column23->starty, $FormDesign->Column23->endx,$Page_Height - $FormDesign->Column23->endy); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +$pdf->Line($FormDesign->Column24->startx, $Page_Height - $FormDesign->Column24->starty, $FormDesign->Column24->endx,$Page_Height - $FormDesign->Column24->endy); + +$pdf->Line($FormDesign->Column25->startx, $Page_Height - $FormDesign->Column25->starty, $FormDesign->Column25->endx,$Page_Height - $FormDesign->Column25->endy); +$pdf->Line($FormDesign->Column26->startx, $Page_Height - $FormDesign->Column26->starty, $FormDesign->Column26->endx,$Page_Height - $FormDesign->Column26->endy); +$pdf->Line($FormDesign->Column27->startx, $Page_Height - $FormDesign->Column27->starty, $FormDesign->Column27->endx,$Page_Height - $FormDesign->Column27->endy); +$pdf->Line($FormDesign->Column28->startx, $Page_Height - $FormDesign->Column28->starty, $FormDesign->Column28->endx,$Page_Height - $FormDesign->Column28->endy); +$pdf->Line($FormDesign->Column29->startx, $Page_Height - $FormDesign->Column29->starty, $FormDesign->Column29->endx,$Page_Height - $FormDesign->Column29->endy); +$pdf->Line($FormDesign->Column30->startx, $Page_Height - $FormDesign->Column30->starty, $FormDesign->Column30->endx,$Page_Height - $FormDesign->Column30->endy); +$pdf->Line($FormDesign->Column31->startx, $Page_Height - $FormDesign->Column31->starty, $FormDesign->Column31->endx,$Page_Height - $FormDesign->Column31->endy); +$pdf->Line($FormDesign->Column32->startx, $Page_Height - $FormDesign->Column32->starty, $FormDesign->Column32->endx,$Page_Height - $FormDesign->Column32->endy); +$pdf->Line($FormDesign->Column34->startx, $Page_Height - $FormDesign->Column34->starty, $FormDesign->Column34->endx,$Page_Height - $FormDesign->Column34->endy); +$pdf->Line($FormDesign->Column35->startx, $Page_Height - $FormDesign->Column35->starty, $FormDesign->Column35->endx,$Page_Height - $FormDesign->Column35->endy); + +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column10->x+3,$Page_Height - $FormDesign->Headings->Column10->y, $FormDesign->Headings->Column10->Length,$FormDesign->Headings->Column10->FontSize, '附', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column11->x+3,$Page_Height - $FormDesign->Headings->Column11->y, $FormDesign->Headings->Column11->Length,$FormDesign->Headings->Column11->FontSize, '件', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column12->x+3,$Page_Height - $FormDesign->Headings->Column12->y, $FormDesign->Headings->Column12->Length,$FormDesign->Headings->Column12->FontSize, '张', 'right'); +$PageNumber++; +?> Modified: trunk/includes/PDFStarter.php =================================================================== --- trunk/includes/PDFStarter.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/includes/PDFStarter.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -108,7 +108,20 @@ $Left_Margin=50; $Right_Margin=40; break; + + case 'P/3/A4_pingzheng': + $DocumentPaper = 'Z2'; + $DocumentOrientation ='L'; + + $Page_Width=595; + $Page_Height=320; + $Top_Margin=10; + $Bottom_Margin=10; + $Left_Margin=20; + $Right_Margin=10; + break; + case 'Letter': // 216mm x 279mm $DocumentPaper = 'LETTER'; Modified: trunk/includes/tcpdf/include/tcpdf_static.php =================================================================== --- trunk/includes/tcpdf/include/tcpdf_static.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/includes/tcpdf/include/tcpdf_static.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -823,6 +823,7 @@ case 'FR_COURONNE' : {$pf = array( 1020.472, 1303.937); break;} case 'FR_TELLIERE' : {$pf = array( 963.780, 1247.244); break;} case 'FR_POT' : {$pf = array( 878.740, 1133.858); break;} + case 'Z2' : {$pf = array( 560.80,320.76); break;} // DEFAULT ISO A4 default: {$pf = array( 595.276, 841.890); break;} } @@ -2840,4 +2841,4 @@ //============================================================+ // END OF FILE //============================================================+ -?> \ No newline at end of file +?> Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-02 10:02:32 UTC (rev 7578) @@ -1,5 +1,6 @@ INSERT INTO scripts VALUES ('InternalStockRequestInquiry.php',1,'Internal Stock Request inquiry'); ALTER table stockrequest ADD initiator varchar(20) NOT NULL DEFAULT ''; INSERT INTO securitytokens VALUES (19,'Internal stock request fully access authority'); +INSERT INTO scripts VALUES ('PDFGLJournalCN.php',1,'Print GL Journal Chinese version'); |
From: <rc...@us...> - 2016-08-05 18:05:53
|
Revision: 7580 http://sourceforge.net/p/web-erp/reponame/7580 Author: rchacon Date: 2016-08-05 18:05:50 +0000 (Fri, 05 Aug 2016) Log Message: ----------- Fix html code in SuppInvGRNs.php. Modified Paths: -------------- trunk/SuppInvGRNs.php trunk/doc/Change.log Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2016-08-05 02:53:30 UTC (rev 7579) +++ trunk/SuppInvGRNs.php 2016-08-05 18:05:50 UTC (rev 7580) @@ -1,7 +1,5 @@ <?php - /* $Id$*/ - /*The supplier transaction uses the SuppTrans class to hold the information about the invoice the SuppTrans class contains an array of GRNs objects - containing details of GRNs for invoicing and also an array of GLCodes objects - only used if the AP - GL link is effective */ @@ -79,7 +77,7 @@ $Hold=True; } } - + if ($InputError==False){ $_SESSION['SuppTrans']->Modify_GRN_To_Trans($_POST['GRNNo'.$i], $_SESSION['SuppTrans']->GRNs[$_POST['GRNNo'.$i]]->PODetailItem, @@ -110,10 +108,10 @@ /*Show all the selected GRNs so far from the SESSION['SuppTrans']->GRNs array */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'" method="post"> - <table class="selection"> - <tbody> + <table class="selection"> + <thead> <tr> - <th colspan="6"><h3>' . _('Invoiced Goods Received Selected') . '</h3></th> + <th colspan="10"><h3>', _('Invoiced Goods Received Selected'), '</h3></th> </tr> <tr> <th>' . _('Sequence') . ' #</th> @@ -125,7 +123,10 @@ <th>' . _('Order Price') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th>' . _('Inv Price') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th>' . _('Order Value') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> - </tr>'; + <th> </th> + </tr> + </thead> + <tbody>'; $TotalValueCharged=0; @@ -136,25 +137,24 @@ } else { $DisplayPrice = locale_number_format($EnteredGRN->OrderPrice,4); } - + echo '<tr> - <td>' . $EnteredGRN->GRNNo . '</td> - <td>' . $EnteredGRN->SupplierRef . '</td> - <td>' . $EnteredGRN->ItemCode . '</td> - <td>' . $EnteredGRN->ItemDescription . '</td> - <td class="number">' . locale_number_format($EnteredGRN->QtyRecd - $EnteredGRN->Prev_QuantityInv,'Variable') . '</td> - <td><input type="text" class="number" name="This_QuantityInv' . $i . '" value="' . locale_number_format($EnteredGRN->This_QuantityInv,'Variable') . '" size="11" maxlength="10" /></td> - <td class="number">' . $DisplayPrice . '</td> - <td><input type="text" class="number" name="ChgPrice' . $i . '" value="' . locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" size="11" maxlength="10" /></td> - <td class="number">' . locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $EnteredGRN->GRNNo . '">' . _('Delete') . '</a></td> + <td class="number">', $EnteredGRN->GRNNo, '</td> + <td class="text">', $EnteredGRN->SupplierRef, '</td> + <td class="number">', $EnteredGRN->ItemCode, '</td> + <td class="text">', $EnteredGRN->ItemDescription, '</td> + <td class="number">', locale_number_format($EnteredGRN->QtyRecd - $EnteredGRN->Prev_QuantityInv,'Variable'), '</td> + <td class="number"><input class="number" maxlength="10" name="This_QuantityInv', $i, '" size="11" type="text" value="', locale_number_format($EnteredGRN->This_QuantityInv, 'Variable'), '" /></td> + <td class="number">', $DisplayPrice, '</td> + <td class="number"><input class="number" maxlength="10" name="ChgPrice', $i, '" size="11" type="text" value="', locale_number_format($EnteredGRN->ChgPrice, $_SESSION['SuppTrans']->CurrDecimalPlaces), '" /></td> + <td class="number">', locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv, $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="text"><a href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '?Delete=', $EnteredGRN->GRNNo, '">', _('Delete'), '</a></td> </tr> <input type="hidden" name="GRNNo' . $i . '" . value="' . $EnteredGRN->GRNNo . '" />'; $i++; } echo '</tbody> - </table> <div class="centre"> <p> @@ -253,9 +253,8 @@ </tr> </table> <table> - <tbody> + <thead> <tr> - <th class="ascending">' . _('Select') . '</th> <th class="ascending">' . _('Sequence') . ' #</th> <th class="ascending">' . _('GRN Number') . '</th> <th class="ascending">' . _('Supplier\'s Ref') . '</th> @@ -267,44 +266,43 @@ <th class="ascending">' . _('Qty Yet To Invoice') . '</th> <th class="ascending">' . _('Order Price in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th class="ascending">' . _('Line Value in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> - </tr>'; + <th class="ascending">' . _('Select'), '</th> + </tr> + </thead> + <tbody>'; $i = 0; $POs = array(); - foreach ($_SESSION['SuppTransTmp']->GRNs as $GRNTmp){ - - $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; - - if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { - $POs[$GRNTmp->PONo] = $GRNTmp->PONo; + foreach($_SESSION['SuppTransTmp']->GRNs as $GRNTmp) { + $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; + if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { + $POs[$GRNTmp->PONo] = $GRNTmp->PONo; + echo '<tr> + <td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td> + <td colspan="3">' . _('Add Whole PO to Invoice') . '</td> + </tr>'; + } echo '<tr> - <td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td> - <td colspan="3">' . _('Add Whole PO to Invoice') . '</td> - </tr>'; + <td class="number">', $GRNTmp->GRNNo, '</td> + <td class="number">', $GRNTmp->GRNBatchNo, '</td> + <td class="text">', $GRNTmp->SupplierRef, '</td> + <td class="number">', $GRNTmp->PONo, '</td> + <td class="number">', $GRNTmp->ItemCode, '</td> + <td class="text">', $GRNTmp->ItemDescription, '</td> + <td class="number">', locale_number_format($GRNTmp->QtyRecd, $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->Prev_QuantityInv, $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format(($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv), $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->OrderPrice, $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv), $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="centre"><input'; + if(isset($_POST['SelectAll'])) { + echo ' checked'; + } + echo 'name=" GRNNo_', $GRNTmp->GRNNo, '" type="checkbox" /></td> + </tr>'; } - - if (isset($_POST['SelectAll'])) { - echo '<tr> - <td><input type="checkbox" checked name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } else { - echo '<tr> - <td><input type="checkbox" name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } - echo '<td>' . $GRNTmp->GRNNo . '</td> - <td>' . $GRNTmp->GRNBatchNo . '</td> - <td>' . $GRNTmp->SupplierRef . '</td> - <td>' . $GRNTmp->PONo . '</td> - <td>' . $GRNTmp->ItemCode . '</td> - <td>' . $GRNTmp->ItemDescription . '</td> - <td class="number">' . locale_number_format($GRNTmp->QtyRecd,$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->Prev_QuantityInv,$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format(($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->OrderPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - </tr></tbody>'; - - } - echo '</table>'; - echo '<br /> + echo '</tbody> + </table> + <br /> <div class="centre"> <input type="submit" name="SelectAll" value="' . _('Select All') . '" /> <input type="submit" name="DeSelectAll" value="' . _('Deselect All') . '" /> @@ -315,6 +313,6 @@ } echo '</div> - </form>'; + </form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-05 02:53:30 UTC (rev 7579) +++ trunk/doc/Change.log 2016-08-05 18:05:50 UTC (rev 7580) @@ -1,4 +1,5 @@ webERP Change Log +05/08/16 RChacon: Fix html code in SuppInvGRNs.php. 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. |
From: <rc...@us...> - 2016-08-06 21:44:45
|
Revision: 7582 http://sourceforge.net/p/web-erp/reponame/7582 Author: rchacon Date: 2016-08-06 21:44:43 +0000 (Sat, 06 Aug 2016) Log Message: ----------- Add noprint class to clean up printer output and improve code documentation. Modified Paths: -------------- trunk/GLAccountInquiry.php trunk/doc/Change.log Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2016-08-06 11:40:10 UTC (rev 7581) +++ trunk/GLAccountInquiry.php 2016-08-06 21:44:43 UTC (rev 7582) @@ -1,11 +1,18 @@ <?php /* $Id$*/ +/* Shows the general ledger transactions for a specified account over a specified range of periods */ include ('includes/session.inc'); $Title = _('General Ledger Account Inquiry'); $ViewTopic = 'GeneralLedger'; $BookMark = 'GLAccountInquiry'; include('includes/header.inc'); + +echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme, + '/images/transactions.png" title="',// Icon image. + _('General Ledger Account Inquiry'), '" /> ',// Icon title. + _('General Ledger Account Inquiry'), '</p>';// Page title. + include('includes/GLPostings.inc'); if (isset($_POST['Account'])){ @@ -32,12 +39,10 @@ $LastPeriodSelected = GetPeriod(date($_SESSION['DefaultDateFormat']), $db); } -echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . _('General Ledger Account Inquiry') . '" alt="" />' . ' ' . _('General Ledger Account Inquiry') . '</p>'; +echo '<div class="page_help_text noprint">' . _('Use the keyboard Shift key to select multiple periods') . '</div><br />'; -echo '<div class="page_help_text">' . _('Use the keyboard Shift key to select multiple periods') . '</div><br />'; - echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; -echo '<div>'; +echo '<div class="noprint">';// Begin input of criteria div. echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*Dates in SQL format for the last day of last month*/ @@ -49,7 +54,7 @@ <td>' . _('Account').':</td> <td><select name="Account">'; -$sql = "SELECT chartmaster.accountcode, +$sql = "SELECT chartmaster.accountcode, bankaccounts.accountcode AS bankact, bankaccounts.currcode, chartmaster.accountname @@ -114,8 +119,8 @@ <div class="centre"> <input type="submit" name="Show" value="'._('Show Account Transactions').'" /> </div> - </div> - </form>'; + </div>',// End input of criteria div. + '</form>'; /* End of the Form rest of script is what happens if the show button is hit*/ @@ -172,10 +177,9 @@ $ErrMsg = _('The transactions for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved because') ; $TransResult = DB_query($sql,$ErrMsg); $BankAccountInfo = isset($BankAccount)?'<th>' . _('Org Currency') . '</th> - <th>' . _('Amount in Org Currency') . '</th> + <th>' . _('Amount in Org Currency') . '</th> <th>' . _('Bank Ref') .'</th>':''; - echo '<br /> <table class="selection"> <thead> @@ -187,7 +191,7 @@ <th class="number">', _('Number'), '</th> <th class="centre">', ('Date'), '</th> <th class="number">', _('Debit'), '</th> - <th class="number">', _('Credit'), '</th>' . + <th class="number">', _('Credit'), '</th>' . $BankAccountInfo .' <th class="text">', _('Narrative'), '</th> <th class="number">', _('Balance'), '</th> @@ -286,7 +290,7 @@ $OrgAmt = ''; $Currency = ''; if ($myrow['type'] == 12 OR $myrow['type'] == 22 OR $myrow['type'] == 2 OR $myrow['type'] == 1) { - $banksql = "SELECT ref,currcode,amount FROM banktrans + $banksql = "SELECT ref,currcode,amount FROM banktrans WHERE type='" .$myrow['type']."' AND transno='" . $myrow['typeno'] . "' AND bankact='" . $SelectedAccount . "'"; $ErrMsg = _('Failed to retrieve bank data'); $bankresult = DB_query($banksql,$ErrMsg); @@ -297,7 +301,7 @@ $Currency = $bankrow['currcode']; } elseif ($myrow['type'] == 1) { //We should find out when transaction happens between bank accounts; - $bankreceivesql = "SELECT ref,type,transno,currcode,amount FROM banktrans + $bankreceivesql = "SELECT ref,type,transno,currcode,amount FROM banktrans WHERE ref LIKE '@%' AND transdate='" . $myrow['trandate'] . "' AND bankact='" . $SelectedAccount . "'"; $ErrMsg = _('Failed to retrieve bank receive data'); $bankresult = DB_query($bankreceivesql,$ErrMsg); @@ -323,7 +327,7 @@ $OrgAmt = $myrow['amount']; $Currency = $_SESSION['CompanyRecord']['currencydefault']; } - } + } $RunningTotal += $myrow['amount']; $PeriodTotal += $myrow['amount']; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-06 11:40:10 UTC (rev 7581) +++ trunk/doc/Change.log 2016-08-06 21:44:43 UTC (rev 7582) @@ -1,4 +1,5 @@ webERP Change Log +05/08/16 RChacon: In GLAccountInquiry.php, add noprint class to clean up printer output and improve code documentation. 05/08/16 RChacon: Fix html code in SuppInvGRNs.php. 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. |
From: <dai...@us...> - 2016-08-11 09:31:33
|
Revision: 7584 http://sourceforge.net/p/web-erp/reponame/7584 Author: daintree Date: 2016-08-11 09:31:30 +0000 (Thu, 11 Aug 2016) Log Message: ----------- Simon Kelly fix to SQL in SelectSalesOrder.php Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2016-08-09 07:17:19 UTC (rev 7583) +++ trunk/SelectSalesOrder.php 2016-08-11 09:31:30 UTC (rev 7584) @@ -171,7 +171,7 @@ contact FROM locations INNER JOIN locationusers ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 - WHERE loccode = '" .$_SESSION['UserStockLocation'] . "'"; + WHERE locations.loccode = '" .$_SESSION['UserStockLocation'] . "'"; $ErrMsg = _('The delivery address for the order could not be obtained from the user default stock location'); $DelAddResult = DB_query($sql,$ErrMsg); $DelAddRow = DB_fetch_array($DelAddResult); @@ -889,7 +889,7 @@ ON salesorderdetails.stkcode = stockmaster.stockid AND completed=0 INNER JOIN locstock ON stockmaster.stockid=locstock.stockid"; - if (isset($_POST['StockCat']) + if (isset($_POST['StockCat']) AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ $WhereStockCat = ''; } else { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-09 07:17:19 UTC (rev 7583) +++ trunk/doc/Change.log 2016-08-11 09:31:30 UTC (rev 7584) @@ -1,4 +1,6 @@ webERP Change Log + +11/8/16 Simon Kelly: Fix SQL for location users in SelectSalesOrder.php 05/08/16 RChacon: In GLAccountInquiry.php, add noprint class to clean up printer output and improve code documentation. 05/08/16 RChacon: Fix html code in SuppInvGRNs.php. 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. @@ -12,12 +14,12 @@ 09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. 08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. -07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. +07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. 29/06/16 Exson: Fixed the wrong balance of amount in bank account currency in DailyBankTransactions.php. 20/06/16 Exson: Fixed bom clone failure due to fields missing in CopyBom.php. Reported by shane. 20/06/16 Exson: Fixed the bug that # is not allowed as part of stockid in SelectProduct.php. -16/06/16 Exson: Make monthly payment term can be more than 30 days. +16/06/16 Exson: Make monthly payment term can be more than 30 days. 12/06/16 TurboPT: Fix syntax error in StockClone.php 08/06/16 Exson: add data label for SalesGraph.php. |
From: <dai...@us...> - 2016-08-11 09:43:31
|
Revision: 7585 http://sourceforge.net/p/web-erp/reponame/7585 Author: daintree Date: 2016-08-11 09:43:28 +0000 (Thu, 11 Aug 2016) Log Message: ----------- Falkoner: fix to customer statements new field required in custcontacts to flag the contact that should receive the emailed statement Modified Paths: -------------- trunk/doc/Change.log trunk/sql/mysql/upgrade4.13-4.13.1.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-11 09:31:30 UTC (rev 7584) +++ trunk/doc/Change.log 2016-08-11 09:43:28 UTC (rev 7585) @@ -1,5 +1,6 @@ webERP Change Log +11/8/16 Phil: committed falkoners fix for the upgrade script - was not adding the new field in customercontact required for the customer statements email address 11/8/16 Simon Kelly: Fix SQL for location users in SelectSalesOrder.php 05/08/16 RChacon: In GLAccountInquiry.php, add noprint class to clean up printer output and improve code documentation. 05/08/16 RChacon: Fix html code in SuppInvGRNs.php. Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-11 09:31:30 UTC (rev 7584) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-11 09:43:28 UTC (rev 7585) @@ -2,5 +2,6 @@ ALTER table stockrequest ADD initiator varchar(20) NOT NULL DEFAULT ''; INSERT INTO securitytokens VALUES (19,'Internal stock request fully access authority'); INSERT INTO scripts VALUES ('PDFGLJournalCN.php',1,'Print GL Journal Chinese version'); +ALTER table custcontacts ADD statement tinyint(4) NOT NULL DEFAULT 0; |
From: <te...@us...> - 2016-08-12 08:42:37
|
Revision: 7586 http://sourceforge.net/p/web-erp/reponame/7586 Author: tehonu Date: 2016-08-12 08:42:34 +0000 (Fri, 12 Aug 2016) Log Message: ----------- List of expenses of Petty cash Tab in Excel between dates Modified Paths: -------------- trunk/includes/MainMenuLinksArray.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Added Paths: ----------- trunk/PcTabExpensesList.php Added: trunk/PcTabExpensesList.php =================================================================== --- trunk/PcTabExpensesList.php (rev 0) +++ trunk/PcTabExpensesList.php 2016-08-12 08:42:34 UTC (rev 7586) @@ -0,0 +1,236 @@ +<?php +require_once ('Classes/PHPExcel.php'); + +include('includes/session.inc'); +include('includes/SQL_CommonFunctions.inc'); + +if (isset($_POST['submit'])) { + submit($db, $_POST['Tabs'], $_POST['FromDate'], $_POST['ToDate']); +} else { + display($db); +} + +//####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### +function submit(&$db, $TabToShow, $FromDate, $ToDate) { + + //initialise no input errors + $InputError = 0; + + //first off validate inputs sensible + + if ($InputError == 0){ + // Search absic PC Tab information + $SQL = "SELECT pctabs.tabcode, + pctabs.usercode, + pctabs.typetabcode, + pctabs.currency, + pctabs.tablimit, + pctabs.assigner, + pctabs.authorizer + FROM pctabs + WHERE pctabs.tabcode = '" . $TabToShow . "'"; + $result = DB_query($SQL); + $myTab = DB_fetch_array($result); + + $SQL = "SELECT SUM(pcashdetails.amount) AS previous + FROM pcashdetails + WHERE pcashdetails.tabcode = '" . $TabToShow . "' + AND pcashdetails.date < '" . FormatDateForSQL($FromDate) . "'"; + $result = DB_query($SQL); + $myPreviousBalance = DB_fetch_array($result); + + $SQL = "SELECT pcashdetails.date, + pcashdetails.codeexpense, + pcashdetails.amount, + pcashdetails.authorized, + pcashdetails.notes, + pcashdetails.receipt + FROM pcashdetails + WHERE pcashdetails.tabcode = '" . $TabToShow . "' + AND pcashdetails.date >= '" . FormatDateForSQL($FromDate) . "' + AND pcashdetails.date <= '" . FormatDateForSQL($ToDate) . "' + ORDER BY pcashdetails.date, + pcashdetails.counterindex"; + $result = DB_query($SQL); + if (DB_num_rows($result) != 0){ + + // Create new PHPExcel object + $objPHPExcel = new PHPExcel(); + + // Set document properties + $objPHPExcel->getProperties()->setCreator("webERP") + ->setLastModifiedBy("webERP") + ->setTitle("PC Tab Expenses List") + ->setSubject("PC Tab Expenses List") + ->setDescription("PC Tab Expenses List") + ->setKeywords("") + ->setCategory(""); + + // Formatting + $objPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setWrapText(true); + $objPHPExcel->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + $objPHPExcel->getActiveSheet()->getStyle('B5')->getNumberFormat()->setFormatCode('#,###'); + $objPHPExcel->getActiveSheet()->getStyle('C:D')->getNumberFormat()->setFormatCode('#,###'); + $objPHPExcel->getActiveSheet()->getStyle('E1:E2')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + $objPHPExcel->getActiveSheet()->getStyle('G')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + + // Add title data + $objPHPExcel->setActiveSheetIndex(0); + $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Tab Code'); + $objPHPExcel->getActiveSheet()->setCellValue('B1', $myTab['tabcode']); + $objPHPExcel->getActiveSheet()->setCellValue('A2', 'User Code'); + $objPHPExcel->getActiveSheet()->setCellValue('B2', $myTab['usercode']); + $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Type of Tab'); + $objPHPExcel->getActiveSheet()->setCellValue('B3', $myTab['typetabcode']); + $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Currency'); + $objPHPExcel->getActiveSheet()->setCellValue('B4', $myTab['currency']); + $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Limit'); + $objPHPExcel->getActiveSheet()->setCellValue('B5', $myTab['tablimit']); + $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Assigner'); + $objPHPExcel->getActiveSheet()->setCellValue('B6', $myTab['assigner']); + $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Authorizer'); + $objPHPExcel->getActiveSheet()->setCellValue('B7', $myTab['authorizer']); + + $objPHPExcel->getActiveSheet()->setCellValue('D1', 'From'); + $objPHPExcel->getActiveSheet()->setCellValue('E1', $FromDate); + $objPHPExcel->getActiveSheet()->setCellValue('D2', 'To'); + $objPHPExcel->getActiveSheet()->setCellValue('E2', $ToDate); + + $objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date'); + $objPHPExcel->getActiveSheet()->setCellValue('B9', 'Expense Code'); + $objPHPExcel->getActiveSheet()->setCellValue('C9', 'Amount'); + $objPHPExcel->getActiveSheet()->setCellValue('D9', 'Balance'); + $objPHPExcel->getActiveSheet()->setCellValue('E9', 'Notes'); + $objPHPExcel->getActiveSheet()->setCellValue('F9', 'Receipt'); + $objPHPExcel->getActiveSheet()->setCellValue('G9', 'Authorized'); + + $objPHPExcel->getActiveSheet()->setCellValue('B10', 'Previous Balance'); + $objPHPExcel->getActiveSheet()->setCellValue('D10', $myPreviousBalance['previous']); + + // Add data + $i = 11; + while ($myrow = DB_fetch_array($result)) { + + $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, ConvertSQLDate($myrow['date'])); + $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $myrow['codeexpense']); + $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, $myrow['amount']); + $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=D'.($i-1).'+C'.$i.''); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, $myrow['notes']); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, $myrow['receipt']); + $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, ConvertSQLDate($myrow['authorized'])); + + $i++; + } + + // Freeze panes + $objPHPExcel->getActiveSheet()->freezePane('A10'); + + // Auto Size columns + foreach(range('A','G') as $columnID) { + $objPHPExcel->getActiveSheet()->getColumnDimension($columnID) + ->setAutoSize(true); + } + + // Rename worksheet + $objPHPExcel->getActiveSheet()->setTitle($TabToShow); + // Set active sheet index to the first sheet, so Excel opens this as the first sheet + $objPHPExcel->setActiveSheetIndex(0); + + // Redirect output to a client\x92s web browser (Excel2007) + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + $File = 'ExpensesList-' . $TabToShow. '.xlsx'; + header('Content-Disposition: attachment;filename="' . $File . '"'); + header('Cache-Control: max-age=0'); + // If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + + // If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified + header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 + header ('Pragma: public'); // HTTP/1.0 + + $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); + $objWriter->save('php://output'); + + }else{ + $Title = _('Excel file for Petty Cash Tab Expenses List'); + include('includes/header.inc'); + prnMsg('No data to analyse'); + include('includes/footer.inc'); + } + } +} // End of function submit() + + +function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### +{ +// Display form fields. This function is called the first time +// the page is called. + $Title = _('Excel file for Petty Cash Tab Expenses List'); + + include('includes/header.inc'); + + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> + <div> + <br/>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<p class="page_title_text"> + <img src="' . $RootPath . '/css/' . $Theme . '/images/magnifier.png" title="' . _('Excel file for Petty Cash Tab Expenses List') . '" alt="" />' . ' ' . _('Excel file for Petty Cash Tab Expenses List') . ' + </p>'; + + # Sets default date range for current month + if (!isset($_POST['FromDate'])){ + $_POST['FromDate']=Date($_SESSION['DefaultDateFormat'], mktime(0,0,0,Date('m'),1,Date('Y'))); + } + if (!isset($_POST['ToDate'])){ + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } + + echo '<table class="selection"> + <tr> + <td>' . _('For Petty Cash Tab') . ':</td> + <td><select name="Tabs">'; + + $sql = "SELECT tabcode + FROM pctabs + ORDER BY tabcode"; + $CatResult=DB_query($sql); + + while ($myrow=DB_fetch_array($CatResult)){ + echo '<option value="' . $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; + } + echo '</select> + </td> + </tr>'; + + echo '<tr> + <td>' . _('Date Range') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" size="10" maxlength="10" value="' . $_POST['FromDate'] . '" /> + ' . _('To') . ':<input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" size="10" maxlength="10" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; + + echo ' + <tr><td> </td></tr> + <tr> + <td> </td> + <td><input type="submit" name="submit" value="' . _('Create Petty Cash Tab Expenses List Excel File') . '" /></td> + </tr> + </table> + <br />'; + echo '</div> + </form>'; + include('includes/footer.inc'); + +} // End of function display() + +function beginning_of_month($date){ + $date2 = explode("-",$date); + $m = $date2[1]; + $y = $date2[0]; + $first_of_month = $y . '-' . $m . '-01'; + return $first_of_month; +} + +?> \ No newline at end of file Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2016-08-11 09:43:28 UTC (rev 7585) +++ trunk/includes/MainMenuLinksArray.php 2016-08-12 08:42:34 UTC (rev 7586) @@ -454,9 +454,11 @@ '/PcAuthorizeExpenses.php'); $MenuItems['PC']['Reports']['Caption'] = array(_('PC Tab General Report'), + _('PC Tab Expenses List'), _('PC Expenses Analysis')); $MenuItems['PC']['Reports']['URL'] = array('/PcReportTab.php', + '/PcTabExpensesList.php', '/PcAnalysis.php'); $MenuItems['PC']['Maintenance']['Caption'] = array( _('Types of PC Tabs'), Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-11 09:43:28 UTC (rev 7585) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-12 08:42:34 UTC (rev 7586) @@ -3,5 +3,5 @@ INSERT INTO securitytokens VALUES (19,'Internal stock request fully access authority'); INSERT INTO scripts VALUES ('PDFGLJournalCN.php',1,'Print GL Journal Chinese version'); ALTER table custcontacts ADD statement tinyint(4) NOT NULL DEFAULT 0; +INSERT INTO scripts VALUES ('PcTabExpensesList.php', '15', 'Creates excel with all movements of tab between dates'); - |
From: <rc...@us...> - 2016-08-13 19:29:59
|
Revision: 7587 http://sourceforge.net/p/web-erp/reponame/7587 Author: rchacon Date: 2016-08-13 19:29:57 +0000 (Sat, 13 Aug 2016) Log Message: ----------- Show transaction date in report. Standardise trandate in debtortrans. Improvements in HTML code and code documentation. Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/doc/Change.log trunk/sql/mysql/upgrade4.13-4.13.1.sql Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2016-08-12 08:42:34 UTC (rev 7586) +++ trunk/CustWhereAlloc.php 2016-08-13 19:29:57 UTC (rev 7587) @@ -1,14 +1,13 @@ <?php - /* $Id$*/ +/* Shows to which invoices a receipt was allocated to */ include('includes/session.inc'); $Title = _('Customer How Paid Inquiry'); - $ViewTopic = 'ARInquiries'; $BookMark = 'WhereAllocated'; +include('includes/header.inc'); -include('includes/header.inc'); if (isset($_GET['TransNo']) AND isset($_GET['TransType'])) { $_POST['TransNo'] = (int)$_GET['TransNo']; $_POST['TransType'] = (int)$_GET['TransType']; @@ -18,10 +17,11 @@ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <div> <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <p class="page_title_text noprint"> - <img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . _('Customer Where Allocated'). '" alt="" />' . $Title . ' - </p> - <table class="selection noprint"> + <p class="page_title_text noprint"><img alt="" src="'. $RootPath. '/css/'. $Theme. + '/images/money_add.png" title="',// Icon image. + _('Customer Where Allocated'), '" /> ',// Icon title. + $Title. '</p>',// Page title. + '<table class="selection noprint"> <tr> <td>' . _('Type') . ':</td> <td><select tabindex="1" name="TransType"> '; @@ -60,9 +60,8 @@ prnMsg(_('The transaction number to be queried must be entered first'),'warn'); } -if (isset($_POST['ShowResults']) AND $_POST['TransNo']!=''){ +if(isset($_POST['ShowResults']) AND $_POST['TransNo']!='') { - /*First off get the DebtorTransID of the transaction (invoice normally) selected */ $sql = "SELECT debtortrans.id, ovamount+ovgst AS totamt, @@ -74,7 +73,7 @@ ON debtorsmaster.currcode=currencies.currabrev WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; - + if ($_SESSION['SalesmanLogin'] != '') { $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } @@ -98,7 +97,7 @@ if ($_POST['TransType']==12 OR $_POST['TransType'] == 11){ $TitleInfo = ($_POST['TransType'] == 12)?_('Receipt'):_('Credit Note'); - $sql .= "ON debtortrans.id = custallocns.transid_allocto + $sql .= "ON debtortrans.id = custallocns.transid_allocto WHERE custallocns.transid_allocfrom = '" . $AllocToID . "'"; } else { $TitleInfo = _('invoice'); @@ -120,33 +119,35 @@ } else { $Printer = true; echo '<br /> - <div id="Report"> - <table class="selection">'; - - echo '<tr> - <th colspan="6"> - <div class="centre"> - <b>' . _('Allocations made against') . ' ' . $TitleInfo . ' ' . _('number') . ' ' . $_POST['TransNo'] . '<br />' . _('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</b> - </div> + <div id="Report"> + <table class="selection"> + <thead> + <tr> + <th class="centre" colspan="7"> + <b>' . _('Allocations made against') . ' ' . $TitleInfo . ' ' . _('number') . ' ' . $_POST['TransNo'] . '<br />' . + _('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</b> </th> </tr>'; $TableHeader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Ex Rate') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Alloc') . '</th> - </tr>'; - echo $TableHeader; + <th class="centre">' . _('Date') . '</th> + <th class="text">' . _('Type') . '</th> + <th class="number">' . _('Number') . '</th> + <th class="text">' . _('Reference') . '</th> + <th class="number">' . _('Ex Rate') . '</th> + <th class="number">' . _('Amount') . '</th> + <th class="number">' . _('Alloc') . '</th> + </tr>'; + echo $TableHeader, + '</thead> + <tbody>'; $RowCounter = 1; $k = 0; //row colour counter $AllocsTotal = 0; - while ($myrow=DB_fetch_array($TransResult)) { - if ($k==1){ + while($myrow=DB_fetch_array($TransResult)) { + if($k==1) { echo '<tr class="EvenTableRows">'; $k=0; } else { @@ -161,12 +162,13 @@ } else { $TransType = _('Receipt'); } - echo '<td>' . $TransType . '</td> - <td>' . $myrow['transno'] . '</td> - <td>' . $myrow['reference'] . '</td> - <td>' . $myrow['rate'] . '</td> - <td class="number">' . locale_number_format($myrow['totalamt'],$CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($myrow['amt'],$CurrDecimalPlaces) . '</td> + echo ' <td class="centre">' . $myrow['trandate'] . '</td> + <td class="text">' . $TransType . '</td> + <td class="number">' . $myrow['transno'] . '</td> + <td class="text">' . $myrow['reference'] . '</td> + <td class="number">' . $myrow['rate'] . '</td> + <td class="number">' . locale_number_format($myrow['totalamt'], $CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($myrow['amt'], $CurrDecimalPlaces) . '</td> </tr>'; $RowCounter++; @@ -175,14 +177,15 @@ echo $TableHeader; } //end of page full new headings if - $AllocsTotal +=$myrow['amt']; + $AllocsTotal += $myrow['amt']; } //end of while loop echo '<tr> - <td colspan="5" class="number">' . _('Total allocated') . '</td> + <td colspan="6" class="number">' . _('Total allocated') . '</td> <td class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td> </tr> - </table> + +</tbody></table> </div>'; } // end if there are allocations against the transaction } //got the ID of the transaction to find allocations for @@ -198,5 +201,4 @@ </div>';// "Print This" button. } include('includes/footer.inc'); - ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-12 08:42:34 UTC (rev 7586) +++ trunk/doc/Change.log 2016-08-13 19:29:57 UTC (rev 7587) @@ -1,5 +1,6 @@ webERP Change Log +13/8/16 RChacon:In CustWhereAlloc.php, show transaction date in report. Standardise trandate in debtortrans. Improvements in HTML code and code documentation. 11/8/16 Phil: committed falkoners fix for the upgrade script - was not adding the new field in customercontact required for the customer statements email address 11/8/16 Simon Kelly: Fix SQL for location users in SelectSalesOrder.php 05/08/16 RChacon: In GLAccountInquiry.php, add noprint class to clean up printer output and improve code documentation. Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-12 08:42:34 UTC (rev 7586) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-13 19:29:57 UTC (rev 7587) @@ -5,3 +5,7 @@ ALTER table custcontacts ADD statement tinyint(4) NOT NULL DEFAULT 0; INSERT INTO scripts VALUES ('PcTabExpensesList.php', '15', 'Creates excel with all movements of tab between dates'); +-- standardise transaction date to DATE type: +ALTER TABLE `debtortrans` CHANGE `trandate` `trandate` DATE NOT NULL DEFAULT '0000-00-00'; + + |
From: <rc...@us...> - 2016-08-14 13:26:19
|
Revision: 7588 http://sourceforge.net/p/web-erp/reponame/7588 Author: rchacon Date: 2016-08-14 13:26:17 +0000 (Sun, 14 Aug 2016) Log Message: ----------- Show transaction date in report. Improvements in HTML code and code documentation. Modified Paths: -------------- trunk/SuppWhereAlloc.php trunk/doc/Change.log Modified: trunk/SuppWhereAlloc.php =================================================================== --- trunk/SuppWhereAlloc.php 2016-08-13 19:29:57 UTC (rev 7587) +++ trunk/SuppWhereAlloc.php 2016-08-14 13:26:17 UTC (rev 7588) @@ -1,12 +1,13 @@ -<?php - +<?php +/* $Id: SuppWhereAlloc.php 7449 2016-01-14 10:08:51Z exsonqu $*/ +/* Suppliers Where allocated */ + include('includes/session.inc'); $Title = _('Supplier How Paid Inquiry'); - $ViewTopic = 'APInquiries'; -$BookMark = 'WhereAllocated'; +$BookMark = 'WhereAllocated'; +include('includes/header.inc'); -include('includes/header.inc'); if (isset($_GET['TransNo']) AND isset($_GET['TransType'])) { $_POST['TransNo'] = (int)$_GET['TransNo']; $_POST['TransType'] = (int)$_GET['TransType']; @@ -15,11 +16,12 @@ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post"> <div> - <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> - <p class="page_title_text noprint"> - <img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . _('Supplier Where Allocated'). '" alt="" />' . $Title . ' - </p> - <table class="selection noprint"> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <p class="page_title_text noprint"><img alt="" src="'. $RootPath. '/css/'. $Theme. + '/images/money_add.png" title="',// Icon image. + _('Supplier Where Allocated'), '" /> ',// Icon title. + $Title. '</p>',// Page title. + '<table class="selection noprint"> <tr> <td>' . _('Type') . ':</td> <td><select tabindex="1" name="TransType"> '; @@ -60,7 +62,6 @@ if (isset($_POST['ShowResults']) AND $_POST['TransNo']!=''){ - /*First off get the DebtorTransID of the transaction (invoice normally) selected */ $sql = "SELECT supptrans.id, ovamount+ovgst AS totamt, @@ -116,35 +117,36 @@ prnMsg(_('There are no allocations made against this transaction'),'info'); } } else { - $Printer = true; - echo '<br /> - <div id="Report"> - <table class="selection">'; - - echo '<tr> - <th colspan="6"> - <div class="centre"> + $Printer = true; + echo '<br /> + <div id="Report"> + <table class="selection"> + <thead> + <tr> + <th class="centre" colspan="7"> <b>' . _('Allocations made against') . ' ' . $TitleInfo . ' ' . _('number') . ' ' . $_POST['TransNo'] . '<br />' . _('Transaction Total').': '. locale_number_format($myrow['totamt'],$CurrDecimalPlaces) . ' ' . $CurrCode . '</b> - </div> </th> - </tr>'; + </tr>'; + + $TableHeader = '<tr> + <th class="centre">' . _('Date') . '</th> + <th class="text">' . _('Type') . '</th> + <th class="number">' . _('Number') . '</th> + <th class="text">' . _('Reference') . '</th> + <th class="number">' . _('Ex Rate') . '</th> + <th class="number">' . _('Amount') . '</th> + <th class="number">' . _('Alloc') . '</th> + </tr>'; + echo $TableHeader, + '</thead> + <tbody>'; - $TableHeader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Ex Rate') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Alloc') . '</th> - </tr>'; - echo $TableHeader; - $RowCounter = 1; $k = 0; //row colour counter $AllocsTotal = 0; - while ($myrow=DB_fetch_array($TransResult)) { - if ($k==1){ + while($myrow=DB_fetch_array($TransResult)) { + if($k==1) { echo '<tr class="EvenTableRows">'; $k=0; } else { @@ -158,13 +160,14 @@ $TransType = _('Purchase Invoice'); } else { $TransType = _('Payment'); - } - echo '<td>' . $TransType . '</td> - <td>' . $myrow['transno'] . '</td> - <td>' . $myrow['suppreference'] . '</td> - <td>' . $myrow['rate'] . '</td> - <td class="number">' . locale_number_format($myrow['totalamt'],$CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($myrow['amt'],$CurrDecimalPlaces) . '</td> + } + echo ' <td class="centre">' . $myrow['trandate'] . '</td> + <td class="text">' . $TransType . '</td> + <td class="number">' . $myrow['transno'] . '</td> + <td class="text">' . $myrow['suppreference'] . '</td> + <td class="number">' . $myrow['rate'] . '</td> + <td class="number">' . locale_number_format($myrow['totalamt'], $CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($myrow['amt'], $CurrDecimalPlaces) . '</td> </tr>'; $RowCounter++; @@ -173,15 +176,15 @@ echo $TableHeader; } //end of page full new headings if - $AllocsTotal +=$myrow['amt']; + $AllocsTotal += $myrow['amt']; } //end of while loop echo '<tr> - <td colspan="5" class="number">' . _('Total allocated') . '</td> - <td class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td> - </tr> - </table> - </div>'; + <td class="number" colspan="6">' . _('Total allocated') . '</td> + <td class="number">' . locale_number_format($AllocsTotal, $CurrDecimalPlaces) . '</td> + </tr> + </tbody></table> + </div>'; } // end if there are allocations against the transaction } //got the ID of the transaction to find allocations for } @@ -196,5 +199,4 @@ </div>';// "Print This" button. } include('includes/footer.inc'); - ?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-13 19:29:57 UTC (rev 7587) +++ trunk/doc/Change.log 2016-08-14 13:26:17 UTC (rev 7588) @@ -1,5 +1,6 @@ webERP Change Log +14/8/16 RChacon:In SuppWhereAlloc.php, show transaction date in report. Improvements in HTML code and code documentation. 13/8/16 RChacon:In CustWhereAlloc.php, show transaction date in report. Standardise trandate in debtortrans. Improvements in HTML code and code documentation. 11/8/16 Phil: committed falkoners fix for the upgrade script - was not adding the new field in customercontact required for the customer statements email address 11/8/16 Simon Kelly: Fix SQL for location users in SelectSalesOrder.php |
From: <dai...@us...> - 2016-08-15 09:51:52
|
Revision: 7589 http://sourceforge.net/p/web-erp/reponame/7589 Author: daintree Date: 2016-08-15 09:51:49 +0000 (Mon, 15 Aug 2016) Log Message: ----------- fix customer statements and link to email from select customer script Modified Paths: -------------- trunk/PrintCustStatements.php trunk/SelectCustomer.php Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2016-08-14 13:26:17 UTC (rev 7588) +++ trunk/PrintCustStatements.php 2016-08-15 09:51:49 UTC (rev 7589) @@ -33,11 +33,14 @@ $_POST['ToCust'] = $_GET['ToCust']; } -If (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){ +if (isset($_GET['EmailOrPrint'])){ + $_POST['EmailOrPrint'] = $_GET['EmailOrPrint']; +} +if (isset($_POST['PrintPDF']) AND isset($_POST['FromCust']) AND $_POST['FromCust']!=''){ $_POST['FromCust'] = mb_strtoupper($_POST['FromCust']); - If (!isset($_POST['ToCust'])){ + if (!isset($_POST['ToCust'])){ $_POST['ToCust'] = $_POST['FromCust']; } else { $_POST['ToCust'] = mb_strtoupper($_POST['ToCust']); @@ -79,8 +82,7 @@ $Title = _('Print Statements') . ' - ' . _('No Customers Found'); require('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Customer Account Statements') . '</p>'; - prnMsg( _('There were no Customers matching your selection of '). $_POST['FromCust']. ' - '. - $_POST['ToCust'].'.' , 'error'); + prnMsg( _('There were no Customers matching your selection of ') . $_POST['FromCust'] . ' - ' . $_POST['ToCust'] . '.' , 'error'); include('includes/footer.inc'); exit(); } @@ -504,14 +506,24 @@ } /* end loop to print statements */ if (isset($pdf) AND $_POST['EmailOrPrint']=='print'){ - $pdf->OutputD($_SESSION['DatabaseName'] . '_CustStatements_' . date('Y-m-d') . '.pdf'); - $pdf->__destruct(); + $pdf->OutputD($_SESSION['DatabaseName'] . '_CustStatements_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } elseif (!isset($pdf)) { $Title = _('Print Statements') . ' - ' . _('No Statements Found'); - include('includes/header.inc'); - echo '<br /><br /><br />' . prnMsg( _('There were no statements to print') ); - echo '<br /><br /><br />'; - include('includes/footer.inc'); + if ($_POST['EmailOrPrint']=='print') { + include('includes/header.inc'); + echo '<br /> + <br /> + <br />' . prnMsg( _('There were no statements to print'); + } else { + echo '<br /> + <br /> + <br />' . prnMsg( _('There were no statements to email'); + } + echo'<br /> + <br /> + <br />'; + include('includes/footer.inc'); } } else { /*The option to print PDF was not hit */ @@ -527,8 +539,8 @@ echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection">'; - echo '<tr> + echo '<table class="selection"> + <tr> <td>' , _('Starting Customer statement to print (Customer code)') , '</td> <td><input type="text" maxlength="10" size="8" name="FromCust" value="0" /></td></tr> <tr> Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2016-08-14 13:26:17 UTC (rev 7588) +++ trunk/SelectCustomer.php 2016-08-15 09:51:49 UTC (rev 7589) @@ -198,15 +198,15 @@ echo '<a href="', $RootPath, '/CustomerInquiry.php?CustomerID=', urlencode($_SESSION['CustomerID']), '">' . _('Customer Transaction Inquiries') . '</a><br />'; echo '<a href="', $RootPath, '/CustomerAccount.php?CustomerID=', urlencode($_SESSION['CustomerID']), '">' . _('Customer Account statement on screen') . '</a><br />'; echo '<a href="', $RootPath, '/Customers.php?DebtorNo=', urlencode($_SESSION['CustomerID']), '&Modify=No">' . _('View Customer Details') . '</a><br />'; - echo '<a href="', $RootPath, '/PrintCustStatements.php?FromCust=', urlencode($_SESSION['CustomerID']), '&ToCust=', urlencode($_SESSION['CustomerID']), '&PrintPDF=Yes">' . _('Print Customer Statement') . '</a><br />'; - echo '<a href="', $RootPath, '/EmailCustStatements.php?FromCust=', urlencode($_SESSION['CustomerID']), '&ToCust=', urlencode($_SESSION['CustomerID']), '&PrintPDF=Yes">' . _('Email Customer Statement') . '</a><br />'; + echo '<a href="', $RootPath, '/PrintCustStatements.php?FromCust=', urlencode($_SESSION['CustomerID']), '&ToCust=', urlencode($_SESSION['CustomerID']), '&EmailOrPrint=print&PrintPDF=Yes">' . _('Print Customer Statement') . '</a><br />'; + echo '<a title="' . _('One of the customer\'s contacts must have an email address and be flagged as the address to send the customer statement to for this function to work') . '" href="', $RootPath, '/PrintCustStatements.php?FromCust=', urlencode($_SESSION['CustomerID']), '&ToCust=', urlencode($_SESSION['CustomerID']), '&EmailOrPrint=email&PrintPDF=Yes">' . _('Email Customer Statement') . '</a><br />'; echo '<a href="', $RootPath, '/SelectCompletedOrder.php?SelectedCustomer=', urlencode($_SESSION['CustomerID']), '">' . _('Order Inquiries') . '</a><br />'; echo '<a href="', $RootPath, '/CustomerPurchases.php?DebtorNo=', urlencode($_SESSION['CustomerID']), '">' . _('Show purchases from this customer') . '</a><br />'; wikiLink('Customer', $_SESSION['CustomerID']); 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 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 />'; } |
From: <rc...@us...> - 2016-08-17 13:22:44
|
Revision: 7592 http://sourceforge.net/p/web-erp/reponame/7592 Author: rchacon Date: 2016-08-17 13:22:42 +0000 (Wed, 17 Aug 2016) Log Message: ----------- In CustWhereAlloc.php and SuppWhereAlloc.php, use the ConvertSQLDate() function for the dates. Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/SuppWhereAlloc.php trunk/doc/Change.log Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2016-08-16 13:33:08 UTC (rev 7591) +++ trunk/CustWhereAlloc.php 2016-08-17 13:22:42 UTC (rev 7592) @@ -8,7 +8,7 @@ $BookMark = 'WhereAllocated'; include('includes/header.inc'); -if (isset($_GET['TransNo']) AND isset($_GET['TransType'])) { +if(isset($_GET['TransNo']) AND isset($_GET['TransType'])) { $_POST['TransNo'] = (int)$_GET['TransNo']; $_POST['TransType'] = (int)$_GET['TransType']; $_POST['ShowResults'] = true; @@ -26,18 +26,18 @@ <td>' . _('Type') . ':</td> <td><select tabindex="1" name="TransType"> '; -if (!isset($_POST['TransType'])){ +if(!isset($_POST['TransType'])) { $_POST['TransType']='10'; } -if ($_POST['TransType']==10){ +if($_POST['TransType']==10) { echo '<option selected="selected" value="10">' . _('Invoice') . '</option> <option value="12">' . _('Receipt') . '</option> <option value="11">' . _('Credit Note') . '</option>'; -} elseif ($_POST['TransType'] == 12) { +} elseif($_POST['TransType'] == 12) { echo '<option selected="selected" value="12">' . _('Receipt') . '</option> <option value="10">' . _('Invoice') . '</option> <option value="11">' . _('Credit Note') . '</option>'; -} elseif ($_POST['TransType'] == 11) { +} elseif($_POST['TransType'] == 11) { echo '<option selected="selected" value="11">' . _('Credit Note') . '</option> <option value="10">' . _('Invoice') . '</option> <option value="12">' . _('Receipt') . '</option>'; @@ -45,7 +45,7 @@ echo '</select></td>'; -if (!isset($_POST['TransNo'])) {$_POST['TransNo']='';} +if(!isset($_POST['TransNo'])) {$_POST['TransNo']='';} echo '<td>' . _('Transaction Number').':</td> <td><input tabindex="2" type="text" class="number" name="TransNo" required="required" maxlength="10" size="10" value="'. $_POST['TransNo'] . '" /></td> </tr> @@ -55,7 +55,7 @@ <input tabindex="3" type="submit" name="ShowResults" value="' . _('Show How Allocated') . '" /> </div>'; -if (isset($_POST['ShowResults']) AND $_POST['TransNo']==''){ +if(isset($_POST['ShowResults']) AND $_POST['TransNo']=='') { echo '<br />'; prnMsg(_('The transaction number to be queried must be entered first'),'warn'); } @@ -74,12 +74,12 @@ WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } $result = DB_query($sql ); - if (DB_num_rows($result)==1){ + if(DB_num_rows($result)==1) { $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; $CurrCode = $myrow['currcode']; @@ -94,7 +94,7 @@ custallocns.amt FROM debtortrans INNER JOIN custallocns "; - if ($_POST['TransType']==12 OR $_POST['TransType'] == 11){ + if($_POST['TransType']==12 OR $_POST['TransType'] == 11) { $TitleInfo = ($_POST['TransType'] == 12)?_('Receipt'):_('Credit Note'); $sql .= "ON debtortrans.id = custallocns.transid_allocto @@ -109,9 +109,9 @@ $ErrMsg = _('The customer transactions for the selected criteria could not be retrieved because'); $TransResult = DB_query($sql, $ErrMsg); - if (DB_num_rows($TransResult)==0){ + if(DB_num_rows($TransResult)==0) { - if ($myrow['totamt']<0 AND ($_POST['TransType']==12 OR $_POST['TransType'] == 11)){ + if($myrow['totamt']<0 AND ($_POST['TransType']==12 OR $_POST['TransType'] == 11)) { prnMsg(_('This transaction was a receipt of funds and there can be no allocations of receipts or credits to a receipt. This inquiry is meant to be used to see how a payment which is entered as a negative receipt is settled against credit notes or receipts'),'info'); } else { prnMsg(_('There are no allocations made against this transaction'),'info'); @@ -155,14 +155,14 @@ $k++; } - if ($myrow['type']==11){ + if($myrow['type']==11) { $TransType = _('Credit Note'); - } elseif ($myrow['type'] == 10){ + } elseif($myrow['type'] == 10) { $TransType = _('Invoice'); } else { $TransType = _('Receipt'); } - echo ' <td class="centre">' . $myrow['trandate'] . '</td> + echo ' <td class="centre">', ConvertSQLDate($myrow['trandate']), '</td> <td class="text">' . $TransType . '</td> <td class="number">' . $myrow['transno'] . '</td> <td class="text">' . $myrow['reference'] . '</td> @@ -172,7 +172,7 @@ </tr>'; $RowCounter++; - If ($RowCounter == 12){ + if($RowCounter == 12) { $RowCounter=1; echo $TableHeader; } @@ -181,7 +181,7 @@ } //end of while loop echo '<tr> - <td colspan="6" class="number">' . _('Total allocated') . '</td> + <td class="number" colspan="6">' . _('Total allocated') . '</td> <td class="number">' . locale_number_format($AllocsTotal,$CurrDecimalPlaces) . '</td> </tr> @@ -192,7 +192,7 @@ } echo '</div>'; echo '</form>'; -if (isset($Printer)) { +if(isset($Printer)) { echo '<div class="centre noprint"> <button onclick="javascript:window.print()" type="button"><img alt="" src="' . $RootPath . '/css/' . $Theme . '/images/printer.png" /> ' . @@ -201,4 +201,4 @@ </div>';// "Print This" button. } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SuppWhereAlloc.php =================================================================== --- trunk/SuppWhereAlloc.php 2016-08-16 13:33:08 UTC (rev 7591) +++ trunk/SuppWhereAlloc.php 2016-08-17 13:22:42 UTC (rev 7592) @@ -8,7 +8,7 @@ $BookMark = 'WhereAllocated'; include('includes/header.inc'); -if (isset($_GET['TransNo']) AND isset($_GET['TransType'])) { +if(isset($_GET['TransNo']) AND isset($_GET['TransType'])) { $_POST['TransNo'] = (int)$_GET['TransNo']; $_POST['TransType'] = (int)$_GET['TransType']; $_POST['ShowResults'] = true; @@ -26,18 +26,18 @@ <td>' . _('Type') . ':</td> <td><select tabindex="1" name="TransType"> '; -if (!isset($_POST['TransType'])){ +if(!isset($_POST['TransType'])) { $_POST['TransType']='20'; } -if ($_POST['TransType']==20){ +if($_POST['TransType']==20) { echo '<option selected="selected" value="20">' . _('Purchase Invoice') . '</option> <option value="22">' . _('Payment') . '</option> <option value="21">' . _('Debit Note') . '</option>'; -} elseif ($_POST['TransType'] == 22) { +} elseif($_POST['TransType'] == 22) { echo '<option selected="selected" value="22">' . _('Payment') . '</option> <option value="20">' . _('Purchase Invoice') . '</option> <option value="21">' . _('Debit Note') . '</option>'; -} elseif ($_POST['TransType'] == 21) { +} elseif($_POST['TransType'] == 21) { echo '<option selected="selected" value="21">' . _('Debit Note') . '</option> <option value="20">' . _('Purchase Invoice') . '</option> <option value="22">' . _('Payment') . '</option>'; @@ -45,7 +45,7 @@ echo '</select></td>'; -if (!isset($_POST['TransNo'])) {$_POST['TransNo']='';} +if(!isset($_POST['TransNo'])) {$_POST['TransNo']='';} echo '<td>' . _('Transaction Number').':</td> <td><input tabindex="2" type="text" class="number" name="TransNo" required="required" maxlength="20" size="20" value="'. $_POST['TransNo'] . '" /></td> </tr> @@ -55,12 +55,12 @@ <input tabindex="3" type="submit" name="ShowResults" value="' . _('Show How Allocated') . '" /> </div>'; -if (isset($_POST['ShowResults']) AND $_POST['TransNo']==''){ +if(isset($_POST['ShowResults']) AND $_POST['TransNo']=='') { echo '<br />'; prnMsg(_('The transaction number to be queried must be entered first'),'warn'); } -if (isset($_POST['ShowResults']) AND $_POST['TransNo']!=''){ +if(isset($_POST['ShowResults']) AND $_POST['TransNo']!='') { /*First off get the DebtorTransID of the transaction (invoice normally) selected */ $sql = "SELECT supptrans.id, @@ -74,12 +74,12 @@ WHERE type='" . $_POST['TransType'] . "' AND transno = '" . $_POST['TransNo']."'"; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $sql .= " AND supptrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } $result = DB_query($sql); - if (DB_num_rows($result)==1){ + if(DB_num_rows($result)==1) { $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; $CurrCode = $myrow['currcode']; @@ -94,7 +94,7 @@ suppallocs.amt FROM supptrans INNER JOIN suppallocs "; - if ($_POST['TransType']==22 OR $_POST['TransType'] == 21){ + if($_POST['TransType']==22 OR $_POST['TransType'] == 21) { $TitleInfo = ($_POST['TransType'] == 22)?_('Payment'):_('Debit Note'); $sql .= "ON supptrans.id = suppallocs.transid_allocto @@ -109,9 +109,9 @@ $ErrMsg = _('The customer transactions for the selected criteria could not be retrieved because'); $TransResult = DB_query($sql, $ErrMsg); - if (DB_num_rows($TransResult)==0){ + if(DB_num_rows($TransResult)==0) { - if ($myrow['totamt']>0 AND ($_POST['TransType']==22 OR $_POST['TransType'] == 21)){ + if($myrow['totamt']>0 AND ($_POST['TransType']==22 OR $_POST['TransType'] == 21)) { prnMsg(_('This transaction was a receipt of funds and there can be no allocations of receipts or credits to a receipt. This inquiry is meant to be used to see how a payment which is entered as a negative receipt is settled against credit notes or receipts'),'info'); } else { prnMsg(_('There are no allocations made against this transaction'),'info'); @@ -154,14 +154,14 @@ $k++; } - if ($myrow['type']==21){ + if($myrow['type']==21) { $TransType = _('Debit Note'); - } elseif ($myrow['type'] == 20){ + } elseif($myrow['type'] == 20) { $TransType = _('Purchase Invoice'); } else { $TransType = _('Payment'); } - echo ' <td class="centre">' . $myrow['trandate'] . '</td> + echo ' <td class="centre">', ConvertSQLDate($myrow['trandate']), '</td> <td class="text">' . $TransType . '</td> <td class="number">' . $myrow['transno'] . '</td> <td class="text">' . $myrow['suppreference'] . '</td> @@ -171,7 +171,7 @@ </tr>'; $RowCounter++; - If ($RowCounter == 22){ + if($RowCounter == 22) { $RowCounter=1; echo $TableHeader; } @@ -190,7 +190,7 @@ } echo '</div>'; echo '</form>'; -if (isset($Printer)) { +if(isset($Printer)) { echo '<div class="centre noprint"> <button onclick="javascript:window.print()" type="button"><img alt="" src="' . $RootPath . '/css/' . $Theme . '/images/printer.png" /> ' . @@ -199,4 +199,4 @@ </div>';// "Print This" button. } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-16 13:33:08 UTC (rev 7591) +++ trunk/doc/Change.log 2016-08-17 13:22:42 UTC (rev 7592) @@ -1,5 +1,6 @@ webERP Change Log +17/8/16 RChacon committed for Tim: In CustWhereAlloc.php and SuppWhereAlloc.php, use the ConvertSQLDate() function for the dates. 14/8/16 RChacon:In SuppWhereAlloc.php, show transaction date in report. Improvements in HTML code and code documentation. 13/8/16 RChacon:In CustWhereAlloc.php, show transaction date in report. Standardise trandate in debtortrans. Improvements in HTML code and code documentation. 11/8/16 Phil: committed falkoners fix for the upgrade script - was not adding the new field in customercontact required for the customer statements email address |
From: <rc...@us...> - 2016-08-20 04:00:55
|
Revision: 7598 http://sourceforge.net/p/web-erp/reponame/7598 Author: rchacon Date: 2016-08-20 04:00:54 +0000 (Sat, 20 Aug 2016) Log Message: ----------- Replace addJpegFromFile() and RoundRectangle() functions from class.pdf.php with Image() and RoundedRect() functions from tcpdf.php. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/PDFStatementPageHeader.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-19 12:03:21 UTC (rev 7597) +++ trunk/doc/Change.log 2016-08-20 04:00:54 UTC (rev 7598) @@ -1,5 +1,6 @@ webERP Change Log +18/08/16 RChacon: In PDFStatementPageHeader.inc, replace addJpegFromFile() and RoundRectangle() functions from class.pdf.php with Image() and RoundedRect() functions from tcpdf.php. 18/08/16 Exson: Add a Cancel button on SupplierAllocations.php to make user can return to previous page easily. 18/08/16 Exson: Add date format validation in PcClaimExpensesFromTab.php. 17/8/16 RChacon committed for Tim: In CustWhereAlloc.php and SuppWhereAlloc.php, use the ConvertSQLDate() function for the dates. Modified: trunk/includes/PDFStatementPageHeader.inc =================================================================== --- trunk/includes/PDFStatementPageHeader.inc 2016-08-19 12:03:21 UTC (rev 7597) +++ trunk/includes/PDFStatementPageHeader.inc 2016-08-20 04:00:54 UTC (rev 7598) @@ -6,7 +6,16 @@ $YPos = $Page_Height - $Top_Margin; -$pdf->addJpegFromFile($_SESSION['LogoFile'],$Page_Width/2 -130,$YPos-80,0,60); +// Company Logo: +/*$pdf->addJpegFromFile($_SESSION['LogoFile'], $Page_Width/2-130, $YPos-80, 0, 60);*/ +$pdf->Image( + $_SESSION['LogoFile'],// Name of the file containing the image. + $Page_Width/2-130,// Abscissa from left border to the upper-left corner (LTR). + $Page_Height -($YPos-80) -(60),// Ordinate from top border to the upper-left corner (LTR). + 0,// Width of the image in the page. If not specified or equal to zero, it is automatically calculated. + 60,// Height of the image in the page. If not specified or equal to zero, it is automatically calculated. + ''// Image format. If not specified, the type is inferred from the file extension. +);// Public function Image() in ~/includes/tcpdf/tcpdf.php // Title $FontSize =15; @@ -121,46 +130,32 @@ //$YPos -= $line_height; $XPos = $Left_Margin; +// Draws a rounded rectangle around the statement details: +$pdf->RoundedRect( + ($Left_Margin),// Abscissa of upper-left corner from left border (LTR). + $Page_Height -($YPos),// Ordinate of upper-left corner from top border (LTR). + ($Perforation) -($Left_Margin),// Width. + ($YPos) -($Bottom_Margin),// Height. + 10,// The radius of the circle used to round off the corners of the rectangle. + '1111',// Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). + '',// Style of rendering. See the getPathPaintOperator() function for more information. Default value: empty (""). + array(),// Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). + array()// Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). +);// Public function RoundedRect() in ~/includes/tcpdf/tcpdf.php -/*draw a nice curved corner box around the statement details */ -/*from the top right */ -$pdf->partEllipse($Perforation-10,$YPos-10,0,90,10,10); -/*line to the top left */ -$pdf->line($Perforation-10, $YPos,$Left_Margin+10, $YPos); -/*Do top left corner */ -$pdf->partEllipse($Left_Margin+10, $YPos-10,90,180,10,10); -/*Do a line to the bottom left corner */ -$pdf->line($Left_Margin, $YPos-10,$Left_Margin, $Bottom_Margin+10); -/*Now do the bottom left corner 180 - 270 coming back west*/ -$pdf->partEllipse($Left_Margin+10, $Bottom_Margin+10,180,270,10,10); -/*Now a line to the bottom right */ -$pdf->line($Left_Margin+10, $Bottom_Margin,$Perforation-10, $Bottom_Margin); -/*Now do the bottom right corner */ -$pdf->partEllipse($Perforation-10, $Bottom_Margin+10,270,360,10,10); -/*Finally join up to the top right corner where started */ -$pdf->line($Perforation, $Bottom_Margin+10,$Perforation, $YPos-10); +// Draws a rounded rectangle around the remittance advice section: +$pdf->RoundedRect( + ($Perforation+1),// Abscissa of upper-left corner from left border (LTR). + $Page_Height -($YPos),// Ordinate of upper-left corner from top border (LTR). + ($Page_Width-$Right_Margin) -($Perforation+1),// Width. + ($YPos) -($Bottom_Margin),// Height. + 10,// The radius of the circle used to round off the corners of the rectangle. + '1111',// Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111"). + '',// Style of rendering. See the getPathPaintOperator() function for more information. Default value: empty (""). + array(),// Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array). + array()// Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array). +);// Public function RoundedRect() in ~/includes/tcpdf/tcpdf.php - -/*draw a nice curved corner box around the remittance advice section */ -$pdf->partEllipse($Page_Width-$Right_Margin-10,$YPos-10,0,90,10,10); -/*line to the top left */ -$pdf->line($Page_Width-$Right_Margin-10, $YPos, $Perforation + 11, $YPos); -/*Do top left corner */ -$pdf->partEllipse($Perforation+11, $YPos-10,90,180,10,10); -/*Do a line to the bottom left corner */ -$pdf->line($Perforation+1, $YPos-10,$Perforation+1, $Bottom_Margin+10); -/*Now do the bottom left corner 180 - 270 coming back west*/ -$pdf->partEllipse($Perforation+11, $Bottom_Margin+10,180,270,10,10); -/*Now a line to the bottom right */ -$pdf->line($Perforation+11, $Bottom_Margin,$Page_Width-$Right_Margin-10, $Bottom_Margin); -/*Now do the bottom right corner */ -$pdf->partEllipse($Page_Width-$Right_Margin-10, $Bottom_Margin+10,270,360,10,10); -/*Finally join up to the top right corner where started */ -$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin+10,$Page_Width-$Right_Margin, $YPos-10); - - - - $YPos -= $line_height; $FontSize =10; /*Set up headings */ @@ -172,14 +167,12 @@ $pdf->addText($Left_Margin+459, $YPos,$FontSize, _('Allocated') ); $pdf->addText($Left_Margin+536, $YPos,$FontSize, _('Outstanding') ); - /*Set up remittance section headings */ $FontSize=8; $pdf->addText($Perforation+10, $YPos,$FontSize, _('Trans') ); $pdf->addText($Perforation+55, $YPos,$FontSize, _('Number') ); $pdf->addText($Perforation+100, $YPos,$FontSize, _('Outstanding') ); - $YPos -= $line_height; /*draw a line */ $pdf->line($Page_Width-$Right_Margin, $YPos,$XPos, $YPos); @@ -187,4 +180,4 @@ $YPos -= $line_height; $XPos = $Left_Margin; -?> +?> \ No newline at end of file |
From: <rc...@us...> - 2016-08-21 03:11:46
|
Revision: 7599 http://sourceforge.net/p/web-erp/reponame/7599 Author: rchacon Date: 2016-08-21 03:11:43 +0000 (Sun, 21 Aug 2016) Log Message: ----------- Fix table html code. Modified Paths: -------------- trunk/ConfirmDispatch_Invoice.php trunk/doc/Change.log Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2016-08-20 04:00:54 UTC (rev 7598) +++ trunk/ConfirmDispatch_Invoice.php 2016-08-21 03:11:43 UTC (rev 7599) @@ -1,30 +1,30 @@ <?php - /* $Id$*/ +/* Creates sales invoices from entered sales orders based on the quantities dispatched that can be modified */ /* Session started in session.inc for password checking and authorisation level check */ include('includes/DefineCartClass.php'); include('includes/DefineSerialItems.php'); + include('includes/session.inc'); $Title = _('Confirm Dispatches and Invoice An Order'); - $ViewTopic= 'ARTransactions'; $BookMark = 'ConfirmInvoice'; +include('includes/header.inc'); -include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); include('includes/FreightCalculation.inc'); include('includes/GetSalesTransGLCodes.inc'); -if (empty($_GET['identifier'])) { +if(empty($_GET['identifier'])) { /*unique session identifier to ensure that there is no conflict with other order entry sessions on the same machine */ $identifier=date('U'); } else { $identifier=$_GET['identifier']; } -if (!isset($_GET['OrderNumber']) AND !isset($_SESSION['ProcessingOrder'])) { +if(!isset($_GET['OrderNumber']) AND !isset($_SESSION['ProcessingOrder'])) { /* This page can only be called with an order number for invoicing*/ echo '<div class="centre"> <a href="' . $RootPath . '/SelectSalesOrder.php">' . _('Select a sales order to invoice'). '</a> @@ -34,7 +34,7 @@ prnMsg( _('This page can only be opened if an order has been selected Please select an order first from the delivery details screen click on Confirm for invoicing'), 'error' ); include ('includes/footer.inc'); exit; -} elseif (isset($_GET['OrderNumber']) and $_GET['OrderNumber']>0) { +} elseif(isset($_GET['OrderNumber']) and $_GET['OrderNumber']>0) { unset($_SESSION['Items'.$identifier]->LineItems); unset ($_SESSION['Items'.$identifier]); @@ -43,7 +43,7 @@ $_GET['OrderNumber']=(int)$_GET['OrderNumber']; $_SESSION['Items'.$identifier] = new cart; -/*read in all the guff from the selected order into the Items cart */ +/*read in all the guff from the selected order into the Items cart */ $OrderHeaderSQL = "SELECT salesorders.orderno, salesorders.debtorno, @@ -83,10 +83,10 @@ ON debtorsmaster.currcode = currencies.currabrev INNER JOIN locations ON locations.loccode=salesorders.fromstkloc - INNER JOIN locationusers ON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + INNER JOIN locationusers ON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 WHERE salesorders.orderno = '" . $_GET['OrderNumber']."'"; - if ($_SESSION['SalesmanLogin'] != '') { + if($_SESSION['SalesmanLogin'] != '') { $OrderHeaderSQL .= " AND salesorders.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; } @@ -94,7 +94,7 @@ $DbgMsg = _('The SQL to get the order header was'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$ErrMsg,$DbgMsg); - if (DB_num_rows($GetOrdHdrResult)==1) { + if(DB_num_rows($GetOrdHdrResult)==1) { $myrow = DB_fetch_array($GetOrdHdrResult); @@ -110,8 +110,8 @@ $BestShipper = $myrow['shipvia']; $_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia']; - if (is_null($BestShipper)){ - $BestShipper=0; + if(is_null($BestShipper)) { + $BestShipper=0; } $_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto']; $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); @@ -172,7 +172,7 @@ $DbgMsg = _('The SQL that failed was'); $LineItemsResult = DB_query($LineItemsSQL,$ErrMsg,$DbgMsg); - if (DB_num_rows($LineItemsResult)>0) { + if(DB_num_rows($LineItemsResult)>0) { while ($myrow=DB_fetch_array($LineItemsResult)) { @@ -216,7 +216,7 @@ } //end of checks on returned data set DB_free_result($LineItemsResult); - } else { /*end if the order was returned sucessfully */ + } else {// End if the order was returned successfully. echo '<br />' . prnMsg( _('This order item could not be retrieved. Please select another order'), 'warn'); @@ -226,44 +226,44 @@ } else { /* if processing, a dispatch page has been called and ${$StkItm->LineNumber} would have been set from the post -set all the necessary session variables changed by the POST */ - if (isset($_POST['ShipVia'])){ +set all the necessary session variables changed by the POST */ + if(isset($_POST['ShipVia'])) { $_SESSION['Items'.$identifier]->ShipVia = $_POST['ShipVia']; } - if (isset($_POST['ChargeFreightCost'])){ + if(isset($_POST['ChargeFreightCost'])) { $_SESSION['Items'.$identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); } $i=1; foreach ($_SESSION['Items'.$identifier]->FreightTaxes as $FreightTaxLine) { - if (isset($_POST['FreightTaxRate' . $i])){ - $_SESSION['Items'.$identifier]->FreightTaxes[$i]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $i])/100; + if(isset($_POST['FreightTaxRate' . $i])) { + $_SESSION['Items'.$identifier]->FreightTaxes[$i]->TaxRate = filter_number_format($_POST['FreightTaxRate' . $i])/100; } $i++; } foreach ($_SESSION['Items'.$identifier]->LineItems as $Itm) { - if (sizeOf($Itm->SerialItems) > 0) { + if(sizeOf($Itm->SerialItems) > 0) { $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched = 0; //initialise QtyDispatched foreach ($Itm->SerialItems as $SerialItem) { //calculate QtyDispatched from bundle quantities $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched += $SerialItem->BundleQty; } //Preventing from dispatched more than ordered. Since it's controlled items, users must select the batch/lot again. - if($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched > ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)){ + if($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched > ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)) { prnMsg(_('Dispathed Quantity should not be more than order balanced quantity').'. '._('To dispatch quantity is').' '.$_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched.' '._('And the order balance is ').' '.($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv),'error'); include('includes/footer.inc'); exit; } - } else if (isset($_POST[$Itm->LineNumber . '_QtyDispatched' ])){ - if (is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) - AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)){ + } else if(isset($_POST[$Itm->LineNumber . '_QtyDispatched' ])) { + if(is_numeric(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched' ])) + AND filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']) <= ($_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Quantity - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyInv)) { - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched = round(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']),$Itm->DecimalPlaces); + $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->QtyDispatched = round(filter_number_format($_POST[$Itm->LineNumber . '_QtyDispatched']),$Itm->DecimalPlaces); } } $i=1; foreach ($Itm->Taxes as $TaxLine) { - if (isset($_POST[$Itm->LineNumber . $i . '_TaxRate'])){ - $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Taxes[$i]->TaxRate = filter_number_format($_POST[$Itm->LineNumber . $i . '_TaxRate'])/100; + if(isset($_POST[$Itm->LineNumber . $i . '_TaxRate'])) { + $_SESSION['Items'.$identifier]->LineItems[$Itm->LineNumber]->Taxes[$i]->TaxRate = filter_number_format($_POST[$Itm->LineNumber . $i . '_TaxRate'])/100; } $i++; } @@ -273,8 +273,8 @@ /* Always display dispatch quantities and recalc freight for items being dispatched */ -if ($_SESSION['Items'.$identifier]->SpecialInstructions) { - prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); +if($_SESSION['Items'.$identifier]->SpecialInstructions) { + prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); } echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/inventory.png" title="' . _('Confirm Invoice') . '" alt="" />' . ' ' . _('Confirm Dispatch and Invoice'). '</p>'; @@ -296,10 +296,11 @@ /*************************************************************** Line Item Display ***************************************************************/ -echo '<table width="90%" cellpadding="2" class="selection"> +echo '<table class="selection"> + <thead> <tr> <th>' . _('Item Code') . '</th> - <th>' . _('Item Description' ) . '</th> + <th>' . _('Item Description') . '</th> <th>' . _('Ordered') . '</th> <th>' . _('Units') . '</th> <th>' . _('Already') . '<br />' . _('Sent') . '</th> @@ -309,9 +310,10 @@ <th>' . _('Total') . '<br />' . _('Excl Tax') . '</th> <th>' . _('Tax Authority') . '</th> <th>' . _('Tax %') . '</th> - <th>' . _('Tax') . '<br />' . _('Amount') . '</th> + <th>' . _('Tax Amount') . '</th> <th>' . _('Total') . '<br />' . _('Incl Tax') . '</th> - </tr>'; + </tr> + </thead><tbody>'; $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; @@ -326,37 +328,35 @@ $j=0; foreach ($_SESSION['Items'.$identifier]->LineItems as $LnItm) { $j++; - if ($k==1){ - $RowStarter = '<tr class="EvenTableRows">'; - $k=0; - } else { - $RowStarter = '<tr class="OddTableRows">'; - $k=1; - } - $LineTotal = $LnItm->QtyDispatched * $LnItm->Price * (1 - $LnItm->DiscountPercent); - $_SESSION['Items'.$identifier]->total += $LineTotal; $_SESSION['Items'.$identifier]->totalVolume += ($LnItm->QtyDispatched * $LnItm->Volume); $_SESSION['Items'.$identifier]->totalWeight += ($LnItm->QtyDispatched * $LnItm->Weight); - echo $RowStarter; - echo '<td>' . $LnItm->StockID . '</td> - <td title="'. $LnItm->LongDescription . '">' .$LnItm->ItemDescription . '</td> - <td class="number">' . locale_number_format($LnItm->Quantity,$LnItm->DecimalPlaces) . '</td> - <td>' . $LnItm->Units . '</td> - <td class="number">' . locale_number_format($LnItm->QtyInv,$LnItm->DecimalPlaces) . '</td>'; + if($k==1) { + $RowStarter = '<tr class="EvenTableRows">'; + $k = 0; + } else { + $RowStarter = '<tr class="OddTableRows">'; + $k = 1; + } + echo $RowStarter, ' + <td>', $LnItm->StockID, '</td> + <td class="text" title="', $LnItm->LongDescription, '">', $LnItm->ItemDescription, '</td> + <td class="number">', locale_number_format($LnItm->Quantity, $LnItm->DecimalPlaces), '</td> + <td class="text">', $LnItm->Units, '</td> + <td class="number">', locale_number_format($LnItm->QtyInv, $LnItm->DecimalPlaces), '</td>'; - if ($LnItm->Controlled==1){ + if($LnItm->Controlled==1) { - if (isset($_POST['ProcessInvoice'])) { + if(isset($_POST['ProcessInvoice'])) { echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input type="hidden" name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '" /><a href="' . $RootPath .'/ConfirmDispatchControlled_Invoice.php?identifier=' . $identifier . '&LineNo='. $LnItm->LineNumber.'">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; + echo '<td class="number"><input type="hidden" name="' . $LnItm->LineNumber . '_QtyDispatched" value="' . $LnItm->QtyDispatched . '" /><a href="' . $RootPath .'/ConfirmDispatchControlled_Invoice.php?identifier=' . $identifier . '&LineNo='. $LnItm->LineNumber.'">' .locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</a></td>'; } } else { - if (isset($_POST['ProcessInvoice'])) { - echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; + if(isset($_POST['ProcessInvoice'])) { + echo '<td class="number">' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '</td>'; } else { echo '<td class="number"><input tabindex="'.$j.'" type="text" ' . ($j==1 ? 'autofocus="autofocus" ':'') . ' class="number" required="required" title="' . _('Enter the quantity to charge the customer for, that has been dispatched') . '" name="' . $LnItm->LineNumber . '_QtyDispatched" maxlength="12" size="12" value="' . locale_number_format($LnItm->QtyDispatched,$LnItm->DecimalPlaces) . '" /></td>'; } @@ -372,33 +372,33 @@ echo '<td>'; $i=0; foreach ($_SESSION['Items'.$identifier]->LineItems[$LnItm->LineNumber]->Taxes AS $Tax) { - if ($i>0){ + if($i>0) { echo '<br />'; } echo $Tax->TaxAuthDescription; $i++; } - echo '</td>'; - echo '<td class="number">'; + echo '</td> + <td class="number">'; $i=1; // initialise the number of taxes iterated through $TaxLineTotal =0; //initialise tax total for the line foreach ($LnItm->Taxes AS $Tax) { - if (empty($TaxTotals[$Tax->TaxAuthID])) { + if(empty($TaxTotals[$Tax->TaxAuthID])) { $TaxTotals[$Tax->TaxAuthID]=0; } - if ($i>1){ + if($i>1) { echo '<br />'; } - if (isset($_POST['ProcessInvoice'])) { - echo $Tax->TaxRate*100; + if(isset($_POST['ProcessInvoice'])) { + echo $Tax->TaxRate*100; } else { echo '<input type="text" class="number" required="required" title="' . _('Enter the tax rate applicable as a number') . '" name="' . $LnItm->LineNumber . $i . '_TaxRate" maxlength="4" size="4" value="' . $Tax->TaxRate*100 . '" />'; } $i++; - if ($Tax->TaxOnTax ==1){ + if($Tax->TaxOnTax ==1) { $TaxTotals[$Tax->TaxAuthID] += ($Tax->TaxRate * ($LineTotal + $TaxLineTotal)); $TaxLineTotal += ($Tax->TaxRate * ($LineTotal + $TaxLineTotal)); } else { @@ -418,10 +418,10 @@ echo '<td class="number">' . $DisplayTaxAmount . '</td> <td class="number">' . $DisplayGrossLineTotal . '</td>'; - if ($LnItm->Controlled==1){ - if (!isset($_POST['ProcessInvoice'])) { + if($LnItm->Controlled==1) { + if(!isset($_POST['ProcessInvoice'])) { echo '<td><a href="' . $RootPath . '/ConfirmDispatchControlled_Invoice.php?identifier=' . $identifier . '&LineNo='. $LnItm->LineNumber.'">'; - if ($LnItm->Serialised==1){ + if($LnItm->Serialised==1) { echo _('Enter Serial Numbers'); } else { /*Just batch/roll/lot control */ echo _('Enter Batch/Roll/Lot #'); @@ -430,7 +430,7 @@ } } echo '</tr>'; - if (mb_strlen($LnItm->Narrative)>1){ + if(mb_strlen($LnItm->Narrative)>1) { $Narrative=str_replace('\r\n','<br />', $LnItm->Narrative); echo $RowStarter . '<td colspan="12">' . stripslashes($Narrative) . '</td></tr>'; } @@ -442,7 +442,7 @@ was not fully delivered the first time ?? */ if(!isset($_SESSION['Items'.$identifier]->FreightCost)) { - if ($_SESSION['DoFreightCalc']==True){ + if($_SESSION['DoFreightCalc']==True) { list ($FreightCost, $BestShipper) = CalcFreightCost($_SESSION['Items'.$identifier]->total, $_SESSION['Items'.$identifier]->BrAdd2, $_SESSION['Items'.$identifier]->BrAdd3, @@ -456,77 +456,76 @@ $db); $_SESSION['Items'.$identifier]->ShipVia = $BestShipper; } - if (is_numeric($FreightCost)){ + if(is_numeric($FreightCost)) { $FreightCost = $FreightCost / $_SESSION['CurrencyRate']; - } else { + } else { $FreightCost =0; - } - if (!is_numeric($BestShipper)){ - $SQL = "SELECT shipper_id FROM shippers WHERE shipper_id='" . $_SESSION['Default_Shipper'] . "'"; + } + if(!is_numeric($BestShipper)) { + $SQL = "SELECT shipper_id FROM shippers WHERE shipper_id='" . $_SESSION['Default_Shipper'] . "'"; $ErrMsg = _('There was a problem testing for a default shipper because'); $TestShipperExists = DB_query($SQL, $ErrMsg); - if (DB_num_rows($TestShipperExists)==1){ + if(DB_num_rows($TestShipperExists)==1) { $BestShipper = $_SESSION['Default_Shipper']; } else { - $SQL = "SELECT shipper_id FROM shippers"; + $SQL = "SELECT shipper_id FROM shippers"; $ErrMsg = _('There was a problem testing for a default shipper'); $TestShipperExists = DB_query($SQL, $ErrMsg); - if (DB_num_rows($TestShipperExists)>=1){ + if(DB_num_rows($TestShipperExists)>=1) { $ShipperReturned = DB_fetch_row($TestShipperExists); $BestShipper = $ShipperReturned[0]; } else { prnMsg( _('There are no shippers defined') . '. ' . _('Please use the link below to set up shipping freight companies, the system expects the shipping company to be selected or a default freight company to be used'),'error'); - echo '<a href="' . $RootPath . 'Shippers.php">' . _('Enter') . '/' . _('Amend Freight Companies'). '</a>'; + echo '<a href="' . $RootPath . 'Shippers.php">' . _('Enter') . '/' . _('Amend Freight Companies'). '</a>'; } } } } -if (isset($_POST['ChargeFreightCost']) AND !is_numeric(filter_number_format($_POST['ChargeFreightCost']))){ +if(isset($_POST['ChargeFreightCost']) AND !is_numeric(filter_number_format($_POST['ChargeFreightCost']))) { $_POST['ChargeFreightCost'] = 0; } echo '<tr> - <td colspan="5" class="number">' . _('Order Freight Cost'). '</td> - <td class="number">' . locale_number_format($_SESSION['Old_FreightCost'],$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; + <td class="number" colspan="2">', _('Order Freight Cost'), '</td> + <td class="number">', locale_number_format($_SESSION['Old_FreightCost'], $_SESSION['Items'.$identifier]->CurrDecimalPlaces), '</td>'; -if ($_SESSION['DoFreightCalc']==True){ - echo '<td colspan="2" class="number">' ._('Recalculated Freight Cost'). '</td> - <td class="number">' . locale_number_format($FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; +if($_SESSION['DoFreightCalc']==True) { + echo '<td class="number" colspan="2">', _('Recalculated Freight Cost'), '</td> + <td class="number">', locale_number_format($FreightCost, $_SESSION['Items'.$identifier]->CurrDecimalPlaces), '</td>'; } else { -// echo '<td colspan="1"></td>'; +// echo '<td colspan="1"></td>';// Should be?: echo '<td colspan="3"> </td>'; } $j++; -if (!isset($_POST['ChargeFreightCost'])) { +if(!isset($_POST['ChargeFreightCost'])) { $_POST['ChargeFreightCost']=0; } -if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 +echo '<td class="number" colspan="2">', _('Charge Freight Cost ex Tax'), '</td>'; +if($_SESSION['Items'.$identifier]->Any_Already_Delivered()==1 AND (!isset($_SESSION['Items'.$identifier]->FreightCost) OR $_POST['ChargeFreightCost']==0)) { - echo '<td colspan="2" class="number">' . _('Charge Freight Cost ex Tax') . '</td> - <td><input tabindex="'.$j.'" type="text" required="required" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="0" /></td>'; - $_SESSION['Items'.$identifier]->FreightCost=0; + echo '<td><input class="number" maxlength="12" name="ChargeFreightCost" required="required" size="10" tabindex="', $j, '" type="text" value="0" /></td>'; + $_SESSION['Items'.$identifier]->FreightCost = 0; } else { - echo '<td colspan="2" class="number">' . _('Charge Freight Cost ex Tax') . '</td>'; - if (isset($_POST['ProcessInvoice'])) { + if(isset($_POST['ProcessInvoice'])) { echo '<td class="number">' . locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>'; } else { - echo '<td class="number"><input tabindex="'.$j.'" type="text" class="number" size="10" maxlength="12" name="ChargeFreightCost" value="' . locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" /></td>'; + echo '<td class="number"><input class="number" maxlength="12" name="ChargeFreightCost" size="10" tabindex="'. $j. '" type="text" value="'. locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces). '" /></td>'; } $_POST['ChargeFreightCost'] = locale_number_format($_SESSION['Items'.$identifier]->FreightCost,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); } -$FreightTaxTotal =0; //initialise tax total +$FreightTaxTotal = 0;// initialise tax total echo '<td>'; $i=0; // initialise the number of taxes iterated through foreach ($_SESSION['Items'.$identifier]->FreightTaxes as $FreightTaxLine) { - if ($i>0){ + if($i>0) { echo '<br />'; } - echo $FreightTaxLine->TaxAuthDescription; + echo $FreightTaxLine->TaxAuthDescription; $i++; } @@ -534,18 +533,17 @@ $i=0; foreach ($_SESSION['Items'.$identifier]->FreightTaxes as $FreightTaxLine) { - if ($i>0){ + if($i>0) { echo '<br />'; } - if (isset($_POST['ProcessInvoice'])) { - echo $FreightTaxLine->TaxRate * 100 ; + if(isset($_POST['ProcessInvoice'])) { + echo $FreightTaxLine->TaxRate * 100 ; } else { - echo '<input type="text" class="number" name="FreightTaxRate' . $FreightTaxLine->TaxCalculationOrder . - '" maxlength="4" size="4" value="' . locale_number_format($FreightTaxLine->TaxRate * 100,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" />'; + echo '<input class="number" maxlength="4" name="FreightTaxRate'. $FreightTaxLine->TaxCalculationOrder. '" size="4" type="text" value="'. locale_number_format($FreightTaxLine->TaxRate * 100, $_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '" />'; } - if ($FreightTaxLine->TaxOnTax ==1){ + if($FreightTaxLine->TaxOnTax ==1) { $TaxTotals[$FreightTaxLine->TaxAuthID] += ($FreightTaxLine->TaxRate * ($_SESSION['Items'.$identifier]->FreightCost + $FreightTaxTotal)); $FreightTaxTotal += ($FreightTaxLine->TaxRate * ($_SESSION['Items'.$identifier]->FreightCost + $FreightTaxTotal)); } else { @@ -574,15 +572,15 @@ </tr>'; -if (! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])){ +if(! isset($_POST['DispatchDate']) OR ! Is_Date($_POST['DispatchDate'])) { $DefaultDispatchDate = Date($_SESSION['DefaultDateFormat'],CalcEarliestDispatchDate()); } else { $DefaultDispatchDate = $_POST['DispatchDate']; } -echo '</table><br />'; +echo '<tbody></table><br />'; -if (isset($_POST['ProcessInvoice']) AND $_POST['ProcessInvoice'] != ''){ +if(isset($_POST['ProcessInvoice']) AND $_POST['ProcessInvoice'] != '') { /* SQL to process the postings for sales invoices... @@ -592,23 +590,23 @@ $QuantityInvoicedIsPositive = false; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { - if ($OrderLine->QtyDispatched > 0){ + if($OrderLine->QtyDispatched > 0) { $QuantityInvoicedIsPositive =true; } } - if (! $QuantityInvoicedIsPositive){ + if(! $QuantityInvoicedIsPositive) { prnMsg( _('There are no lines on this order with a quantity to invoice') . '. ' . _('No further processing has been done'),'error'); include('includes/footer.inc'); exit; } - if ($_SESSION['ProhibitNegativeStock']==1){ // checks for negative stock after processing invoice + if($_SESSION['ProhibitNegativeStock']==1) { // checks for negative stock after processing invoice //sadly this check does not combine quantities occuring twice on and order and each line is considered individually :-( $NegativesFound = false; foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { $SQL = "SELECT stockmaster.description, - locstock.quantity, - stockmaster.mbflag + locstock.quantity, + stockmaster.mbflag FROM locstock INNER JOIN stockmaster ON stockmaster.stockid=locstock.stockid @@ -618,17 +616,17 @@ $ErrMsg = _('Could not retrieve the quantity left at the location once this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$ErrMsg); $CheckNegRow = DB_fetch_array($Result); - if (($CheckNegRow['mbflag']=='B' OR $CheckNegRow['mbflag']=='M') AND mb_substr($OrderLine->StockID,0,4)!='ASSET'){ - if ($CheckNegRow['quantity'] < $OrderLine->QtyDispatched){ + if(($CheckNegRow['mbflag']=='B' OR $CheckNegRow['mbflag']=='M') AND mb_substr($OrderLine->StockID,0,4)!='ASSET') { + if($CheckNegRow['quantity'] < $OrderLine->QtyDispatched) { prnMsg( _('Invoicing the selected order would result in negative stock. The system parameters are set to prohibit negative stocks from occurring. This invoice cannot be created until the stock on hand is corrected.'),'error',$OrderLine->StockID . ' ' . $CheckNegRow['description'] . ' - ' . _('Negative Stock Prohibited')); $NegativesFound = true; } - } elseif ($CheckNegRow['mbflag']=='A') { + } elseif($CheckNegRow['mbflag']=='A') { /*Now look for assembly components that would go negative */ $SQL = "SELECT bom.component, - stockmaster.description, - locstock.quantity-(" . $OrderLine->QtyDispatched . "*bom.quantity) AS qtyleft + stockmaster.description, + locstock.quantity-(" . $OrderLine->QtyDispatched . "*bom.quantity) AS qtyleft FROM bom INNER JOIN locstock ON bom.component=locstock.stockid @@ -636,13 +634,13 @@ ON stockmaster.stockid=bom.component WHERE bom.parent='" . $OrderLine->StockID . "' AND locstock.loccode='" . $_SESSION['Items'.$identifier]->Location . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('Could not retrieve the component quantity left at the location once the assembly item on this order is invoiced (for the purposes of checking that stock will not go negative because)'); $Result = DB_query($SQL,$ErrMsg); - while ($NegRow = DB_fetch_array($Result)){ - if ($NegRow['qtyleft']<0){ + while ($NegRow = DB_fetch_array($Result)) { + if($NegRow['qtyleft']<0) { prnMsg(_('Invoicing the selected order would result in negative stock for a component of an assembly item on the order. The system parameters are set to prohibit negative stocks from occurring. This invoice cannot be created until the stock on hand is corrected.'),'error',$NegRow['component'] . ' ' . $NegRow['description'] . ' - ' . _('Negative Stock Prohibited')); $NegativesFound = true; } // end if negative would result @@ -651,10 +649,10 @@ } //end of loop around items on the order for negative check - if ($NegativesFound){ - echo '</div>'; - echo '</form>'; - echo '<div class="centre"> + if($NegativesFound) { + echo '</div>'; + echo '</form>'; + echo '<div class="centre"> <input type="submit" name="Update" value="' . _('Update'). '" /></div>'; include('includes/footer.inc'); exit; @@ -680,7 +678,7 @@ /*company record read in on login with info on GL Links and debtors GL account*/ - if ($_SESSION['CompanyRecord']==0){ + if($_SESSION['CompanyRecord']==0) { /*The company data and preferences could not be retrieved for some reason */ prnMsg( _('The company information and preferences could not be retrieved') . ' - ' . _('see your system administrator'), 'error'); include('includes/footer.inc'); @@ -699,11 +697,11 @@ $Result = DB_query($SQL); - if (DB_num_rows($Result) != count($_SESSION['Items'.$identifier]->LineItems)){ + if(DB_num_rows($Result) != count($_SESSION['Items'.$identifier]->LineItems)) { - /*there should be the same number of items returned from this query as there are lines on the invoice - if not then someone has already invoiced or credited some lines */ + /*there should be the same number of items returned from this query as there are lines on the invoice - if not then someone has already invoiced or credited some lines */ - if ($debug==1){ + if($debug==1) { echo '<br />' . $SQL; echo '<br />' . _('Number of rows returned by SQL') . ':' . DB_num_rows($Result); echo '<br />' . _('Count of items in the session') . ' ' . count($_SESSION['Items'.$identifier]->LineItems); @@ -722,16 +720,16 @@ while ($myrow = DB_fetch_array($Result)) { - if ($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] + if($_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] OR $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) { - echo '<br />' . _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv; + echo '<br />' . _('Orig order for'). ' ' . $myrow['orderlineno'] . ' '. _('has a quantity of'). ' ' . $myrow['quantity'] . ' '. _('and an invoiced qty of'). ' ' . $myrow['qtyinvoiced'] . ' '. _('the session shows quantity of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of'). ' ' . $_SESSION['Items'.$identifier]->LineItems[$myrow['orderlineno']]->QtyInv; prnMsg( _('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error'); echo '<br />'; - echo '<div class="centre"><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; + echo '<div class="centre"><a href="'. $RootPath . '/SelectSalesOrder.php">' . _('Select a sales order for confirming deliveries and invoicing'). '</a></div>'; unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); @@ -756,7 +754,7 @@ DB_Txn_Begin(); - if ($DefaultShipVia != $_SESSION['Items'.$identifier]->ShipVia){ + if($DefaultShipVia != $_SESSION['Items'.$identifier]->ShipVia) { $SQL = "UPDATE custbranch SET defaultshipvia ='" . $_SESSION['Items'.$identifier]->ShipVia . "' WHERE debtorno='" . $_SESSION['Items'.$identifier]->DebtorNo . "' @@ -846,13 +844,13 @@ foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { /*Test to see if the item being sold is an asset */ - if (mb_substr($OrderLine->StockID,0,6)=='ASSET-'){ + if(mb_substr($OrderLine->StockID,0,6)=='ASSET-') { $IsAsset = true; $HyphenOccursAt = mb_strpos($OrderLine->StockID,'-',6); - if ($HyphenOccursAt == false){ - $AssetNumber = intval(mb_substr($OrderLine->StockID,6)); + if($HyphenOccursAt == false) { + $AssetNumber = intval(mb_substr($OrderLine->StockID,6)); } else { - $AssetNumber = intval(mb_substr($OrderLine->StockID,6,mb_strlen($OrderLine->StockID)-$HyphenOccursAt-1)); + $AssetNumber = intval(mb_substr($OrderLine->StockID,6,mb_strlen($OrderLine->StockID)-$HyphenOccursAt-1)); } prnMsg (_('The asset number being disposed of is:') . ' ' . $AssetNumber, 'info'); } else { @@ -860,7 +858,7 @@ $AssetNumber = 0; } - if ($_POST['BOPolicy']=='CAN'){ + if($_POST['BOPolicy']=='CAN') { $SQL = "UPDATE salesorderdetails SET quantity = quantity - " . ($OrderLine->Quantity - $OrderLine->QtyDispatched - $OrderLine->QtyInv) . " @@ -872,7 +870,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - if (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0){ + if(($OrderLine->Quantity - $OrderLine->QtyDispatched)>0) { $SQL = "INSERT INTO orderdeliverydifferenceslog (orderno, invoiceno, @@ -885,7 +883,7 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched - $OrderLine->QtyInv) . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched - $OrderLine->QtyInv) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'CAN')"; @@ -895,7 +893,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } - } elseif (($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 + } elseif(($OrderLine->Quantity - $OrderLine->QtyDispatched)>0 AND DateDiff(ConvertSQLDate($DefaultDispatchDate),$_SESSION['Items'.$identifier]->DeliveryDate,'d')>0) { /*The order is being short delivered after the due date - need to insert a delivery differnce log */ @@ -912,33 +910,33 @@ '" . $_SESSION['ProcessingOrder'] . "', '" . $InvoiceNo . "', '" . $OrderLine->StockID . "', - '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched - $OrderLine->QtyInv) . "', + '" . ($OrderLine->Quantity - $OrderLine->QtyDispatched - $OrderLine->QtyInv) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', 'BO' )"; - $ErrMsg = '<br />' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); + $ErrMsg = '<br />' . _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The order delivery differences log record could not be inserted because'); $DbgMsg = _('The following SQL to insert the order delivery differences record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } /*end of order delivery differences log entries */ /*Now update SalesOrderDetails for the quantity invoiced and the actual dispatch dates. */ - if ($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!='' AND $OrderLine->QtyDispatched) { + if($OrderLine->QtyDispatched !=0 AND $OrderLine->QtyDispatched!='' AND $OrderLine->QtyDispatched) { // Test above to see if the line is completed or not - if ($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN'){ + if($OrderLine->QtyDispatched>=($OrderLine->Quantity - $OrderLine->QtyInv) OR $_POST['BOPolicy']=='CAN') { $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "', + actualdispatchdate = '" . $DefaultDispatchDate . "', completed=1 WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; } else { $SQL = "UPDATE salesorderdetails SET qtyinvoiced = qtyinvoiced + " . $OrderLine->QtyDispatched . ", - actualdispatchdate = '" . $DefaultDispatchDate . "' + actualdispatchdate = '" . $DefaultDispatchDate . "' WHERE orderno = '" . $_SESSION['ProcessingOrder'] . "' AND orderlineno = '" . $OrderLine->LineNumber . "'"; @@ -958,21 +956,21 @@ $myrow = DB_fetch_row($Result); $MBFlag = $myrow[0]; - if ($MBFlag=='B' OR $MBFlag=='M') { + if($MBFlag=='B' OR $MBFlag=='M') { $Assembly = False; /* Need to get the current location quantity will need it later for the stock movement */ - $SQL="SELECT locstock.quantity + $SQL="SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $OrderLine->StockID . "' AND loccode= '" . $_SESSION['Items'.$identifier]->Location . "'"; $ErrMsg = _('WARNING') . ': ' . _('Could not retrieve current location stock'); $Result = DB_query($SQL, $ErrMsg); - if (DB_num_rows($Result)==1){ - $LocQtyRow = DB_fetch_row($Result); - $QtyOnHandPrior = $LocQtyRow[0]; + if(DB_num_rows($Result)==1) { + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; } else { /* There must be some error this should never happen */ $QtyOnHandPrior = 0; @@ -987,7 +985,7 @@ $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - } else if ($MBFlag=='A'){ /* its an assembly */ + } else if($MBFlag=='A') { /* its an assembly */ /*Need to get the BOM for this part and make stock moves for the components then update the Location stock balances */ $Assembly=True; @@ -998,19 +996,19 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid WHERE bom.parent='" . $OrderLine->StockID . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not retrieve assembly components from the database for'). ' '. $OrderLine->StockID . _('because').' '; $DbgMsg = _('The SQL that failed was'); $AssResult = DB_query($SQL,$ErrMsg,$DbgMsg,true); - while ($AssParts = DB_fetch_array($AssResult)){ + while ($AssParts = DB_fetch_array($AssResult)) { $StandardCost += ($AssParts['standard'] * $AssParts['quantity']) ; /* Need to get the current location quantity will need it later for the stock movement */ - $SQL="SELECT locstock.quantity + $SQL="SELECT locstock.quantity FROM locstock WHERE locstock.stockid='" . $AssParts['component'] . "' AND loccode= '" . $_SESSION['Items'.$identifier]->Location . "'"; @@ -1018,14 +1016,14 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Can not retrieve assembly components location stock quantities because '); $DbgMsg = _('The SQL that failed was'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - if (DB_num_rows($Result)==1){ - $LocQtyRow = DB_fetch_row($Result); - $QtyOnHandPrior = $LocQtyRow[0]; + if(DB_num_rows($Result)==1) { + $LocQtyRow = DB_fetch_row($Result); + $QtyOnHandPrior = $LocQtyRow[0]; } else { /*There must be some error this should never happen */ $QtyOnHandPrior = 0; } - if (empty($AssParts['standard'])) { + if(empty($AssParts['standard'])) { $AssParts['standard']=0; } $SQL = "INSERT INTO stockmoves (stockid, @@ -1081,11 +1079,11 @@ //$LocalCurrencyPrice = round(($OrderLine->Price / $_SESSION['CurrencyRate']),$_SESSION['CompanyRecord']['decimalplaces']); change decimalplaces to 5 to avoid price or lines total variance on invoice. And the decimal places should not be over 5 since the stockmoves table defined it as decimal(21,5) now. $LocalCurrencyPrice = round(($OrderLine->Price / $_SESSION['CurrencyRate']),5); - if (empty($OrderLine->StandardCost)) { + if(empty($OrderLine->StandardCost)) { $OrderLine->StandardCost=0; } - if ($MBFlag=='B' OR $MBFlag=='M'){ - $SQL = "INSERT INTO stockmoves (stockid, + if($MBFlag=='B' OR $MBFlag=='M') { + $SQL = "INSERT INTO stockmoves (stockid, type, transno, loccode, @@ -1118,8 +1116,8 @@ '" . ($QtyOnHandPrior - $OrderLine->QtyDispatched) . "', '" . DB_escape_string($OrderLine->Narrative) . "' )"; } else { - // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil - if (empty($OrderLine->StandardCost)) { + // its an assembly or dummy and assemblies/dummies always have nil stock (by definition they are made up at the time of dispatch so new qty on hand will be nil + if(empty($OrderLine->StandardCost)) { $OrderLine->StandardCost=0; } $SQL = "INSERT INTO stockmoves (stockid, @@ -1182,11 +1180,11 @@ } -/*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ +/* Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ - if ($OrderLine->Controlled ==1){ - foreach($OrderLine->SerialItems as $Item){ - /*We need to add the StockSerialItem record and the StockSerialMoves as well */ + if($OrderLine->Controlled ==1) { + foreach($OrderLine->SerialItems as $Item) { + /*We need to add the StockSerialItem record and the StockSerialMoves as well */ $SQL = "UPDATE stockserialitems SET quantity= quantity - " . $Item->BundleQty . " WHERE stockid='" . $OrderLine->StockID . "' @@ -1217,7 +1215,7 @@ /*Insert Sales Analysis records */ $SalesValue = 0; - if ($_SESSION['CurrencyRate']>0){ + if($_SESSION['CurrencyRate']>0) { $SalesValue = $OrderLine->Price * $OrderLine->QtyDispatched / $_SESSION['CurrencyRate']; } @@ -1254,12 +1252,12 @@ salesanalysis.budgetoractual"; $ErrMsg = _('The count of existing Sales analysis records could not run because'); - $DbgMsg = '<br />' . _('SQL to count the no of sales analysis records'); + $DbgMsg = '<br />' . _('SQL to count the no of sales analysis records'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); $myrow = DB_fetch_row($Result); - if ($myrow[0]>0){ /*Update the existing record that already exists */ + if($myrow[0]>0) { /*Update the existing record that already exists */ $SQL = "UPDATE salesanalysis SET amt=amt+" . round(($SalesValue),$_SESSION['CompanyRecord']['decimalplaces']) . ", cost=cost+" . round(($OrderLine->StandardCost * $OrderLine->QtyDispatched),$_SESSION['CompanyRecord']['decimalplaces']) . ", @@ -1315,9 +1313,9 @@ /* If GLLink_Stock then insert GLTrans to credit stock and debit cost of sales at standard cost*/ - if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $OrderLine->StandardCost !=0 AND ! $IsAsset){ + if($_SESSION['CompanyRecord']['gllink_stock']==1 AND $OrderLine->StandardCost !=0 AND ! $IsAsset) { -/*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ +/*first the cost of sales entry - GL accounts are retrieved using the function GetCOGSGLAccount from includes/GetSalesTransGLCodes.inc */ $SQL = "INSERT INTO gltrans (type, typeno, @@ -1361,11 +1359,11 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock side of the cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ + } /* end of if GL and stock integrated and standard cost !=0 and not an asset */ - if ($_SESSION['CompanyRecord']['gllink_debtors']==1 AND $OrderLine->Price !=0){ + if($_SESSION['CompanyRecord']['gllink_debtors']==1 AND $OrderLine->Price !=0) { - if (!$IsAsset){ // its a normal stock item + if(!$IsAsset) { // its a normal stock item //Post sales transaction to GL credit sales $SalesGLAccounts = GetSalesGLAccount($Area, $OrderLine->StockID, $_SESSION['Items'.$identifier]->DefaultSalesType, $db); @@ -1389,7 +1387,7 @@ $DbgMsg = '<br />' ._('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - if ($OrderLine->DiscountPercent !=0){ + if($OrderLine->DiscountPercent !=0) { $SQL = "INSERT INTO gltrans (type, typeno, @@ -1429,14 +1427,14 @@ $DisposalResult = DB_query( $SQL,$ErrMsg,$DbgMsg); $DisposalRow = DB_fetch_array($DisposalResult); - /*Need to : - * 1.) debit accum depn account with whole amount of accum depn - * 2.) credit cost account with the whole amount of the cost - * 3.) debit the disposal account with the NBV - * 4.) credit the disposal account with the sale proceeds net of discounts */ + /*Need to : + * 1.) debit accum depn account with whole amount of accum depn + * 2.) credit cost account with the whole amount of the cost + * 3.) debit the disposal account with the NBV + * 4.) credit the disposal account with the sale proceeds net of discounts */ /* 1 debit accum depn */ - if ($DisposalRow['accumdepn']!=0){ + if($DisposalRow['accumdepn']!=0) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1457,8 +1455,8 @@ $DbgMsg = _('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } - /* 2 credit cost */ - if($DisposalRow['cost']!=0){ + /* 2 credit cost */ + if($DisposalRow['cost']!=0) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1480,7 +1478,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } //3. Debit disposal account with NBV - if($DisposalRow['cost']-$DisposalRow['accumdepn']!=0){ + if($DisposalRow['cost']-$DisposalRow['accumdepn']!=0) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1494,7 +1492,7 @@ '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('net book value disposal') . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('net book value disposal') . "', '" . ($DisposalRow['cost']-$DisposalRow['accumdepn']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal net book value GL posting could not be inserted because'); @@ -1516,7 +1514,7 @@ '" . $DefaultDispatchDate . "', '" . $PeriodNo . "', '" . $DisposalRow['disposalact'] . "', - '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('asset disposal proceeds') . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . ' ' . _('asset disposal proceeds') . "', '" . (-$OrderLine->Price * $OrderLine->QtyDispatched* (1 - $OrderLine->DiscountPercent)/$_SESSION['CurrencyRate']) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The disposal proceeds GL posting could not be inserted because'); @@ -1526,7 +1524,7 @@ } // end if the item being sold was an asset } /*end of if sales integrated with debtors */ - if ($IsAsset) { + if($IsAsset) { /* then the item being sold is an asset disposal * need to create fixedassettrans * set disposal date and proceeds @@ -1565,10 +1563,10 @@ } /*end of OrderLine loop */ - if ($_SESSION['CompanyRecord']['gllink_debtors']==1){ + if($_SESSION['CompanyRecord']['gllink_debtors']==1) { /*Post debtors transaction to GL debit debtors, credit freight re-charged and credit sales */ - if (($_SESSION['Items'.$identifier]->total + $_SESSION['Items'.$identifier]->FreightCost + $TaxTotal) !=0) { + if(($_SESSION['Items'.$identifier]->total + $_SESSION['Items'.$identifier]->FreightCost + $TaxTotal) !=0) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1592,7 +1590,7 @@ /*Could do with setting up a more flexible freight posting schema that looks at the sales type and area of the customer branch to determine where to post the freight recovery */ - if ($_SESSION['Items'.$identifier]->FreightCost !=0) { + if($_SESSION['Items'.$identifier]->FreightCost !=0) { $SQL = "INSERT INTO gltrans ( type, typeno, @@ -1614,8 +1612,8 @@ $DbgMsg = _('The following SQL to insert the GLTrans record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } - foreach ( $TaxTotals as $TaxAuthID => $TaxAmount){ - if ($TaxAmount !=0 ){ + foreach ( $TaxTotals as $TaxAuthID => $TaxAmount) { + if($TaxAmount !=0 ) { $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -1639,8 +1637,8 @@ } } /*end of if Sales and GL integrated */ EnsureGLEntriesBalance(10,$InvoiceNo,$db); - + DB_Txn_Commit(); // ************************************************************************* // E N D O F I N V O I C E S Q L P R O C E S S I N G @@ -1654,25 +1652,25 @@ echo '<br /><div class="centre">'; - if ($_SESSION['InvoicePortraitFormat']==0){ - echo '<img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$RootPath.'/PrintCustTrans.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">' . _('Print this invoice'). ' (' . _('Landscape') . ')</a><br /><br />'; + if($_SESSION['InvoicePortraitFormat']==0) { + echo '<img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$RootPath.'/PrintCustTrans.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">' . _('Print this invoice'). ' (' . _('Landscape') . ')</a><br /><br />'; } else { - echo '<img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$RootPath.'/PrintCustTransPortrait.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">' . _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />'; + echo '<img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$RootPath.'/PrintCustTransPortrait.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">' . _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />'; } - echo '<a href="'.$RootPath.'/SelectSalesOrder.php">' . _('Select another order for invoicing'). '</a><br /><br />'; + echo '<a href="'.$RootPath.'/SelectSalesOrder.php">' . _('Select another order for invoicing'). '</a><br /><br />'; echo '<a href="'.$RootPath.'/SelectOrderItems.php?NewOrder=Yes">' . _('Sales Order Entry') . '</a></div><br />'; /*end of process invoice */ } else { /*Process Invoice not set so allow input of invoice data */ - if (!isset($_POST['Consignment'])) { + if(!isset($_POST['Consignment'])) { $_POST['Consignment']=''; } - if (!isset($_POST['Packages'])) { + if(!isset($_POST['Packages'])) { $_POST['Packages']='1'; } - if (!isset($_POST['InvoiceText'])) { + if(!isset($_POST['InvoiceText'])) { $_POST['InvoiceText']=''; } $j++; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-20 04:00:54 UTC (rev 7598) +++ trunk/doc/Change.log 2016-08-21 03:11:43 UTC (rev 7599) @@ -1,5 +1,6 @@ webERP Change Log +20/08/16 RChacon: In ConfirmDispatch_Invoice.php, fix table html code. 18/08/16 RChacon: In PDFStatementPageHeader.inc, replace addJpegFromFile() and RoundRectangle() functions from class.pdf.php with Image() and RoundedRect() functions from tcpdf.php. 18/08/16 Exson: Add a Cancel button on SupplierAllocations.php to make user can return to previous page easily. 18/08/16 Exson: Add date format validation in PcClaimExpensesFromTab.php. |
From: <ex...@us...> - 2016-08-31 06:32:59
|
Revision: 7605 http://sourceforge.net/p/web-erp/reponame/7605 Author: exsonqu Date: 2016-08-31 06:32:57 +0000 (Wed, 31 Aug 2016) Log Message: ----------- 31/08/16 Exson: Addd new feature assign cash from one tab to another. Modified Paths: -------------- trunk/includes/MainMenuLinksArray.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Added Paths: ----------- trunk/PcAssignCashTabToTab.php Added: trunk/PcAssignCashTabToTab.php =================================================================== --- trunk/PcAssignCashTabToTab.php (rev 0) +++ trunk/PcAssignCashTabToTab.php 2016-08-31 06:32:57 UTC (rev 7605) @@ -0,0 +1,393 @@ +<?php + +include('includes/session.inc'); +$Title = _('Assignment of Cash From Tab To Tab'); +/* webERP manual links before header.inc */ +$ViewTopic= 'PettyCash'; +$BookMark = 'CashAssignment'; +include('includes/header.inc'); + +if (isset($_POST['SelectedTabs'])){ + $SelectedTabs = mb_strtoupper($_POST['SelectedTabs']); +} elseif (isset($_GET['SelectedTabs'])){ + $SelectedTabs = mb_strtoupper($_GET['SelectedTabs']); +} + +if (isset($_POST['Days'])){ + $Days = $_POST['Days']; +} elseif (isset($_GET['Days'])){ + $Days = $_GET['Days']; +} + +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); +} + +if (isset($_POST['Process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error'); + unset($SelectedTabs); + } + if ($SelectedTabs == mb_strtoupper($_POST['SelectedTabsTo'])) { + prnMsg(_('The Tab selected From should not be the same as the selected To'),'error'); + unset($SelectedTabs); + unset($_POST['SelectedTabsTo']); + unset($_POST['Process']); + } +} + +if (isset($_POST['Go'])) { + $InputError = 0; + if ($Days<=0) { + $InputError = 1; + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + +if (isset($_POST['submit'])) { + //initialise no input errors assumed initially before we test + $InputError = 0; + + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . + _('Search') . '" alt="" />' . ' ' . $Title. '</p>'; + + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + + $i=1; + + if ($_POST['Amount']==0) { + $InputError = 1; + prnMsg('<br />' . _('The Amount must be input'),'error'); + } + + $sqlLimit = "SELECT tablimit,tabcode + FROM pctabs + WHERE tabcode IN ('" . $SelectedTabs . "','" . $_POST['SelectedTabsTo'] . "')"; + + $ResultLimit = DB_query($sqlLimit,$db); + while ($LimitRow=DB_fetch_array($ResultLimit)){ + if ($LimitRow['tabcode'] == $SelectedTabs) { + if (($_POST['CurrentAmount']+$_POST['Amount'])>$LimitRow['tablimit']){ + $InputError = 1; + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab') . ' ' . $LimitRow[1],'error'); + } + } elseif ($_POST['SelectedTabsToAmt'] - $_POST['Amount']>$LimitRow['tablimit']) { + $InputError = 1; + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab') . ' ' . $LimitRow[1],'error'); + } + } + + if ($InputError !=1 ) { + // Add these 2 new record on submit + $sql = "INSERT INTO pcashdetails + (counterindex, + tabcode, + date, + codeexpense, + amount, + authorized, + posted, + notes, + receipt) + VALUES (NULL, + '" . $_POST['SelectedTabs'] . "', + '".FormatDateForSQL($_POST['Date'])."', + 'ASSIGNCASH', + '" . filter_number_format($_POST['Amount']) . "', + '0000-00-00', + '0', + '" . $_POST['Notes'] . "', + '" . $_POST['Receipt'] . "' + ), + (NULL, + '" . $_POST['SelectedTabsTo'] . "', + '" . FormatDateForSQL($_POST['Date']) . "', + 'ASSIGNCASH', + '" . filter_number_format(-$_POST['Amount']) . "', + '0000-00-00', + '0', + '" . $_POST['Notes'] . "', + '" . $_POST['Receipt'] . "')"; + $msg = _('Assignment of cash from PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('to') . $_POST['SelectedTabsTo'] . ' ' . _('has been created'); + } + + if ( $InputError !=1) { + //run the SQL from either of the above possibilites + $result = DB_query($sql,$db); + prnMsg($msg,'success'); + unset($_POST['SelectedExpense']); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); + } + +} + +if (!isset($SelectedTabs)){ + + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . + _('Search') . '" alt="" />' . ' ' . $Title. '</p>'; + + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; + echo '<div>'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + $SQL = "SELECT tabcode + FROM pctabs + WHERE assigner='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; + + $result = DB_query($SQL,$db); + + echo '<br /><table class="selection">'; //Main table + + echo '<tr><td>' . _('Petty Cash Tab To Assign Cash From') . ':</td> + <td><select name="SelectedTabs">'; + while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; + } + + echo '</select></td></tr>'; + echo '<tr><td>' . _('Petty Cash Tab To Assign Cash To') . ':</td> + <td><select name="SelectedTabsTo">'; + DB_data_seek($result,0); + while ($myrow = DB_fetch_array($result)) { + if (isset($_POST['SelectTabsTo']) AND $myrow['tabcode'] == $_POST['SelectTabs']) { + echo '<option selected="selected" value="'; + } else { + echo '<option value="'; + } + echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; + } + echo '</select></td></tr>'; + echo '</table>'; // close main table + DB_free_result($result); + + echo '<br /> + <div class="centre"> + <input type="submit" name="Process" value="' . _('Accept') . '" /> + <input type="submit" name="Cancel" value="' . _('Cancel') . '" /> + </div>'; + echo '</div> + </form>'; +} + +//end of ifs and buts! +if (isset($_POST['Process']) OR isset($SelectedTabs)) { + + if (!isset($_POST['submit'])) { + echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' . + _('Search') . '" alt="" />' . ' ' . $Title. '</p>'; + } + echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Select another tab') . '</a></div>'; + + + + if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ + + if (isset($_POST['Cancel'])) { + unset($_POST['Amount']); + unset($_POST['Date']); + unset($_POST['Notes']); + unset($_POST['Receipt']); + } + + if(!isset ($Days)){ + $Days=30; + } + + /* Retrieve decimal places to display */ + $SqlDecimalPlaces="SELECT decimalplaces + FROM currencies,pctabs + WHERE currencies.currabrev = pctabs.currency + AND tabcode='" . $SelectedTabs . "'"; + $result = DB_query($SqlDecimalPlaces,$db); + $myrow=DB_fetch_array($result); + $CurrDecimalPlaces = $myrow['decimalplaces']; + + $sql = "SELECT * FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "' + AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY) + ORDER BY date, counterindex ASC"; + $result = DB_query($sql,$db); + + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <table class="selection"> + <tr> + <th colspan="8">' . _('Detail Of PC Tab Movements For Last') .': + <input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" /> + <input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days') . ' + <input type="submit" name="Go" value="' . _('Go') . '" /></th> + </tr> + <tr> + <th>' . _('Date') . '</th> + <th>' . _('Expense Code') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Authorised') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Receipt') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + $sqldes="SELECT description + FROM pcexpenses + WHERE codeexpense='". $myrow['3'] . "'"; + + $ResultDes = DB_query($sqldes,$db); + $Description=DB_fetch_array($ResultDes); + + if (!isset($Description['0'])){ + $Description['0']='ASSIGNCASH'; + } + + if (($myrow['authorized'] == '0000-00-00') and ($Description['0'] == 'ASSIGNCASH')){ + // only cash assignations NOT authorized can be modified or deleted + echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> + <td>' . $Description['0'] . '</td> + <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td> + <td>' . ConvertSQLDate($myrow['authorized']) . '</td> + <td>' . $myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td> + </tr>'; + }else{ + echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> + <td>' . $Description['0'] . '</td> + <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td> + <td>' . ConvertSQLDate($myrow['authorized']) . '</td> + <td>' . $myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td> + </tr>'; + } + } + //END WHILE LIST LOOP + + $sqlamount="SELECT sum(amount) as amt, + tabcode + FROM pcashdetails + WHERE tabcode IN ('".$SelectedTabs."','" . $_POST['SelectedTabsTo'] . "') + GROUP BY tabcode"; + + $ResultAmount = DB_query($sqlamount,$db); + if (DB_num_rows($ResultAmount)>0) { + while ($AmountRow=DB_fetch_array($ResultAmount)) { + if (is_null($AmountRow['amt'])) { + $AmountRow['amt'] = 0; + } + if ($AmountRow['tabcode'] == $SelectedTabs) { + $SelectedTab = array($AmountRow['amt'],$SelectedTabs); + } else { + $SelectedTabsTo = array($AmountRow['amt'],$_POST['SelectedTabsTo']); + } + } + } + if (!isset($SelectedTab)) { + $SelectedTab = array(0,$SelectedTabs); + $SelectedTabsTo = array(0,$_POST['SelectedTabsTo']); + } + + + + echo '<tr> + <td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> + <td>' . locale_number_format($SelectedTab['0'],$CurrDecimalPlaces) . '</td></tr> + <input type="hidden" name="CurrentAmount" value="' . $SelectedTab[0] . '" /> + <input type="hidden" name="SelectedTabs" value="' . $SelectedTab[1] . '" /> + <input type="hidden" name="SelectedTabsTo" value="' . $SelectedTabsTo[1] . '" /> + <input type="hidden" name="SelectedTabsToAmt" value="' . $SelectedTabsTo[0] . '" />'; + + + echo '</table>'; + echo '</div> + </form>'; + } + + + + echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'"> + <div> + <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +/* Ricard: needs revision of this date initialization */ + if (!isset($_POST['Date'])) { + $_POST['Date']=Date($_SESSION['DefaultDateFormat']); + } + + echo '<br /> + <table class="selection">'; //Main table + echo '<tr> + <th colspan="2"><h3>' . _('New Cash Assignment') . '</h3></th> + </tr>'; + echo '<tr> + <td>' . _('Cash Assignation Date') . ':</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="Date" required="required" autofocus="autofocus" size="10" maxlength="10" value="' . $_POST['Date'] . '" /></td> + </tr>'; + + + if (!isset($_POST['Amount'])) { + $_POST['Amount']=0; + } + + echo '<tr> + <td>' . _('Amount') . ':</td> + <td><input type="text" class="number" name="Amount" size="12" maxlength="11" value="' . locale_number_format($_POST['Amount'],$CurrDecimalPlaces) . '" /></td> + </tr>'; + + if (!isset($_POST['Notes'])) { + $_POST['Notes']=''; + } + + echo '<tr> + <td>' . _('Notes') . ':</td> + <td><input type="text" name="Notes" size="50" maxlength="49" value="' . $_POST['Notes'] . '" /></td> + </tr>'; + + if (!isset($_POST['Receipt'])) { + $_POST['Receipt']=''; + } + + echo '<tr> + <td>' . _('Receipt') . ':</td> + <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '" /></td> + </tr> + </table> + <input type="hidden" name="CurrentAmount" value="' . $SelectedTab['0']. '" /> + <input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" /> + <input type="hidden" name="Days" value="' .$Days. '" /> + <input type="hidden" name="SelectedTabsTo" value="' . $SelectedTabsTo[1] . '" /> + <input type="hidden" name="SelectedTabsToAmt" value="' . $SelectedTabsTo[0] . '" /> + <br /> + <div class="centre"> + <input type="submit" name="submit" value="' . _('Accept') . '" /> + <input type="submit" name="Cancel" value="' . _('Cancel') . '" /></div> + </div> + </form>'; + +} + +include('includes/footer.inc'); +?> Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2016-08-25 21:05:53 UTC (rev 7604) +++ trunk/includes/MainMenuLinksArray.php 2016-08-31 06:32:57 UTC (rev 7605) @@ -446,10 +446,12 @@ '/MaintenanceTasks.php'); $MenuItems['PC']['Transactions']['Caption'] = array(_('Assign Cash to PC Tab'), + _('Cash Transfer Between Tabs'), _('Claim Expenses From PC Tab'), _('Expenses Authorisation')); $MenuItems['PC']['Transactions']['URL'] = array('/PcAssignCashToTab.php', + '/PcAssignCashTabToTab.php', '/PcClaimExpensesFromTab.php', '/PcAuthorizeExpenses.php'); Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-25 21:05:53 UTC (rev 7604) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-31 06:32:57 UTC (rev 7605) @@ -8,5 +8,6 @@ -- standardise transaction date to DATE type: ALTER TABLE `debtortrans` CHANGE `trandate` `trandate` DATE NOT NULL DEFAULT '0000-00-00'; ALTER table supplierdiscounts CONVERT TO CHARACTER SET utf8; +INSERT INTO scripts VALUES ('PcAssignCashTabToTab.php',12,'Assign cash from one tab to another'); |
From: <ex...@us...> - 2016-09-13 08:08:32
|
Revision: 7620 http://sourceforge.net/p/web-erp/reponame/7620 Author: exsonqu Date: 2016-09-13 08:08:29 +0000 (Tue, 13 Sep 2016) Log Message: ----------- 13/09/16 Exson: Make Work Order Entry available with multiple input of items and quantity at one time. Make a option for search items from SO. Add reference and remark field for work orders. Fixed bugs when item coded with # and remove some $db parameters unnecessary. Separate situation without BOM from zero prices. Modified Paths: -------------- trunk/WorkOrderEntry.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2016-09-12 02:36:23 UTC (rev 7619) +++ trunk/WorkOrderEntry.php 2016-09-13 08:08:29 UTC (rev 7620) @@ -63,17 +63,28 @@ $_POST['WO'] = (int)$SelectedWO; $EditingExisting = true; } else { + if (!isset($_POST['Ref'])) { + $Ref = ''; + } + if (!isset($_POST['Remark'])) { + $Remark = ''; + } + // new $_POST['WO'] = GetNextTransNo(40,$db); $SQL = "INSERT INTO workorders (wo, loccode, requiredby, - startdate) + startdate, + reference, + remark) VALUES ( '" . $_POST['WO'] . "', '" . $LocCode . "', '" . $ReqDate . "', - '" . $StartDate. "')"; + '" . $StartDate. "', + '" . $Ref . "', + '" . $Remark . "')"; $InsWOResult = DB_query($SQL); } @@ -99,7 +110,32 @@ 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['Keywords'])>0) { + if (mb_strlen($_POST['SO'])>0) { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled, + salesorderdetails.quantity + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_POST['SO'] . "' + ORDER BY stockmaster.stockid + "; + } elseif(mb_strlen($_POST['CustomerRef'])>0) { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled, + salesorderdetails.quantity + FROM salesorderdetails + INNER JOIN salesorders + ON salesorderdetails.orderno=salesorders.orderno + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorders.customerref='" . $_POST['CustomerRef'] . "' + ORDER BY stockmaster.stockid"; + } elseIf (mb_strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; @@ -107,7 +143,8 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -119,7 +156,8 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -140,7 +178,8 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -152,7 +191,8 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -167,7 +207,8 @@ if ($_POST['StockCat']=='All'){ $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -178,7 +219,8 @@ } else { $SQL = "SELECT stockmaster.stockid, stockmaster.description, - stockmaster.units + stockmaster.units, + stockmaster.controlled FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid @@ -193,6 +235,7 @@ $SQLCount = substr($SQL,strpos($SQL, "FROM")); $SQLCount = substr($SQLCount,0, strpos($SQLCount, "ORDER")); $SQLCount = 'SELECT COUNT(*) '.$SQLCount; + $ErrMsg = _('Failed to retrieve item number'); $SearchResult = DB_query($SQLCount,$ErrMsg); $myrow=DB_fetch_array($SearchResult); @@ -238,48 +281,64 @@ if (DB_num_rows($SearchResult)==1){ $myrow=DB_fetch_array($SearchResult); $NewItem = $myrow['stockid']; + 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){ + $NewItem[] = array('item'=>$value,'qty'=>0); + } + if (strpos($key,'Qty_') !== false AND $value>0) { + $No = substr($key,4); + $NewItem[] = array('item'=>$_POST['Item_'.$No],'qty'=>$value); + } + } +} + if (isset($NewItem) AND isset($_POST['WO'])){ - $InputError=false; - $CheckItemResult = DB_query("SELECT mbflag, + if (!is_array($NewItem)) { + $InputError=false; + $CheckItemResult = DB_query("SELECT mbflag, eoq, controlled FROM stockmaster WHERE stockid='" . $NewItem . "'"); - 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 - $EOQ = 0; + 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 + $EOQ = 0; + } else { + if (!isset($ReqQty)) { + $ReqQty=$CheckItemRow['eoq']; + } + $EOQ = $ReqQty; + } + 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; + } } else { - if (!isset($ReqQty)) { - $ReqQty=$CheckItemRow['eoq']; - } - $EOQ = $ReqQty; + prnMsg(_('The item selected cannot be found in the database'),'error'); + $InputError = true; } - 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; - } - } else { - prnMsg(_('The item selected cannot be found in the database'),'error'); - $InputError = true; - } - $CheckItemResult = DB_query("SELECT stockid + $CheckItemResult = DB_query("SELECT stockid FROM woitems WHERE stockid='" . $NewItem . "' AND wo='" .$_POST['WO'] . "'"); - if (DB_num_rows($CheckItemResult)==1){ - prnMsg(_('This item is already on the work order and cannot be added again'),'warn'); - $InputError=true; - } + 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){ - $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, + if ($InputError==false){ + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, bom.loccode FROM stockmaster INNER JOIN bom @@ -288,21 +347,24 @@ AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') AND bom.effectiveafter<='" . Date('Y-m-d') . "' AND bom.effectiveto>='" . Date('Y-m-d') . "'"); - $CostRow = DB_fetch_array($CostResult); - if (is_null($CostRow['cost']) OR $CostRow['cost']==0){ - $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'); - } else { - $Cost = $CostRow['cost']; - } - if (!isset($EOQ)){ - $EOQ=1; - } + $CostRow = DB_fetch_array($CostResult); + 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) { + $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)){ + $EOQ=1; + } - $Result = DB_Txn_Begin(); + $Result = DB_Txn_Begin(); - // insert parent item info - $SQL = "INSERT INTO woitems (wo, + // insert parent item info + $SQL = "INSERT INTO woitems (wo, stockid, qtyreqd, stdcost) @@ -312,16 +374,110 @@ '" . $EOQ . "', '" . $Cost . "' )"; - $ErrMsg = _('The work order item could not be added'); - $result = DB_query($SQL,$ErrMsg); + $ErrMsg = _('The work order item could not be added'); + $result = DB_query($SQL,$ErrMsg); - //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements - WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $NewItem); + //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements + WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $NewItem); - $result = DB_Txn_Commit(); + $result = DB_Txn_Commit(); + unset($NewItem); + } + } else { + DB_txn_begin($db); + foreach ($NewItem as $ItemDetail) { + $Itm = $ItemDetail['item']; + if ($ItemDetail['qty']>0) { + $ReqQty = $ItemDetail['qty']; + } + $InputError=false; + $CheckItemResult = DB_query("SELECT mbflag, + eoq, + controlled + FROM stockmaster + WHERE stockid='" . $Itm . "'", + $db); + 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 + $EOQ = 0; + } else { + if (!isset($ReqQty)) { + $ReqQty=$CheckItemRow['eoq']; + } + $EOQ = $ReqQty; + } + 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; + } + } else { + prnMsg(_('The item selected cannot be found in the database'),'error'); + $InputError = true; + } + $CheckItemResult = DB_query("SELECT stockid + FROM woitems + WHERE stockid='" . $Itm . "' + AND wo='" .$_POST['WO'] . "'" + ); + 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){ + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, + bom.loccode + FROM stockmaster + INNER JOIN bom + ON stockmaster.stockid=bom.component + WHERE bom.parent='" . $Itm . "' + AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') + 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'])){ + $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) { + $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)){ + $EOQ=1; + } + + + // insert parent item info + $SQL = "INSERT INTO woitems (wo, + stockid, + qtyreqd, + stdcost) + VALUES ( + '" . $_POST['WO'] . "', + '" . $Itm . "', + '" . $EOQ . "', + '" . $Cost . "' + )"; + $ErrMsg = _('The work order item could not be added'); + $result = DB_query($SQL,$ErrMsg); + //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements + WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $Itm); + } //end if there were no input errors + else { + DB_txn_rollback($db); + } + }//end of foreach loop; + + DB_txn_commit($db); unset($NewItem); - } //end if there were no input errors + } } //adding a new item to the work order @@ -359,12 +515,16 @@ if ($QtyRecd==0){ //can only change factory location if Qty Recd is 0 $SQL[] = "UPDATE workorders SET requiredby='" . $SQL_ReqDate . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', - loccode='" . $_POST['StockLocation'] . "' + loccode='" . $_POST['StockLocation'] . "', + reference='" . $_POST['Ref'] . "', + remark='" . $_POST['Remark'] . "' WHERE wo='" . $_POST['WO'] . "'"; } else { prnMsg(_('The factory where this work order is made can only be updated if the quantity received on all output items is 0'),'warn'); $SQL[] = "UPDATE workorders SET requiredby='" . $SQL_ReqDate . "', - startdate='" . FormatDateForSQL($_POST['StartDate']) . "' + startdate='" . FormatDateForSQL($_POST['StartDate']) . "', + reference='" . $_POST['Ref'] . "', + remark='" . $_POST['Remark'] . "' WHERE wo='" . $_POST['WO'] . "'"; } @@ -496,6 +656,7 @@ } //delete items if ($CancelDelete===false) { + //delete items DB_Txn_Begin(); $ErrMsg = _('The work order could not be deleted'); $DbgMsg = _('The SQL used to delete the work order was'); @@ -525,7 +686,9 @@ requiredby, startdate, costissued, - closed + closed, + reference, + remark FROM workorders INNER JOIN locations ON workorders.loccode=locations.loccode INNER JOIN locationusers ON locationusers.loccode=workorders.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 @@ -540,6 +703,8 @@ $_POST['Closed'] = $myrow['closed']; $_POST['RequiredBy'] = ConvertSQLDate($myrow['requiredby']); $_POST['StockLocation'] = $myrow['loccode']; + $_POST['Ref'] = $myrow['reference']; + $_POST['Remark'] = $myrow['remark']; $ErrMsg =_('Could not get the work order items'); $WOItemsResult = DB_query("SELECT woitems.stockid, stockmaster.description, @@ -626,7 +791,22 @@ <td class="label">' . _('Required By') . ':</td> <td><input type="text" name="RequiredBy" size="12" maxlength="12" value="' . $_POST['RequiredBy'] .'" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" /></td> </tr>'; +if (!isset($_POST['Ref'])) { + $_POST['Ref'] = ''; +} +echo '<tr> + <td class="label">' . _('Reference') . ':</td> + <td><input type="text" name="Ref" value="' . $_POST['Ref'] . '" size="12" maxlength="40" /><td> + </tr>'; +if (!isset($_POST['Remark'])) { + $_POST['Remark'] = ''; +} +echo '<tr> + <td class="label">' . _('Remark') . ':</td> + <td><textarea name="Remark" >' . $_POST['Remark'] . '</textarea></td> + </tr>'; + if (isset($WOResult)){ echo '<tr><td class="label">' . _('Accumulated Costs') . ':</td> <td class="number">' . locale_number_format($myrow['costissued'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; @@ -675,13 +855,13 @@ } else { $LotOrSN = _('Batches'); } - echo '<td><a href="' . $RootPath . '/WOSerialNos.php?WO=' . $_POST['WO'] . '&StockID=' . $_POST['OutputItem' .$i] . '&Description=' . $_POST['OutputItemDesc' .$i] . '&Serialised=' . $_POST['Serialised' .$i] . '&NextSerialNo=' . $_POST['NextLotSNRef' .$i] . '">' . $LotOrSN . '</a></td>'; + echo '<td><a href="' . $RootPath . '/WOSerialNos.php?WO=' . $_POST['WO'] . '&StockID=' . urlencode($_POST['OutputItem' .$i]) . '&Description=' . $_POST['OutputItemDesc' .$i] . '&Serialised=' . $_POST['Serialised' .$i] . '&NextSerialNo=' . $_POST['NextLotSNRef' .$i] . '">' . $LotOrSN . '</a></td>'; } } else { echo '<td></td>'; } echo '<td> - <a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=Yes&StockID=' . $_POST['OutputItem' . $i] . '&WO='.$_POST['WO'].'" onclick="return confirm(\''._('Are you sure').'?\');">' . _('Delete') . '</a></td>'; + <a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=Yes&StockID=' . urlencode($_POST['OutputItem' . $i]) . '&WO='.$_POST['WO'].'" onclick="return confirm(\''._('Are you sure').'?\');">' . _('Delete') . '</a></td>'; if ($_SESSION['WikiApp']!=0){ echo '<td>'; @@ -741,6 +921,12 @@ if (!isset($_POST['StockCode'])) { $_POST['StockCode']=''; } +if (!isset($_POST['SO'])) { + $_POST['SO'] = ''; +} +if (!isset($_POST['CustomerRef'])) { + $_POST['CustomerRef'] = ''; +} echo '</select> <td>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</td> @@ -751,6 +937,12 @@ <td><font size="3"><b>' . _('OR') . ' </b></font>' . _('Enter extract of the') . ' <b>' . _('Stock Code') . '</b>:</td> <td><input type="text" name="StockCode" autofocus="autofocus" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> + <tr> + <td><font size="3"><b>' . _('OR') . ' </b></font>' . _('Enter Sales Order') . ' + <input type="text" name="SO" value="' . $_POST['SO'] . '" size="15" /></td> + <td><font size="3"><b>' . _('OR') . ' </b></font>' . _('Enter Customer Order Ref') . '</td> + <td><input type="text" name="CustomerRef" size="20" value="' . $_POST['CustomerRef'] . '" /></td> + </tr> </table> <br /> <div class="centre"> @@ -812,6 +1004,7 @@ echo '<tr class="OddTableRows">'; $k=1; } + if ($myrow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1){ //need to add serial nos or batches to determine quantity printf('<td><font size="1">%s</font></td> <td><font size="1">%s</font></td> @@ -819,18 +1012,49 @@ <td>%s</td> <td><font size="1"><a href="%s">' . _('Add to Work Order') . '</a></font></td> + <td><input type="checkbox" value="%s" name="Check_%s" /></td> </tr>', $myrow['stockid'], $myrow['description'], $myrow['units'], $ImageSource, - htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?WO=' . $_POST['WO'] . '&NewItem=' . $myrow['stockid'].'&Line='.$i); + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?WO=' . $_POST['WO'] . '&NewItem=' . urlencode($myrow['stockid']).'&Line='.$i, + $myrow['stockid'], + $j); + } else { + if (!isset($myrow['quantity'])){ + $myrow['quantity'] = 0; + } + printf('<td><font size="1">%s</font></td> + <td><font size="1">%s</font></td> + <td><font size="1">%s</font></td> + <td>%s</td> + <td><font size="1"><a href="%s">' + . _('Add to Work Order') . '</a></font></td> + <td><input type="text" name="Qty_%s" value="%s" size="10" /><input type="hidden" value="%s" name="Item_%s" /></td> + + </tr>', + $myrow['stockid'], + $myrow['description'], + $myrow['units'], + $ImageSource, + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?WO=' . $_POST['WO'] . '&NewItem=' . urlencode($myrow['stockid']).'&Line='.$i, + $j, + $myrow['quantity'], + $myrow['stockid'], + $j); + } + $j++; } //end if not already on work order }//end of while loop } //end if more than 1 row to show echo '</table>'; + echo '<div class="center"> + <input type="submit" name="Add" value="' . _('Add To Work Order') . '" /> + <input type="hidden" name="WO" value="' . $_POST['WO'] . '" /> + </div>'; }#end if SearchResults to show Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-09-12 02:36:23 UTC (rev 7619) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-09-13 08:08:29 UTC (rev 7620) @@ -9,5 +9,5 @@ ALTER TABLE `debtortrans` CHANGE `trandate` `trandate` DATE NOT NULL DEFAULT '0000-00-00'; ALTER table supplierdiscounts CONVERT TO CHARACTER SET utf8; INSERT INTO scripts VALUES ('PcAssignCashTabToTab.php',12,'Assign cash from one tab to another'); - - +ALTER table workorders ADD remark text DEFAULT NULL; +ALTER table workorders ADD reference varchar(40) NOT NULL DEFAULT ''; |
From: <ex...@us...> - 2016-09-18 08:44:09
|
Revision: 7625 http://sourceforge.net/p/web-erp/reponame/7625 Author: exsonqu Date: 2016-09-18 08:44:07 +0000 (Sun, 18 Sep 2016) Log Message: ----------- 18/09/16 Exson: Add multiple items issue for non-controlled items feature to Work Orders in WorkOrderIssue.php. Modified Paths: -------------- trunk/WorkOrderIssue.php trunk/javascripts/MiscFunctions.js Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2016-09-14 10:05:02 UTC (rev 7624) +++ trunk/WorkOrderIssue.php 2016-09-18 08:44:07 UTC (rev 7625) @@ -415,10 +415,214 @@ include('includes/footer.inc'); exit; } //end if there were not input errors reported - so the processing was allowed to continue -} //end of if the user hit the process button +}//end of if the user hit the process button + elseif (isset($_POST['ProcessMultiple'])){ + $IssueItems = array(); + foreach ($_POST as $key=>$value) { + if (strpos($key,'IssueQty') !==false AND abs(filter_number_format($value))>0) { + $No = substr($key,8); + $InputError = false; //ie assume no problems for a start - ever the optomist + $ErrMsg = _('Could not retrieve the details of the selected work order item'); + $WOResult = DB_query("SELECT workorders.loccode, + locations.locationname, + workorders.closed, + stockcategory.wipact, + stockcategory.stockact + FROM workorders INNER JOIN locations + ON workorders.loccode=locations.loccode + INNER JOIN woitems + ON workorders.wo=woitems.wo + INNER JOIN stockmaster + ON woitems.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE woitems.stockid='" . $_POST['StockID'] . "' + AND woitems.wo='" . $_POST['WO'] . "'", + $ErrMsg); + if (DB_num_rows($WOResult)==0){ + prnMsg(_('The selected work order item cannot be retrieved from the database'),'info'); + include('includes/footer.inc'); + exit; + } + $WORow = DB_fetch_array($WOResult); + if ($WORow['closed']==1){ + prnMsg(_('The work order is closed - no more materials or components can be issued to it.'),'error'); + $InputError=true; + } + $QuantityIssued = filter_number_format($value);; + //Need to get the current standard cost for the item being issued + $SQL = "SELECT materialcost+labourcost+overheadcost AS cost, + controlled, + serialised, + mbflag + FROM stockmaster + WHERE stockid='" .$_POST['Item'.$No] . "'"; + $Result = DB_query($SQL); + $IssueItemRow = DB_fetch_array($Result); + if ($IssueItemRow['cost']==0){ + prnMsg(_('The item being issued has a zero cost. The issue will still be processed '),'warn'); + } + if ($_SESSION['ProhibitNegativeStock']==1 + AND ($IssueItemRow['mbflag']=='M' OR $IssueItemRow['mbflag']=='B')){ + $SQL = "SELECT quantity FROM locstock + WHERE stockid ='" . $_POST['IssueItem'] . "' + AND loccode ='" . $_POST['FromLocation'] . "'"; + $CheckNegResult = DB_query($SQL); + $CheckNegRow = DB_fetch_row($CheckNegResult); + if ($CheckNegRow[0]<$QuantityIssued){ + $InputError = true; + prnMsg(_('This issue cannot be processed because the system parameter is set to prohibit negative stock and this issue would result in stock going into negative. Please correct the stock first before attempting another issue'),'error'); + } + }//end of negative inventory check + $IssueItems[] = array('item'=>$_POST['Item' . $No],'qty'=> $QuantityIssued,'mbflag'=>$IssueItemRow['mbflag'],'cost'=>$IssueItemRow['cost']); + }//end of validation + } + if (isset($InputError) AND $InputError==false){ +/************************ BEGIN SQL TRANSACTIONS ************************/ + $Result = DB_Txn_Begin(); + /*Now Get the next WO Issue transaction type 28 - function in SQL_CommonFunctions*/ + $WOIssueNo = GetNextTransNo(28, $db); + $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); //backdate + $SQLIssuedDate = FormatDateForSQL($_POST['IssuedDate']); + foreach ($IssueItems as $key=>$itm) { + $_POST['IssueItem'] = $itm['item']; + $QuantityIssued = $itm['qty']; + $IssueItemRow['mbflag'] = $itm['mbflag']; + $StockGLCode = GetStockGLCode($_POST['IssueItem'],$db); + $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 */ + $SQL="SELECT locstock.quantity + FROM locstock + WHERE locstock.stockid='" . $_POST['IssueItem'] . "' + AND loccode= '" . $_POST['FromLocation'] . "'"; + $Result = DB_query($SQL); + if (DB_num_rows($Result)==1){ + $LocQtyRow = DB_fetch_row($Result); + $NewQtyOnHand = ($LocQtyRow[0] - $QuantityIssued); + } else { + /*There must actually be some error this should never happen */ + $NewQtyOnHand = 0; + } + + $SQL = "UPDATE locstock + SET quantity = locstock.quantity - " . $QuantityIssued . " + WHERE locstock.stockid = '" . $_POST['IssueItem'] . "' + AND loccode = '" . $_POST['FromLocation'] . "'"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); + $DbgMsg = _('The following SQL to update the location stock record was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + } else { + $NewQtyOnHand =0; //since we can't have stock of labour type items!! + } + /*Insert stock movements - with unit cost */ + $SQL = "INSERT INTO stockmoves (stockid, + type, + transno, + loccode, + trandate, + userid, + price, + prd, + reference, + qty, + standardcost, + newqoh) + VALUES ('" . $_POST['IssueItem'] . "', + 28, + '" . $WOIssueNo . "', + '" . $_POST['FromLocation'] . "', + '" . FormatDateForSQL($_POST['IssuedDate']) . "', + '" . $_SESSION['UserID'] . "', + '" . $IssueItemRow['cost'] . "', + '" . $PeriodNo . "', + '" . $_POST['WO'] . "', + '" . -$QuantityIssued . "', + '" . $IssueItemRow['cost'] . "', + '" . $NewQtyOnHand . "')"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted when processing the work order issue because'); + $DbgMsg = _('The following SQL to insert the stock movement records was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); + if ($_SESSION['CompanyRecord']['gllink_stock']==1){ + /*GL integration with stock is activated so need the GL journals to make it so */ + /*first the debit the WIP of the item being manufactured from the WO + the appropriate account was already retrieved into the $StockGLCode variable as the Processing code is kicked off + it is retrieved from the stock category record of the item by a function in SQL_CommonFunctions.inc*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (28, + '" . $WOIssueNo . "', + '" . FormatDateForSQL($_POST['IssuedDate']) . "', + '" . $PeriodNo . "', + '" . $WORow['wipact'] . "', + '" . $_POST['WO'] . " " . $_POST['IssueItem'] . ' x ' . $QuantityIssued . " @ " . locale_number_format($IssueItemRow['cost'], $_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . ($IssueItemRow['cost'] * $QuantityIssued) . "')"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The issue of the item to the work order GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the work order issue GLTrans record was used'); + $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); + /*now the credit Stock entry*/ + $SQL = "INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (28, + '" . $WOIssueNo . "', + '" . FormatDateForSQL($_POST['IssuedDate']) . "', + '" . $PeriodNo . "', + '" . $StockGLCode['stockact'] . "', + '" . $_POST['WO'] . " " . $_POST['IssueItem'] . ' x ' . $QuantityIssued . " @ " . locale_number_format($IssueItemRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . "', + '" . -($IssueItemRow['cost'] * $QuantityIssued) . "')"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock account credit on the issue of items to a work order GL posting could not be inserted because'); + $DbgMsg = _('The following SQL to insert the stock GLTrans record was used'); + $Result = DB_query($SQL, $ErrMsg, $DbgMsg,true); + + } /* end of if GL and stock integrated and standard cost !=0 */ + + //update the wo with the new qtyrecd + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' ._('Could not update the work order cost issued to the work order because'); + $DbgMsg = _('The following SQL was used to update the work order'); + $UpdateWOResult =DB_query("UPDATE workorders + SET costissued=costissued+" . ($QuantityIssued*$IssueItemRow['cost']) . " + WHERE wo='" . $_POST['WO'] . "'", + $ErrMsg, + $DbgMsg, + true); + + + prnMsg(_('The issue of') . ' ' . $QuantityIssued . ' ' . _('of') . ' ' . $_POST['IssueItem'] . ' ' . _('against work order') . ' '. $_POST['WO'] . ' ' . _('has been processed'),'info'); + } //end of foreach loop; + + $Result = DB_Txn_Commit(); + + echo '<p><ul><li><a href="' . $RootPath . '/WorkOrderIssue.php?WO=' . $_POST['WO'] . '&StockID=' . $_POST['StockID'] . '">' . _('Issue more components to this work order') . '</a></li>'; + echo '<li><a href="' . $RootPath . '/SelectWorkOrder.php">' . _('Select a different work order for issuing materials and components against'). '</a></li></ul>'; + unset($_POST['WO']); + unset($_POST['StockID']); + unset($_POST['FromLocation']); + unset($_POST['Process']); + unset($_POST['SerialNos']); + /*end of process work order issues entry */ + include('includes/footer.inc'); + exit; + } //end if there were not input errors reported - so the processing was allowed to continue + }//end of multiple items input + + + /*User hit the search button looking for an item to issue to the WO */ if (isset($_POST['Search'])){ @@ -654,11 +858,13 @@ <th colspan="2">' . _('Item') . '</th> <th>' . _('Qty Required') . '</th> <th>' . _('Qty Issued') . '</th> + <th>' . _('Qty Issue') . '</th> </tr>'; $RequirmentsResult = DB_query("SELECT worequirements.stockid, stockmaster.description, stockmaster.decimalplaces, + stockmaster.controlled, autoissue, SUM(qtypu*qtyreqd) AS quantityrequired FROM worequirements INNER JOIN stockmaster @@ -678,6 +884,7 @@ $IssuedMaterials[$myrow['stockid']] = $myrow['total']; } + $i = 0; while ($RequirementsRow = DB_fetch_array($RequirmentsResult)){ if ($RequirementsRow['autoissue']==0){ echo '<tr> @@ -696,27 +903,41 @@ } echo '<td class="number">' . locale_number_format($RequirementsRow['quantityrequired'],$RequirementsRow['decimalplaces']) . '</td> - <td class="number">' . locale_number_format($IssuedAlreadyRow,$RequirementsRow['decimalplaces']) . '</td> - </tr>'; + <td class="number">' . locale_number_format($IssuedAlreadyRow,$RequirementsRow['decimalplaces']) . '</td>'; + if ($RequirementsRow['controlled'] == 0) { + echo '<td><input type="text" name="IssueQty' . $i . '" id="IssueQty' . $i . '" /></td> + <td><input type="checkbox" name="CheckQty' . $i . '" value="' . locale_number_format($RequirementsRow['quantityrequired'],$RequirementsRow['decimalplaces']) . '" onclick="AddAmount(this,\'IssueQty' . $i . '\')" /></td> + <input type="hidden" name="Item' . $i . '" value="' . $RequirementsRow['stockid'] . '" />'; + } + + echo '</tr>'; + $i++; } /* now to deal with those addtional issues of items not in BOM */ - if (count($IssuedMaterials)>0){ + if (isset($IssuedMaterials) AND count($IssuedMaterials)>0){ $IssuedStocks = implode("','",array_keys($IssuedMaterials)); $sql = "SELECT stockid, description, - decimalplaces + decimalplaces, + controlled FROM stockmaster WHERE stockid in ('" . $IssuedStocks . "')"; $ErrMsg = _('Failed to retrieve the item data'); $result = DB_query($sql,$ErrMsg); while($myrow = DB_fetch_array($result)){ echo '<tr> - <td><input type="submit" name="IssueItem" value="' . $myrow['stockid'] . '" /></td> + <td><input type="submit" name="IssueItem' . $i . '" value="' . $myrow['stockid'] . '" /></td> <td>' . $myrow['stockid'] . ' - ' . $myrow['description'] . '</td> <td class="number">0</td> - <td class="number">' . locale_number_format($IssuedMaterials[$myrow['stockid']],$myrow['decimalplaces']) . '</td> - </tr>'; + <td class="number">' . locale_number_format($IssuedMaterials[$myrow['stockid']],$myrow['decimalplaces']) . '</td>'; + if ($RequirementsRow['controlled'] == 0) { + echo '<td><input type="text" name="IssueQty' . $i . '" /></td> + <input type="hidden" name="Item' . $i . '" value="' . $myrow['stockid'] . '" />'; + } + echo '</tr>'; + $i++; + } } @@ -724,7 +945,10 @@ echo '</table> - <br />'; + <br /> + <div class="centre"> + <input type="submit" name="ProcessMultiple" value="' . _('Process Items Issued') . '" /> + </div><br/>'; $SQL="SELECT categoryid, categorydescription @@ -816,7 +1040,7 @@ $k=1; } - $IssueLink = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?WO=' . $_POST['WO'] . '&StockID=' . $_POST['StockID'] . '&IssueItem=' . $myrow['stockid'] . '&FromLocation=' . $_POST['FromLocation']; + $IssueLink = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?WO=' . $_POST['WO'] . '&StockID=' . urlencode($_POST['StockID']) . '&IssueItem=' . urlencode($myrow['stockid']) . '&FromLocation=' . $_POST['FromLocation']; printf('<td>%s</td> <td>%s</td> <td>%s</td> @@ -853,6 +1077,11 @@ $ErrMsg = _('Could not get the detail of the item being issued because'); $IssueItemResult = DB_query($sql,$ErrMsg); $IssueItemRow = DB_fetch_array($IssueItemResult); + if ($IssueItemRow['decimalplaces'] <=3) { + $VarianceAllowed = 0.0001; + } else { + $VarianceAllowed = pow(10,-(1+$IssueItemRow['decimalplaces'])); + } echo '<table class="selection"> <tr> @@ -878,7 +1107,7 @@ FROM stockserialitems WHERE stockid='" . $_POST['IssueItem'] . "' AND loccode='" . $_POST['FromLocation'] . "' - AND quantity > 0", + AND quantity > " . $VarianceAllowed, _('Could not retrieve the serial numbers available at the location specified because')); if (DB_num_rows($SerialNoResult)==0){ echo '<tr> @@ -911,7 +1140,7 @@ FROM stockserialitems WHERE stockid='" . $_POST['IssueItem'] . "' AND loccode='" . $_POST['FromLocation'] . "' - AND quantity > 0"; + AND quantity > " . $VarianceAllowed; $ErrMsg = _('Failed to retrieve lot No'); $LotResult = DB_query($LotNoSQL,$ErrMsg); if (DB_num_rows($LotResult)>0) { Modified: trunk/javascripts/MiscFunctions.js =================================================================== --- trunk/javascripts/MiscFunctions.js 2016-09-14 10:05:02 UTC (rev 7624) +++ trunk/javascripts/MiscFunctions.js 2016-09-18 08:44:07 UTC (rev 7625) @@ -355,4 +355,13 @@ if (ds[i].className=="ascending") ds[i].onclick=SortSelect; } } -window.onload=initial; \ No newline at end of file +function AddAmount(t,Target,d) { + if (t.checked) { + document.getElementById(Target).value=Number(t.value); + if(d) document.getElementById(d).required="required"; + } else { + document.getElementById(Target).value=Number(document.getElementById(Target).value)-Number(t.value); + if(d) document.getElementById(d).required=""; + } +} +window.onload=initial; |
From: <rc...@us...> - 2016-09-19 03:55:52
|
Revision: 7627 http://sourceforge.net/p/web-erp/reponame/7627 Author: rchacon Date: 2016-09-19 03:55:49 +0000 (Mon, 19 Sep 2016) Log Message: ----------- Add style to describe how button image should be displayed. Clean up Xenos css. Modified Paths: -------------- trunk/css/aguapop/default.css trunk/css/default/default.css trunk/css/fluid/default.css trunk/css/fresh/default.css trunk/css/gel/default.css trunk/css/professional/default.css trunk/css/professional-rtl/default.css trunk/css/silverwolf/default.css trunk/css/wood/default.css trunk/css/xenos/default.css trunk/doc/Change.log Removed Paths: ------------- trunk/css/xenos/images/ar.gif trunk/css/xenos/images/company.gif trunk/css/xenos/images/folders.gif trunk/css/xenos/images/inventory.gif trunk/css/xenos/images/maintenance.gif trunk/css/xenos/images/reports.gif trunk/css/xenos/images/transactions.gif Modified: trunk/css/aguapop/default.css =================================================================== --- trunk/css/aguapop/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/aguapop/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -7,7 +7,13 @@ by Hindra Joshua -*/ +*/ + +button img { + /* Describes how button image should be displayed. */ + height:32px; + width:32px; +} body { font-family:Arial, Verdana, Helvetica, sans-serif; Modified: trunk/css/default/default.css =================================================================== --- trunk/css/default/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/default/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -5,6 +5,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:16px; + width:16px; +} + body{ background-color:#ccd; font-family:Arial, Verdana, Helvetica, sans-serif; Modified: trunk/css/fluid/default.css =================================================================== --- trunk/css/fluid/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/fluid/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -8,6 +8,12 @@ Beware, the contents is currently not fluid! :D */ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body{ font-family:Arial, Verdana, Helvetica, sans-serif; font-size:10pt; Modified: trunk/css/fresh/default.css =================================================================== --- trunk/css/fresh/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/fresh/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -18,6 +18,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body { font-family: Arial, Verdana, Helvetica, sans-serif; font-size:10pt; Modified: trunk/css/gel/default.css =================================================================== --- trunk/css/gel/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/gel/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -16,6 +16,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body { font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 10pt; Modified: trunk/css/professional/default.css =================================================================== --- trunk/css/professional/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/professional/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -18,6 +18,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body { font-family: Arial, Verdana, Helvetica, sans-serif; font-size:10pt; Modified: trunk/css/professional-rtl/default.css =================================================================== --- trunk/css/professional-rtl/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/professional-rtl/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -19,6 +19,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:16px; + width:16px; +} + body { font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 10px; Modified: trunk/css/silverwolf/default.css =================================================================== --- trunk/css/silverwolf/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/silverwolf/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -16,7 +16,13 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body{ font-family:Arial, Verdana, Helvetica, sans-serif; font-size:10pt; Modified: trunk/css/wood/default.css =================================================================== --- trunk/css/wood/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/wood/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -17,7 +17,13 @@ Notes: - You can remove desk.jpg and/or wood.jpg to get a new look without the textures! -*/ +*/ + +button img { + /* Describes how button image should be displayed. */ + height:24px; + width:24px; +} body{ font-family:Arial, Verdana, Helvetica, sans-serif; Modified: trunk/css/xenos/default.css =================================================================== --- trunk/css/xenos/default.css 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/css/xenos/default.css 2016-09-19 03:55:49 UTC (rev 7627) @@ -11,6 +11,12 @@ ***/ +button img { + /* Describes how button image should be displayed. */ + height:21px; + width:21px; +} + body { font-family:Arial, Verdana, Helvetica, sans-serif; font-size:10pt; Deleted: trunk/css/xenos/images/ar.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/company.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/folders.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/inventory.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/maintenance.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/reports.gif =================================================================== (Binary files differ) Deleted: trunk/css/xenos/images/transactions.gif =================================================================== (Binary files differ) Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-09-18 08:45:31 UTC (rev 7626) +++ trunk/doc/Change.log 2016-09-19 03:55:49 UTC (rev 7627) @@ -1,5 +1,6 @@ webERP Change Log +18/09/16 RChacon: Add style to describe how button image should be displayed. Clean up Xenos css. 18/09/16 Exson: Add multiple items issue for non-controlled items feature to Work Orders in WorkOrderIssue.php. 14/09/16 Exson: Add narrative, transaction date data to PDFOrdersInvoiced.php. 14/09/16: Exson: Add order line narrative and invoices link to sales order inquiry in OrderDetails.php. |
From: <rc...@us...> - 2016-09-21 16:14:24
|
Revision: 7628 http://sourceforge.net/p/web-erp/reponame/7628 Author: rchacon Date: 2016-09-21 16:14:21 +0000 (Wed, 21 Sep 2016) Log Message: ----------- In SuppWhereAlloc.php, accepts the payment multiple creditors. In CustWhereAlloc.php, accepts the receipt of multiple debtors. Modified Paths: -------------- trunk/CustWhereAlloc.php trunk/SuppWhereAlloc.php trunk/doc/Change.log Removed Paths: ------------- trunk/css/xenos/.goutputstream-RI22EX trunk/css/xenos/images/allocation.gif Modified: trunk/CustWhereAlloc.php =================================================================== --- trunk/CustWhereAlloc.php 2016-09-19 03:55:49 UTC (rev 7627) +++ trunk/CustWhereAlloc.php 2016-09-21 16:14:21 UTC (rev 7628) @@ -79,7 +79,7 @@ } $result = DB_query($sql ); - if(DB_num_rows($result)==1) { + if(DB_num_rows($result) > 0) { $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; $CurrCode = $myrow['currcode']; Modified: trunk/SuppWhereAlloc.php =================================================================== --- trunk/SuppWhereAlloc.php 2016-09-19 03:55:49 UTC (rev 7627) +++ trunk/SuppWhereAlloc.php 2016-09-21 16:14:21 UTC (rev 7628) @@ -79,7 +79,7 @@ } $result = DB_query($sql); - if(DB_num_rows($result)==1) { + if(DB_num_rows($result) > 0) { $myrow = DB_fetch_array($result); $AllocToID = $myrow['id']; $CurrCode = $myrow['currcode']; Deleted: trunk/css/xenos/.goutputstream-RI22EX =================================================================== --- trunk/css/xenos/.goutputstream-RI22EX 2016-09-19 03:55:49 UTC (rev 7627) +++ trunk/css/xenos/.goutputstream-RI22EX 2016-09-21 16:14:21 UTC (rev 7628) @@ -1,544 +0,0 @@ -/*** - -Xenos Theme -by Khwunchai J. - -Xenos is a very clean and elegant theme design for WebERP -based on the theme "Fresh" credited for the original designer. - -NOTE: -This CSS is not yet optimized. Some styles maybe redundant and not supported by some browser. - -***/ - -body { - font-family:Arial, Verdana, Helvetica, sans-serif; - font-size:10pt; - margin:0; - padding:0; - background:#F1F1F1; -} - -/*** Default Styles ***/ -a { - color:#0088CD; - text-decoration:none; -} -a:hover { - color:#0088CD; - text-decoration:underline; -} - -img { - border:none; - vertical-align:middle; -} -p.page_title_text { - padding-top:2px; - padding-bottom:2px; - font-size:18px; - color:black; - width:60%; - text-align:center; - margin:10px auto; -} -p.good { - font-weight:bold; - color:green; -} -p.bad { - font-weight:bold; - color:red; -} -table { - background-color:white; - margin:0 auto; - width:100% - border-collapse:collapse; - border-spacing:0; - border:thin solid #B3B3B3; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - background-color:white; -} -table.selection { -} -th { - font-weight:bold; - color:#2C2C2C; - text-align:center; - border-bottom:thin solid #B3B3B3; -} -th.number { - text-align:right; - font-weight:normal; - background-color:#800000; - color:white; -} -th.ascending { - cursor:s-resize; -} -th.descending { - cursor:n-resize; -} -th:after { - content:""; - float:right; - margin-top:7px; - visibility:hidden; -} -th.ascending:after { - border-width:0 4px 4px; - border-style:solid; - border-color:#000 transparent; - visibility:visible; -} -th.descending:after { - border-bottom:none; - border-left:4px solid transparent; - border-right:4px solid transparent; - border-top:4px solid #000; - visibility:visible; -} -td { - text-align:left; - color:#575757; -} -td.select { - /*background-color:#eee;*/ -} -td.number { - text-align:right; -} -div.centre { - margin:0 auto; - text-align:center; -} -input { -} -input.number{ - text-align:right; -} -input.image { - border-width:0px; - background-color:transparent; -} -input:hover{ -} -select { - font-family:Arial, Verdana, Helvetica, sans-serif;; - font-size:12px; - border:thin solid #C3C3C3; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - padding:4px 8px; -} -input.inputerror, input.error, select.error, select.selecterror, label.error { - color:red; - border:2px solid red; -} -input:required, select:required, textarea:required { - background-color:lightyellow; -} -input[type='text'], input[type='tel'], input[type='password'] { - border:thin solid #C3C3C3; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - padding:4px 8px; -} -input[type='submit'] { - background-color:#34a7e8; - border:thin outset #1992DA; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - padding:6px 24px; - vertical-align:middle; - font-weight:bold; - color:#FFFFFF; - box-shadow:1px 1px 1px #64BEF1 inset; -} -textarea{ - border:thin solid #C3C3C3; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - padding:4px 8px; -} -textarea:hover{ -} -.EvenTableRows { - background-color:#72824D; -} -.OddTableRows { - background-color:#CAF17C; -} - -div.error { - color:red; -} -div.warn { - color:maroon; -} -div.success { - color:darkgreen; -} -div.info { - color:navy; -} -div.page_help_text { - background:lightgrey url(images/help.png) top left no-repeat; - border:#a52a2a 1px solid; - padding-top:2px; - padding-bottom:2px; - padding-left:10px; - z-index:1; - width:80%; - float:none; - visibility:visible; - margin:0 auto; - position:static; - font-weight:normal; - color:black; - text-align:center; -} - -/*** Calendar picker ***/ -#calendar{ - -} -.dpTbl { - border: solid navy 1px; -} -.dpTD { - border: 0; - width:20px; - background-color: #EEEEEE; - text-align:right; - cursor:pointer; -} -.dpDayHighlight { - border: 0; - width:20px; - background-color: yellow; - text-align:right; - cursor:pointer; -} -.dpTDHover { - border: 0; - width:20px; - background-color: #CCCCCC; - text-align:right; - cursor:pointer; -} - -/* Table type is used for UI tables type 1 */ -.table1 { - width:90%; - background: #eee; - border: 0px 0px 2px 2px #222 solid; - margin: 0 auto; -} -/* Table type is used for UI tables type 2 */ -.table2 { - width:90%; - background: #eee; - border: 0px 0px 2px 2px #222 solid; - margin: 0 auto; -} -.tableheader { - font-weight: normal; - background-color: #777C59; - color: white; -} -.notavailable { - font-weight:lighter; - font-style:italic; - color:#555555; -} -.label { - font-weight:bold; - font-style:normal; - font-size:120%; - color: #575757; -} -.table_index { - background-color: #F1FFDD; -} - - -.header { - background-image: url(""); - background-repeat: no-repeat; - background-attachment: fixed; - border: none; - margin: 0px; - padding: 0px; -} -input.inputerror { - background-color: #fddbdb; -} -textarea.texterror { - background-color: #fddbdb; -} -select.selecterror { - background-color: #fddbdb; -} -.OsRow { - background-color: #234567; - color: white; -} - -/*** CANVAS ***/ - -#CanvasDiv{ - background:#F1F1F1; - margin:0; -} - -/*** HEADER ***/ - -#HeaderDiv { - overflow:hidden; /* REQUIRED: height according to items contained */ - color:white; - font-weight:bold; - padding-left:3px; - background:#949494; - border-bottom:thin solid #7C7C7C; - height:40px; -} -#HeaderWrapDiv{ -} - -/*** HEADER - APP INFO ***/ - -#AppInfoDiv{ - float:left; /* REQUIRED: to the left */ -} -#AppInfoDiv img{ - vertical-align:middle; /* center image and text vertically */ -} -#AppInfoCompanyDiv{ - display:table-cell; /* REQUIRED: as a cell */ -} -#AppInfoUserDiv{ - display:table-cell; /* REQUIRED: as a cell */ -} -#AppInfoUserDiv a{ - color:white; - font-weight:bold; -} -#AppInfoUserDiv a:hover{ - text-decoration:none; -} -#AppInfoModuleDiv{ -} - -/*** HEADER - QUICK MENU ***/ - -#QuickMenuDiv{ - float:right; /* to the right side */ - margin-top:0.1em; -} -#QuickMenuDiv ul{ - list-style:none; /* hide the bullets */ - margin:0; -} -#QuickMenuDiv li{ - display:inline-block; /* items are inline */ - height:40px; -} - -/*** links as buttons!!! clicking anywhere in the button will activate - the link!!! ***HJ***/ - -#QuickMenuDiv li a{ - border-left:thin outset #5C5C5C; - color:white; - font-weight:bold; - padding:11px 8px; - height:40px; - display:block; -} -#QuickMenuDiv li a:hover{ - background:#444444; - border-left:thin outset #5C5C5C; - text-decoration:none; -} - -/*** BODY ***/ - -#BodyDiv { - clear:both; /* REQUIRED */ - overflow:hidden; /* REQUIRED */ - color:black; - background:#F1F1F1; - padding:5px; - text-align:center; -} -#BodyDiv table { - width:auto; /* automatic width */ - margin:0 auto; - margin-bottom:10px; -} -#BodyDiv table.selection { - background:white; - border:thin outset #D2D2D2; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - padding:5px; -} -/*#BodyDiv .centre{ - margin:0 auto 10px; - text-align:center; -}*/ - -/*** BODY - MAIN MENU ***/ - -#MainMenuDiv{ - float:left; /* REQUIRED: to the left side */ - white-space:nowrap; /* don't break text */ - text-align:center; - width:10%; - border:thin outset #4A4A4A; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - background:#949494; -} -#MainMenuDiv ul{ - list-style:none; /* REQUIRED: hide bullets */ - padding:0; /* REQUIRED: remove extra gaps (ex-bullets) */ - margin:0; -} -#MainMenuDiv li{ - list-style:none; /* REQUIRED */ - padding:0; /* REQUIRED */ -} -#MainMenuDiv li a{ /* link as button!!! not-pressed state */ - display:block; /* REQUIRED */ - padding:3px; - border-top:thin inset #1E1E1E; - color:white; - font-weight:bold; -} -#MainMenuDiv li:first-child a { - border-top: none; -} -#MainMenuDiv li a:hover{ /* link as button!!! pressed state */ - text-decoration:none; - padding:3px; - background:#444444; -} -#MainMenuDiv .main_menu_selected a{ /* the selected button */ - border:thin inset #191919; - background:#2A2A2A; - color:white; -} - -/*** BODY - SUB MENU ***/ - -#SubMenuDiv{ - display:table; /* display as table, sub menu will auto adjust width */ - width:89%; /* main menu is 10% */ - text-align:left; -} -#SubMenuDiv a:link, a:visited{ - color:#0088CD; - text-decoration:none; -} -#SubMenuDiv a:hover{ - color:#0088CD; - text-decoration:none; -} -#SubMenuDiv ul{ - list-style-type:none; /* REQUIRED: hide bullets */ - padding:0; /* REQUIRED: remove extra gaps (ex-bullets) */ - margin-left:3px; - margin-top:0; - margin-bottom:0; - border:thin outset #D2D2D2; - -webkit-border-radius:4px; - -moz-border-radius:4px; - border-radius:4px; - background:white; /* for custom reports */ -} -#SubMenuDiv li{ - /*list-style:none;*/ /* REQUIRED: hide the bullets */ - padding:2px; -} -#SubMenuDiv li img{ - vertical-align:middle; /* verticall align icon with the text */ -} -#SubMenuDiv .menu_group_headers { - border-bottom:thin solid #DADADA; - text-align:center; - color:#2C2C2C; -} -#TransactionsDiv{ - display:table-cell; -} -#InquiriesDiv{ - display:table-cell; -} -#InquiriesDiv div{ /* default div, used for custom report header */ - /*background:#C9D392;*/ - color:black; - padding:2px; - /*border:thin outset #5A5F00;*/ -} -#InquiriesDiv body{ - background:#eee; - color:red; - padding:2px; -} -#MaintenanceDiv{ - display:table-cell; -/* float:left;*/ -/* width:32.5%; - border:thin solid black;*/ - -} -.menu_group_item p { - color:#00f; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ - text-indent:-10px; /* this makes the bullet to appear as the li tag previously used */ - margin:0 0 0 12px; /* One thing that I didnÃÂôt like of the li was that it had no left margin applied */ -} - -/*** FOOTER ***/ - -#FooterDiv{ - clear:both; /* REQUIRED */ - overflow:hidden; - color:#999999; -} -#FooterDiv a{ - text-decoration:underline; - color:#999999; -} -#FooterWrapDiv{ - overflow:hidden; - padding:3px; -} -#FooterLogoDiv{ - float:right; /* right side */ - background:white; - border-radius:8px; - padding:2px; -} -#FooterLogoDiv img { - vertical-align:middle; -} -#FooterVersionDiv{ - float:left; /* left side */ - margin-top:3px; -} -#FooterTimeDiv{ - clear:left; /* below */ -} - -/*** END ***/ \ No newline at end of file Deleted: trunk/css/xenos/images/allocation.gif =================================================================== (Binary files differ) Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-09-19 03:55:49 UTC (rev 7627) +++ trunk/doc/Change.log 2016-09-21 16:14:21 UTC (rev 7628) @@ -1,5 +1,6 @@ webERP Change Log +21/09/16 RChacon: In SuppWhereAlloc.php, accepts the payment multiple creditors. In CustWhereAlloc.php, accepts the receipt of multiple debtors. 18/09/16 RChacon: Add style to describe how button image should be displayed. Clean up Xenos css. 18/09/16 Exson: Add multiple items issue for non-controlled items feature to Work Orders in WorkOrderIssue.php. 14/09/16 Exson: Add narrative, transaction date data to PDFOrdersInvoiced.php. |
From: <dai...@us...> - 2016-09-25 02:00:32
|
Revision: 7634 http://sourceforge.net/p/web-erp/reponame/7634 Author: daintree Date: 2016-09-25 02:00:30 +0000 (Sun, 25 Sep 2016) Log Message: ----------- Simon Kelly: fix to SelectSalesOrder.php to place POs correctly Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log trunk/doc/Manual/ManualContributors.html Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2016-09-24 22:52:11 UTC (rev 7633) +++ trunk/SelectSalesOrder.php 2016-09-25 02:00:30 UTC (rev 7634) @@ -30,12 +30,12 @@ /*Note the button would not have been displayed if the user had no authority to create purchase orders */ $OrdersToPlacePOFor = ''; - for ($i=1;$i<count($_POST);$i++){ - if (isset($_POST['PlacePO_' . $i])) { //checkboxes only set if they are checked + for ($i=0;$i<=count($_POST['PlacePO_']);$i++){ + if (isset($_POST['PlacePO_'][$i])) { //checkboxes only set if they are checked if ($OrdersToPlacePOFor==''){ - $OrdersToPlacePOFor .= " orderno='" . $_POST['OrderNo_PO_'.$i] . "'"; + $OrdersToPlacePOFor .= " orderno='" . $_POST['OrderNo_PO_'][$i] . "'"; } else { - $OrdersToPlacePOFor .= " OR orderno='" . $_POST['OrderNo_PO_'.$i] . "'"; + $OrdersToPlacePOFor .= " OR orderno='" . $_POST['OrderNo_PO_'][$i] . "'"; } } } @@ -782,7 +782,7 @@ <td>%s</td> <td>%s</td> <td class="number">%s</td> - <td><input type="checkbox" name="PlacePO_%s" /><input type="hidden" name="OrderNo_PO_%s" value="%s" /></td> + <td><input type="checkbox" name="PlacePO_[]" /><input type="hidden" name="OrderNo_PO_[]" value="%s" /></td> </tr>', $ModifyPage, $myrow['orderno'], @@ -854,7 +854,11 @@ if ($_POST['Quotations']=='Orders_Only' AND $AuthRow['cancreate']==0){ //cancreate==0 means can create POs - echo '<tfoot><tr><td colspan="11" class="number"><input type="submit" name="PlacePO" value="' . _('Place') . " " . _('PO') . '" onclick="return confirm(\'' . _('This will create purchase orders for all the items on the checked sales orders above, based on the preferred supplier purchasing data held in the system. Are You Absolutely Sure?') . '\');" /></td></tr></tfoot>'; + echo '<tfoot> + <tr> + <td colspan="11" class="number"><input type="submit" name="PlacePO" value="' . _('Place') . " " . _('PO') . '" onclick="return confirm(\'' . _('This will create purchase orders for all the items on the checked sales orders above, based on the preferred supplier purchasing data held in the system. Are You Absolutely Sure?') . '\');" /></td> + </tr> + </tfoot>'; } echo '<tfoot><tr><td colspan="9" class="number">'; if ($_POST['Quotations']=='Orders_Only'){ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-09-24 22:52:11 UTC (rev 7633) +++ trunk/doc/Change.log 2016-09-25 02:00:30 UTC (rev 7634) @@ -1,5 +1,6 @@ webERP Change Log +24/10/16 Simon Kelly: Fixed placing POs for sales orders using array form variable 24/09/16 waynemcdougall: Fixed missing date in Sales Price history 24/09/16 Exson: Make Justify feature workable in addTextWrap in class.pdf.php. 24/09/16 Exson: Fixed the AddTextWrap missing characters errors when there is space and make it more reliable. Modified: trunk/doc/Manual/ManualContributors.html =================================================================== --- trunk/doc/Manual/ManualContributors.html 2016-09-24 22:52:11 UTC (rev 7633) +++ trunk/doc/Manual/ManualContributors.html 2016-09-25 02:00:30 UTC (rev 7634) @@ -41,6 +41,7 @@ <p>Nico Kaiser (php-gettext)</p> <p>CQZ,KE</p> <p>Mo Kelly - due dates and customer po by sales order line</p> + <p>Simon Kelly</p> <p>Meraj Khattak - database diagram</p> <p>Steve Kitchen</p> <p>Ditesh Kumar</p> |
From: <ex...@us...> - 2016-09-25 03:59:04
|
Revision: 7635 http://sourceforge.net/p/web-erp/reponame/7635 Author: exsonqu Date: 2016-09-25 03:59:01 +0000 (Sun, 25 Sep 2016) Log Message: ----------- 25/09/16 Exson: Make the details show immediately when the search result is one in SelectCompletedOrder.php.And add return links in OrderDetails.php. Modified Paths: -------------- trunk/OrderDetails.php trunk/SelectCompletedOrder.php Modified: trunk/OrderDetails.php =================================================================== --- trunk/OrderDetails.php 2016-09-25 02:00:30 UTC (rev 7634) +++ trunk/OrderDetails.php 2016-09-25 03:59:01 UTC (rev 7635) @@ -54,7 +54,9 @@ if (DB_num_rows($GetOrdHdrResult)==1) { echo '<p class="page_title_text"> <img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Order Details') . '" alt="" />' . ' ' . $Title . ' - </p>'; + </p> + <a href="' . $RootPath . '/SelectCompletedOrder.php">' . _('Return to Sales Order Inquiry') . '</a><br/> + <a href="' . $RootPath . '/SelectCustomer.php">' . _('Return to Customer Inquiry Interface') . '</a>'; $myrow = DB_fetch_array($GetOrdHdrResult); $CurrDecimalPlaces = $myrow['decimalplaces']; Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2016-09-25 02:00:30 UTC (rev 7634) +++ trunk/SelectCompletedOrder.php 2016-09-25 03:59:01 UTC (rev 7635) @@ -547,6 +547,14 @@ //end if stock search results to show If (isset($SalesOrdersResult)) { + if (DB_num_rows($SalesOrdersResult) == 1) { + if (!isset($OrderNumber)) { + $ordrow = DB_fetch_array($SalesOrdersResult); + $OrderNumber = $ordrow['orderno']; + } + header('location:' . $RootPath .'/OrderDetails.php?OrderNumber=' . $OrderNumber); + exit; + } /*show a table of the orders returned by the SQL */ |
From: <way...@us...> - 2016-09-24 22:52:13
|
Revision: 7633 http://sourceforge.net/p/web-erp/reponame/7633 Author: waynemcdougall Date: 2016-09-24 22:52:11 +0000 (Sat, 24 Sep 2016) Log Message: ----------- Variable not renamed in r3146 - fix so date shows on Stock Price History Also correct comment spelling pirce to price Revision Links: -------------- http://sourceforge.net/p/web-erp/reponame/3146 Modified Paths: -------------- trunk/StockStatus.php trunk/doc/Change.log Modified: trunk/StockStatus.php =================================================================== --- trunk/StockStatus.php 2016-09-24 10:30:21 UTC (rev 7632) +++ trunk/StockStatus.php 2016-09-24 22:52:11 UTC (rev 7633) @@ -301,7 +301,7 @@ break; /* 10 price records is enough to display */ } if ($myrow['trandate'] < FormatDateForSQL(DateAdd(date($_SESSION['DefaultDateFormat']),'y', -1))) { - break; /* stop displaying pirce history more than a year old once we have at least one to display */ + break; /* stop displaying price history more than a year old once we have at least one to display */ } } $LastPrice = $myrow['price']; @@ -355,7 +355,7 @@ <td class="number">%s</td> <td class="number">%s%%</td> </tr>', - $ph[0], + $PreviousPrice[0], locale_number_format($PreviousPrice[1],$DecimalPlaces), locale_number_format($PreviousPrice[2],$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($PreviousPrice[3]*100,2)); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-09-24 10:30:21 UTC (rev 7632) +++ trunk/doc/Change.log 2016-09-24 22:52:11 UTC (rev 7633) @@ -1,12 +1,13 @@ webERP Change Log +24/09/16 waynemcdougall: Fixed missing date in Sales Price history 24/09/16 Exson: Make Justify feature workable in addTextWrap in class.pdf.php. 24/09/16 Exson: Fixed the AddTextWrap missing characters errors when there is space and make it more reliable. 21/09/16 RChacon: In SuppWhereAlloc.php, accepts the payment multiple creditors. In CustWhereAlloc.php, accepts the receipt of multiple debtors. 18/09/16 RChacon: Add style to describe how button image should be displayed. Clean up Xenos css. 18/09/16 Exson: Add multiple items issue for non-controlled items feature to Work Orders in WorkOrderIssue.php. 14/09/16 Exson: Add narrative, transaction date data to PDFOrdersInvoiced.php. -14/09/16: Exson: Add order line narrative and invoices link to sales order inquiry in OrderDetails.php. +14/09/16 Exson: Add order line narrative and invoices link to sales order inquiry in OrderDetails.php. 12/09/16 Exson: Add a filter to avoid tons of zero valued gl transaction records generated in SQL_CommonFunctions.inc. 04/09/16 Exson: Add WO items delete constraint in WorkOrderEntry.php. Thanks for Phil's reminder. 04/09/16 Exson: Add delete Work orders Items feature in WorkOrderEntry.php. |
From: <ex...@us...> - 2016-09-25 10:38:49
|
Revision: 7637 http://sourceforge.net/p/web-erp/reponame/7637 Author: exsonqu Date: 2016-09-25 10:38:47 +0000 (Sun, 25 Sep 2016) Log Message: ----------- 25/09/16 Exson: Make customer reference GET method workable in SelectCompletedOrder.php. Fixed decimalplaces missing bug in SelectOrderItems.php. Add due date, order date and customer reference option in SelectSalesOrder.php. Modified Paths: -------------- trunk/SelectCompletedOrder.php trunk/SelectOrderItems.php trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectCompletedOrder.php =================================================================== --- trunk/SelectCompletedOrder.php 2016-09-25 03:59:49 UTC (rev 7636) +++ trunk/SelectCompletedOrder.php 2016-09-25 10:38:47 UTC (rev 7637) @@ -35,6 +35,7 @@ } if (isset($_GET['CustomerRef'])){ $CustomerRef = $_GET['CustomerRef']; + $CustomerGet = 1; } elseif (isset($_POST['CustomerRef'])){ $CustomerRef = $_POST['CustomerRef']; } @@ -236,7 +237,7 @@ echo '<br />' . _('For the part') . ': ' . $SelectedStockItem . ' ' . _('and') . ' <input type="hidden" name="SelectedStockItem" value="' . $SelectedStockItem . '" />'; } } -} else if (isset($_POST['SearchOrders']) AND Is_Date($_POST['OrdersAfterDate'])==1) { +} else if ((isset($_POST['SearchOrders']) AND Is_Date($_POST['OrdersAfterDate'])==1) OR (isset($CustomerGet))) { //figure out the SQL required from the inputs available if (isset($OrderNumber)) { Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2016-09-25 03:59:49 UTC (rev 7636) +++ trunk/SelectOrderItems.php 2016-09-25 10:38:47 UTC (rev 7637) @@ -1026,7 +1026,7 @@ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); if ($_POST['Discount_' . $OrderLine->LineNumber] < 100) {//to avoid divided by zero error - $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100)/100); + $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100)/100); } else { $_POST['GPPercent_' . $OrderLine->LineNumber] = 0; } @@ -1495,9 +1495,9 @@ // This code needs sorting out, but until then : $ImageSource = _('No Image'); // Find the quantity in stock at location - $QOHSQL = "SELECT sum(locstock.quantity) AS qoh - FROM locstock - WHERE stockid='" .$myrow['stockid'] . "' + $QOHSQL = "SELECT sum(locstock.quantity) AS qoh,decimalplaces + FROM locstock INNER JOIN stockmaster ON stockmaster.stockid=locstock.stockid + WHERE locstock.stockid='" .$myrow['stockid'] . "' AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'"; $QOHResult = DB_query($QOHSQL); $QOHRow = DB_fetch_array($QOHResult); Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2016-09-25 03:59:49 UTC (rev 7636) +++ trunk/SelectSalesOrder.php 2016-09-25 10:38:47 UTC (rev 7637) @@ -9,6 +9,9 @@ $BookMark = "SelectSalesOrder"; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (isset($_POST['Reset'])) { + unset($_POST); +} if (isset($_GET['SelectedStockItem'])) { $SelectedStockItem = $_GET['SelectedStockItem']; @@ -25,7 +28,7 @@ } else { unset($SelectedCustomer); } - + if (isset($_POST['PlacePO'])){ /*user hit button to place PO for selected orders */ /*Note the button would not have been displayed if the user had no authority to create purchase orders */ @@ -424,6 +427,9 @@ } else { unset($OrderNumber); } +if (isset($_POST['CustomerRef'])) { + $CustomerRef = $_POST['CustomerRef']; +} if (isset($OrderNumber) AND $OrderNumber!='') { $OrderNumber = trim($OrderNumber); @@ -503,15 +509,50 @@ if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Quotes_Only'){ echo '<option selected="selected" value="Quotes_Only">' . _('Quotations Only') . '</option>'; echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; + echo '<option value="Overdue_Only">' . _('Overdue Only') . '</option>'; + } elseif (isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Overdue_Only'){ + echo '<option selected="selected" value="Overdue_Only">' . _('Overdue Only') . '</option>'; + echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; + echo '<option value="Orders_Only">' . _('Orders Only') . '</option>'; } else { echo '<option selected="selected" value="Orders_Only">' . _('Orders Only') . '</option>'; echo '<option value="Quotes_Only">' . _('Quotations Only') . '</option>'; + echo '<option value="Overdue_Only">' . _('Overdue Only') . '</option>'; } + if (!isset($_POST['DueDateFrom'])) { + $_POST['DueDateFrom'] = ''; + } + if (!isset($_POST['DueDateTo'])) { + $_POST['DueDateTo'] = ''; + } + if (!isset($_POST['CustomerRef'])) { + $_POST['CustomerRef'] = ''; + } + if (!isset($_POST['OrderDateFrom'])) { + $_POST['OrderDateFrom'] = ''; + } + if (!isset($_POST['OrderDateTo'])) { + $_POST['OrderDateTo'] = ''; + } + echo '</select> </td> + <td>' . _('Due Date From') . '</td> + <td><input type="text" class="date" name="DueDateFrom" value="' . $_POST['DueDateFrom'] . '" alt="' . $_SESSION['DefaultDateFormat'] . '" size="10" /></td> + <td>' . _('Due Date To') . '</td> + <td><input type="text" class="date" name="DueDateTo" value="' . $_POST['DueDateTo'] . '" alt="' . $_SESSION['DefaultDateFormat'] . '" size="10" /></td> <td><input type="submit" name="SearchOrders" value="' . _('Search') . '" /></td> + <td><input type="submit" name="Reset" value="' . _('Reset') . '" /></td> <td><a href="' . $RootPath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Add Sales Order') . '</a></td> </tr> + <tr> + <td>' . _('Customer Ref') . '</td> + <td><input type="text" name="CustomerRef" value="' . $_POST['CustomerRef'] . '" size="12" /></td> + <td>' . _('Order Date From') . '</td> + <td><input type="text" name="OrderDateFrom" value="' . $_POST['OrderDateFrom'] . '" size="10" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" /></td> + <td>' . _('Order Date To') . '</td> + <td><input type="text" name="OrderDateTo" value="' . $_POST['OrderDateTo'] . '" size="10" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" /></td> + </tr> </table>'; } @@ -601,13 +642,42 @@ //figure out the SQL required from the inputs available if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ $Quotations = 0; + } elseif(isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Quotations_Only') { + $Quotations =1; + } elseif(isset($_POST['Quotations']) AND $_POST['Quotations'] == 'Overdue_Only') { + $Quotations = "0 AND itemdue<'" . Date('Y-m-d') . "'"; } else { - $Quotations =1; + $Quotations = 0; } + if (isset($_POST['DueDateFrom']) AND is_date($_POST['DueDateFrom'])) { + $DueDateFrom = " AND itemdue>='" . FormatDateForSQL($_POST['DueDateFrom']) . "' "; + } else { + $DueDateFrom = ''; + } + if (isset($_POST['DueDateTo']) AND is_date($_POST['DueDateTo'])) { + $DueDateTo = " AND itemdue<='" . FormatDateForSQL($_POST['DueDateTo']) . "'"; + } else { + $DueDateTo = ''; + } + if (isset($_POST['OrderDateFrom']) AND is_date($_POST['OrderDateFrom'])) { + $OrderDateFrom = " AND orddate >='" . FormatDateForSQL($_POST['OrderDateFrom']) . "' "; + } else { + $OrderDateFrom = ''; + } + if (isset($_POST['OrderDateTo']) AND is_date($_POST['OrderDateTo'])) { + $OrderDateTo = " AND orddate <='" . FormatDateForSQL($_POST['OrderDateTo']) . "' "; + } else { + $OrderDateTo = ''; + } + if(!isset($_POST['StockLocation'])) { $_POST['StockLocation'] = ''; } //Harmonize the ordervalue with SUM function since webERP allowed same items appeared several times in one sales orders. If there is no sum value, this situation not inclued. + //We should separate itemdue inquiry from normal inquiry. + if (($Quotations === 0 OR $Quotations === 1) + AND (!isset($DueDateFrom) OR !is_date($DueDateFrom)) + AND (!isset($DueDateTo) OR !is_date($DueDateTo))) { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, @@ -629,6 +699,76 @@ INNER JOIN currencies ON debtorsmaster.currcode = currencies.currabrev WHERE salesorderdetails.completed=0 "; + $SQL .= $OrderDateFrom . $OrderDateTo; + } else { + if ($Quotations !==0 AND $Quotations !==1) {//overdue inquiry only + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + salesorders.printedpackingslip, + salesorders.poplaced, + SUM(CASE WHEN itemdue<'" . Date('Y-m-d') . "' + THEN salesorderdetails.unitprice*(salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*(1-salesorderdetails.discountpercent)/currencies.rate + ELSE 0 END) as ordervalue"; + } elseif (isset($DueDateFrom) AND is_date($DueDateFrom) AND (!isset($DueDateTo) OR !is_date($DueDateTo))) { + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + salesorders.printedpackingslip, + salesorders.poplaced, + SUM(CASE WHEN itemdue>='" . FormatDateFromSQL($DueDateFrom) . "' + THEN salesorderdetails.unitprice*(salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*(1-salesorderdetails.discountpercent)/currencies.rate + ELSE 0 END) as ordervalue"; + } elseif (isset($DueDateFrom) AND is_date($DueDateFrom) AND isset($DueDateTo) AND is_date($DueDateTo)) { + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + salesorders.printedpackingslip, + salesorders.poplaced, + SUM (CASE WHEN itemdue>='" . FormatDateForSQL($DueDateFrom) . "' AND itemdue<='" . FormatDateForSQL($DueDateTo) ."' + THEN salesorderdetails.unitprice*(salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*(1-salesorderdetails.discountpercent)/currencies.rate + ELSE 0 END) as ordervalue"; + } elseif ((!isset($DueDateFrom) OR !is_date($DueDateFrom)) AND isset($DueDateTo) AND is_date($DueDateTo)) { + $SQL = "SELECT salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + salesorders.printedpackingslip, + salesorders.poplaced, + SUM(CASE WHEN AND itemdue<='" . FormatDateForSQL($DueDateTo) ."' + THEN salesorderdetails.unitprice*(salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*(1-salesorderdetails.discountpercent)/currencies.rate + ELSE 0 END) as ordervalue"; + }//end of due date inquiry + $SQL .= $OrderDateFrom . $OrderDateTo; + + + $SQL .=" FROM salesorders INNER JOIN salesorderdetails + ON salesorders.orderno = salesorderdetails.orderno + INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN custbranch + ON debtorsmaster.debtorno = custbranch.debtorno + AND salesorders.branchcode = custbranch.branchcode + INNER JOIN currencies + ON debtorsmaster.currcode = currencies.currabrev + WHERE salesorderdetails.completed=0 "; + } + //Add salesman role control if ($_SESSION['SalesmanLogin'] != '') { $SQL .= " AND salesorders.salesperson='" . $_SESSION['SalesmanLogin'] . "'"; @@ -639,46 +779,52 @@ $SQL .= "AND salesorders.orderno=". $OrderNumber ." AND salesorders.quotation=" .$Quotations; - } else { - /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ + + } elseif (isset($CustomerRef) AND $CustomerRef != ''){ + $SQL .= "AND salesorders.customerref='" . $CustomerRef . "' + AND salesorders.quotation=" . $Quotations; + + } else { + /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ - if (isset($SelectedCustomer)) { + if (isset($SelectedCustomer)) { - if (isset($SelectedStockItem)) { - $SQL .= "AND salesorders.quotation =" .$Quotations . " - AND salesorderdetails.stkcode='". $SelectedStockItem ."' - AND salesorders.debtorno='" . $SelectedCustomer ."' - AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; + if (isset($SelectedStockItem)) { + $SQL .= "AND salesorders.quotation =" .$Quotations . " + AND salesorderdetails.stkcode='". $SelectedStockItem ."' + AND salesorders.debtorno='" . $SelectedCustomer ."' + AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; - } else { - $SQL .= "AND salesorders.quotation =" .$Quotations . " - AND salesorders.debtorno='" . $SelectedCustomer . "' - AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; + } else { + $SQL .= "AND salesorders.quotation =" .$Quotations . " + AND salesorders.debtorno='" . $SelectedCustomer . "' + AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; - } - } else { //no customer selected - if (isset($SelectedStockItem)) { - $SQL .= "AND salesorders.quotation =" .$Quotations . " - AND salesorderdetails.stkcode='". $SelectedStockItem . "' - AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; - } else { - $SQL .= "AND salesorders.quotation =" .$Quotations . " - AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; - } + } + } else { //no customer selected + if (isset($SelectedStockItem)) { + $SQL .= "AND salesorders.quotation =" .$Quotations . " + AND salesorderdetails.stkcode='". $SelectedStockItem . "' + AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; + } else { + $SQL .= "AND salesorders.quotation =" .$Quotations . " + AND salesorders.fromstkloc = '". $_POST['StockLocation'] . "'"; + } - } //end selected customer + } //end selected customer + $SQL .= $DueDateFrom . $DueDateTo; - $SQL .= ' GROUP BY salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverydate, - salesorders.deliverto, - salesorders.printedpackingslip, - salesorders.poplaced - ORDER BY salesorders.orderno'; - } //end not order number selected + $SQL .= ' GROUP BY salesorders.orderno, + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverydate, + salesorders.deliverto, + salesorders.printedpackingslip, + salesorders.poplaced + ORDER BY salesorders.orderno'; + } //end not order number selected $ErrMsg = _('No orders or quotations were returned by the SQL because'); $SalesOrdersResult = DB_query($SQL,$ErrMsg); @@ -698,7 +844,7 @@ echo '<table cellpadding="2" width="95%" class="selection">'; - if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ + if (isset($_POST['Quotations']) AND ($_POST['Quotations']=='Orders_Only' OR $_POST['Quotations'] == 'Overdue_Only')){ $TableHeader = '<tr> <th class="ascending" >' . _('Modify') . '</th> <th>' . _('Invoice') . '</th> @@ -761,6 +907,11 @@ $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$_SESSION['CompanyRecord']['decimalplaces']); + if ($myrow['customerref'] !== '') { + $CustomerRef = '<a href="' . $RootPath . '/SelectCompletedOrder.php?CustomerRef=' . $myrow['customerref'] . '" target="_blank">' . $myrow['customerref'] . '</a>'; + } else { + $CustomerRef = ''; + } if ($myrow['printedpackingslip']==0) { $PrintText = _('Print'); @@ -768,7 +919,7 @@ $PrintText = _('Reprint'); } - if ($_POST['Quotations']=='Orders_Only'){ + if ($_POST['Quotations']=='Orders_Only' OR $_POST['Quotations']=='Overdue_Only'){ /*Check authority to create POs if user has authority then show the check boxes to select sales orders to place POs for otherwise don't provide this option */ if ($AuthRow['cancreate']==0 AND $myrow['poplaced']==0){ //cancreate==0 if the user can create POs and not already placed @@ -790,7 +941,7 @@ $PrintDispatchNote, $myrow['name'], $myrow['brname'], - $myrow['customerref'], + $CustomerRef, $FormatedOrderDate, $FormatedDelDate, html_entity_decode($myrow['deliverto'],ENT_QUOTES,'UTF-8'), Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-09-25 03:59:49 UTC (rev 7636) +++ trunk/doc/Change.log 2016-09-25 10:38:47 UTC (rev 7637) @@ -1,5 +1,6 @@ webERP Change Log +25/09/16 Exson: Make customer reference GET method workable in SelectCompletedOrder.php. Fixed decimalplaces missing bug in SelectOrderItems.php. Add due date, order date and customer reference option in SelectSalesOrder.php. 25/09/16 Exson: Make the details show immediately when the search result is one in SelectCompletedOrder.php.And add return links in OrderDetails.php. 24/10/16 Simon Kelly: Fixed placing POs for sales orders using array form variable 24/09/16 waynemcdougall: Fixed missing date in Sales Price history |