From: <tim...@us...> - 2010-07-25 22:07:45
|
Revision: 3662 http://web-erp.svn.sourceforge.net/web-erp/?rev=3662&view=rev Author: tim_schofield Date: 2010-07-25 22:07:39 +0000 (Sun, 25 Jul 2010) Log Message: ----------- Correctly show decimal places< Modified Paths: -------------- trunk/PrintCustTrans.php trunk/doc/Change.log.html Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Modified: svn:mergeinfo - /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 + /branches/utf-8:3087 /branches/utf-8_xfer:3160-3162 Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2010-07-25 21:49:42 UTC (rev 3661) +++ trunk/PrintCustTrans.php 2010-07-25 22:07:39 UTC (rev 3662) @@ -197,7 +197,8 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . '* -stockmoves.qty) AS fxnet, (stockmoves.price * ' . $ExchRate . ') AS fxprice, stockmoves.narrative, - stockmaster.units + stockmaster.units, + stockmaster.decimalplaces FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid @@ -213,7 +214,8 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, (stockmoves.price * ' . $ExchRate . ') AS fxprice, stockmoves.narrative, - stockmaster.units + stockmaster.units, + stockmaster.decimalplaces FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid @@ -252,8 +254,8 @@ $DisplayQty = $myrow2['quantity']; $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x, $YPos,$FormDesign->Data->Column1->Length, $FormDesign->Data->Column1->FontSize, $myrow2['stockid']); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x, $YPos,$FormDesign->Data->Column2->Length, $FormDesign->Data->Column2->FontSize, $myrow2['description']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x, $YPos,$FormDesign->Data->Column3->Length, $FormDesign->Data->Column3->FontSize, $DisplayPrice, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x, $YPos,$FormDesign->Data->Column4->Length, $FormDesign->Data->Column4->FontSize, $DisplayQty, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x, $YPos,$FormDesign->Data->Column3->Length, $FormDesign->Data->Column3->FontSize, number_format($DisplayPrice,4), 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x, $YPos,$FormDesign->Data->Column4->Length, $FormDesign->Data->Column4->FontSize, number_format($DisplayQty,$myrow2['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x, $YPos,$FormDesign->Data->Column5->Length, $FormDesign->Data->Column5->FontSize, $myrow2['units'], 'centre'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x, $YPos,$FormDesign->Data->Column6->Length, $FormDesign->Data->Column6->FontSize, $DisplayDiscount, 'right'); $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x, $YPos,$FormDesign->Data->Column7->Length, $FormDesign->Data->Column7->FontSize, $DisplayNet, 'right'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-25 21:49:42 UTC (rev 3661) +++ trunk/doc/Change.log.html 2010-07-25 22:07:39 UTC (rev 3662) @@ -1,8 +1,9 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>25/07/10 Phil: SelectContract.php new script to select a contract -<p>25/07/10 Phil: ContractOtherReqts.php new script to enter other requirements for a contract -<p>25/07/10 Phil: Contracts.php and includes/DefineContractClass.php debugging +<p>25/07/10 Tim: PrintCustTrans.php - Correctly show decimal places</p> +<p>25/07/10 Phil: SelectContract.php new script to select a contract</p> +<p>25/07/10 Phil: ContractOtherReqts.php new script to enter other requirements for a contract</p> +<p>25/07/10 Phil: Contracts.php and includes/DefineContractClass.php debugging</p> <p>22/07/10 Tim: GLAccountInquiry.php - Add in running balance. Cumulative for BS account, and period for PL accounts.</p> <p>22/07/10 Simon Peter Otandeka: FixedAssetList.php - New script that provides a simple list of assets and their properties.</p> <p>22/07/10 Tim: FixedAssetJournal.php - Corrections to depreciation calculation layout changes, and sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 12:56:01
|
Revision: 3664 http://web-erp.svn.sourceforge.net/web-erp/?rev=3664&view=rev Author: tim_schofield Date: 2010-07-26 12:55:55 +0000 (Mon, 26 Jul 2010) Log Message: ----------- New script to show daily bank transactions in bank account currency, and local currency Modified Paths: -------------- trunk/doc/Change.log.html trunk/index.php trunk/sql/mysql/upgrade3.11.1-3.12.sql Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-25 22:10:13 UTC (rev 3663) +++ trunk/doc/Change.log.html 2010-07-26 12:55:55 UTC (rev 3664) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: DailyBankTransactions.php - New script to show daily bank transactions in bank account currency, and local currency</p> <p>25/07/10 Tim: PrintCustTrans.php - Correctly show decimal places</p> <p>25/07/10 Phil: SelectContract.php new script to select a contract</p> <p>25/07/10 Phil: ContractOtherReqts.php new script to enter other requirements for a contract</p> Modified: trunk/index.php =================================================================== --- trunk/index.php 2010-07-25 22:10:13 UTC (rev 3663) +++ trunk/index.php 2010-07-26 12:55:55 UTC (rev 3664) @@ -1192,6 +1192,11 @@ </tr> <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/DailyBankTransactions.php?' . sid . '">' . _('Daily Bank Transactions') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . "/GLProfit_Loss.php?" . sid . '">' . _('Profit and Loss Statement') . '</a></p>'; ?> </td> </tr> @@ -1336,7 +1341,7 @@ <tr> <td class="menu_group_items"> <!-- Contract Costing transactions options --> <table width="100%" class="table_index"> - + <tr> </table> </td> Modified: trunk/sql/mysql/upgrade3.11.1-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-25 22:10:13 UTC (rev 3663) +++ trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-26 12:55:55 UTC (rev 3664) @@ -282,3 +282,4 @@ UPDATE `securitytokens` SET `tokenname`='Prices Security' WHERE tokenid=12; ALTER TABLE `www_users` CHANGE `supplierid` `supplierid` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; +ALTER TABLE `orderdeliverydifferenceslog` DROP PRIMARY KEY; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 14:50:15
|
Revision: 3666 http://web-erp.svn.sourceforge.net/web-erp/?rev=3666&view=rev Author: tim_schofield Date: 2010-07-26 14:50:09 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections Modified Paths: -------------- trunk/PDFBankingSummary.php trunk/doc/Change.log.html Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2010-07-26 13:06:13 UTC (rev 3665) +++ trunk/PDFBankingSummary.php 2010-07-26 14:50:09 UTC (rev 3666) @@ -17,17 +17,17 @@ include ('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . - $title . '" alt="">' . ' ' . $title . ''; + $title . '" alt="">' . ' ' . $title . '</p>'; - $sql='SELECT DISTINCT - transno, - transdate - FROM banktrans + $sql='SELECT DISTINCT + transno, + transdate + FROM banktrans WHERE type=12 ORDER BY transno DESC'; $result=DB_query($sql, $db); - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '><br><table>'; + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '><table class=selection>'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name=BatchNo>'; while ($myrow=DB_fetch_array($result)) { @@ -53,7 +53,7 @@ FROM bankaccounts, banktrans WHERE bankaccounts.accountcode=banktrans.bankact - AND banktrans.transno=' . $_POST['BatchNo'] . ' + AND banktrans.transno="' . $_POST['BatchNo'] . '" AND banktrans.type=12'; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; @@ -86,8 +86,8 @@ FROM debtorsmaster, debtortrans WHERE debtorsmaster.debtorno=debtortrans.debtorno - AND debtortrans.transno=" . $_POST['BatchNo'] . ' - AND debtortrans.type=12'; + AND debtortrans.transno='" . $_POST['BatchNo'] . "' + AND debtortrans.type=12"; $CustRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ @@ -105,8 +105,8 @@ FROM gltrans WHERE gltrans.typeno=" . $_POST['BatchNo'] . " AND gltrans.type=12 and gltrans.amount <0 - AND gltrans.account !=" . $myrow['bankact'] . ' - AND gltrans.account !=' . $_SESSION['CompanyRecord']['debtorsact']; + AND gltrans.account !='" . $myrow['bankact'] . "' + AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; $GLRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ @@ -191,15 +191,5 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf');//UldisN $pdf->__destruct(); //UldisN } -/* -} else { - $title = _('Create PDF Print Out For A Batch Of Receipts'); - include ('includes/header.inc'); - echo '<br>'; - prnMsg(_('You must first enter a batch number that you want to print'),'warning'); - echo '<br><div class="centre"><a href="'.$_SERVER['PHP_SELF'].'">'._('Return to Entry screen').'</a>'; - include ('includes/footer.inc'); -} -*/ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 13:06:13 UTC (rev 3665) +++ trunk/doc/Change.log.html 2010-07-26 14:50:09 UTC (rev 3666) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFBankingSummary.php - Sql quoting corrections</p> <p>26/07/10 Tim: DailyBankTransactions.php - New script to show daily bank transactions in bank account currency, and local currency</p> <p>25/07/10 Tim: PrintCustTrans.php - Correctly show decimal places</p> <p>25/07/10 Phil: SelectContract.php new script to select a contract</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 16:11:28
|
Revision: 3668 http://web-erp.svn.sourceforge.net/web-erp/?rev=3668&view=rev Author: tim_schofield Date: 2010-07-26 16:11:18 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections, add javascript date picker, and layout changes Modified Paths: -------------- trunk/PDFChequeListing.php trunk/doc/Change.log.html Modified: trunk/PDFChequeListing.php =================================================================== --- trunk/PDFChequeListing.php 2010-07-26 14:50:24 UTC (rev 3667) +++ trunk/PDFChequeListing.php 2010-07-26 16:11:18 UTC (rev 3668) @@ -23,54 +23,57 @@ if (!isset($_POST['FromDate']) OR !isset($_POST['ToDate'])){ - $title = _('Payment Listing'); - include ('includes/header.inc'); + $title = _('Payment Listing'); + include ('includes/header.inc'); - if ($InputError==1){ + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + $title . '" alt="">' . ' ' . $title . '</p>'; + + if ($InputError==1){ prnMsg($msg,'error'); - } + } - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; - echo '<table> - <tr> + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; + echo '<table class=selection> + <tr> <td>' . _('Enter the date from which cheques are to be listed') . ":</td> - <td><input type=text name='FromDate' maxlength=10 size=10 onChange='return isDate(this, this.value, ".'"'.$_SESSION['DefaultDateFormat'].'"'.")' VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td> + <td><input type=text name='FromDate' maxlength=10 size=10 class=date alt='".$_SESSION['DefaultDateFormat']."' VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td> </tr>"; - echo '<tr><td>' . _('Enter the date to which cheques are to be listed') . ":</td> - <td><input type=text name='ToDate' maxlength=10 size=10 onChange='return isDate(this, this.value, ".'"'.$_SESSION['DefaultDateFormat'].'"'.")' VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td> + echo '<tr><td>' . _('Enter the date to which cheques are to be listed') . ":</td> + <td><input type=text name='ToDate' maxlength=10 size=10 class=date alt='".$_SESSION['DefaultDateFormat']."' VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td> </tr>"; - echo '<tr><td>' . _('Bank Account') . '</td><td>'; + echo '<tr><td>' . _('Bank Account') . '</td><td>'; - $sql = 'SELECT bankaccountname, accountcode FROM bankaccounts'; - $result = DB_query($sql,$db); + $sql = 'SELECT bankaccountname, accountcode FROM bankaccounts'; + $result = DB_query($sql,$db); - echo "<select name='BankAccount'>"; + echo "<select name='BankAccount'>"; - while ($myrow=DB_fetch_array($result)){ + while ($myrow=DB_fetch_array($result)){ echo '<option VALUE=' . $myrow['accountcode'] . '>' . $myrow['bankaccountname']; - } + } - echo '</select></td></tr>'; + echo '</select></td></tr>'; - echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; - echo "<option selected VALUE='No'>" . _('No'); - echo "<option VALUE='Yes'>" . _('Yes'); - echo "</select></td></tr></table><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; + echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; + echo "<option selected VALUE='No'>" . _('No'); + echo "<option VALUE='Yes'>" . _('Yes'); + echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; - include('includes/footer.inc'); - exit; + include('includes/footer.inc'); + exit; } else { include('includes/ConnectDB.inc'); } -$SQL = 'SELECT bankaccountname +$SQL = "SELECT bankaccountname FROM bankaccounts - WHERE accountcode = ' .$_POST['BankAccount']; + WHERE accountcode = '" .$_POST['BankAccount'] . "'"; $BankActResult = DB_query($SQL,$db); $myrow = DB_fetch_row($BankActResult); $BankAccountName = $myrow[0]; @@ -82,7 +85,7 @@ type, transno FROM banktrans - WHERE banktrans.bankact=" . $_POST['BankAccount'] . " + WHERE banktrans.bankact='" . $_POST['BankAccount'] . "' AND (banktrans.type=1 or banktrans.type=22) AND transdate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND transdate <='" . FormatDateForSQL($_POST['ToDate']) . "'"; @@ -94,7 +97,7 @@ include('includes/header.inc'); prnMsg(_('An error occurred getting the payments'),'error'); if ($Debug==1){ - prnMsg(_('The SQL used to get the receipt header information that failed was') . ':<br>' . $SQL,'error'); + prnMsg(_('The SQL used to get the receipt header information that failed was') . ':<br>' . $SQL,'error'); } include('includes/footer.inc'); exit; @@ -120,17 +123,17 @@ while ($myrow=DB_fetch_array($Result)){ - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format(-$myrow['amount'],2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format(-$myrow['amount'],2), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,90,$FontSize,$myrow['ref'], 'left'); - $sql = 'SELECT accountname, + $sql = "SELECT accountname, amount, narrative FROM gltrans, chartmaster WHERE chartmaster.accountcode=gltrans.account - AND gltrans.typeno =' . $myrow['transno'] . ' - AND gltrans.type=' . $myrow['type']; + AND gltrans.typeno ='" . $myrow['transno'] . "' + AND gltrans.type='" . $myrow['type'] . "'"; $GLTransResult = DB_query($sql,$db,'','',false,false); if (DB_error_no($db)!=0){ @@ -138,7 +141,7 @@ include('includes/header.inc'); prnMsg(_('An error occurred getting the GL transactions'),'error'); if ($debug==1){ - prnMsg( _('The SQL used to get the receipt header information that failed was') . ':<br>' . $sql, 'error'); + prnMsg( _('The SQL used to get the receipt header information that failed was') . ':<br>' . $sql, 'error'); } include('includes/footer.inc'); exit; @@ -149,21 +152,21 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+310,$YPos,120,$FontSize,$GLRow['narrative'], 'left'); $YPos -= ($line_height); if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFChequeListingPageHeader.inc'); - } /*end of new page header */ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFChequeListingPageHeader.inc'); + } /*end of new page header */ } DB_free_result($GLTransResult); - $YPos -= ($line_height); - $TotalCheques = $TotalCheques - $myrow['amount']; + $YPos -= ($line_height); + $TotalCheques = $TotalCheques - $myrow['amount']; - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFChequeListingPageHeader.inc'); - } /*end of new page header */ + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFChequeListingPageHeader.inc'); + } /*end of new page header */ } /* end of while there are customer receipts in the batch to print */ @@ -190,7 +193,7 @@ if (file_exists($_SESSION['reports_dir'] . '/'.$ReportFileName)){ unlink($_SESSION['reports_dir'] . '/'.$ReportFileName); } - $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); + $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); fwrite ($fp, $pdfcode); fclose ($fp); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 14:50:24 UTC (rev 3667) +++ trunk/doc/Change.log.html 2010-07-26 16:11:18 UTC (rev 3668) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFChequeListing.php - Sql quoting corrections, add javascript date picker, and layout changes</p> <p>26/07/10 Tim: PDFBankingSummary.php - Sql quoting corrections</p> <p>26/07/10 Tim: DailyBankTransactions.php - New script to show daily bank transactions in bank account currency, and local currency</p> <p>25/07/10 Tim: PrintCustTrans.php - Correctly show decimal places</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 16:34:24
|
Revision: 3669 http://web-erp.svn.sourceforge.net/web-erp/?rev=3669&view=rev Author: tim_schofield Date: 2010-07-26 16:34:18 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections and layout changes Modified Paths: -------------- trunk/PDFCustomerList.php trunk/doc/Change.log.html Modified: trunk/PDFCustomerList.php =================================================================== --- trunk/PDFCustomerList.php 2010-07-26 16:11:18 UTC (rev 3668) +++ trunk/PDFCustomerList.php 2010-07-26 16:34:18 UTC (rev 3669) @@ -367,23 +367,25 @@ $title = _('Customer Details Listing'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . + $title . '" alt="">' . ' ' . $title . '</p>'; - echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="POST"><table>'; + echo '<form action=' . $_SERVER['PHP_SELF'] . ' method="POST"><table class=selection>'; echo '<tr><td>' . _('For Sales Areas') . ':</td><td><select name=Areas[] multiple>'; $sql='SELECT areacode, areadescription FROM areas'; $AreasResult= DB_query($sql,$db); - echo '<option selected VALUE="All">' . _('All Areas'); + echo '<option selected value="All">' . _('All Areas'); While ($myrow = DB_fetch_array($AreasResult)){ - echo '<option VALUE="' . $myrow['areacode'] . '">' . $myrow['areadescription']; + echo '<option value="' . $myrow['areacode'] . '">' . $myrow['areadescription']; } echo '</select></td></tr>'; echo '<tr><td>' . _('For Sales folk'). ':</td><td><select name=SalesPeople[] multiple>'; - echo '<option selected VALUE="All">'. _('All sales folk'); + echo '<option selected value="All">'. _('All sales folk'); $sql = 'SELECT salesmancode, salesmanname FROM salesman'; $SalesFolkResult = DB_query($sql,$db); @@ -395,20 +397,20 @@ echo '<tr><td>' . _('Level Of Activity'). ':</td><td><select name="Activity">'; - echo '<option selected VALUE="All">'. _('All customers'); - echo '<option VALUE="GreaterThan">'. _('Sales Greater Than'); - echo '<option VALUE="LessThan">'. _('Sales Less Than'); + echo '<option selected value="All">'. _('All customers'); + echo '<option value="GreaterThan">'. _('Sales Greater Than'); + echo '<option value="LessThan">'. _('Sales Less Than'); echo '</select></td><td>'; - echo '<input type="text" class=number name="ActivityAmount" size=8 maxlength=8></td></tr>'; + echo '<input type="text" class=number name="ActivityAmount" size=8 maxlength=8 value=0></td></tr>'; $DefaultActivitySince = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-6,0,Date('y'))); echo '<tr><td>' . _('Activity Since'). ':</td><td><input type="text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="ActivitySince" size=10 maxlength=10 VALUE="' . $DefaultActivitySince . '"></td></tr>'; - echo '</table><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>'; + echo '</table><br><div class="centre"><input type=Submit Name="PrintPDF" Value="'. _('Print PDF'). '"></div>'; include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 16:11:18 UTC (rev 3668) +++ trunk/doc/Change.log.html 2010-07-26 16:34:18 UTC (rev 3669) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFCustomerList.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFChequeListing.php - Sql quoting corrections, add javascript date picker, and layout changes</p> <p>26/07/10 Tim: PDFBankingSummary.php - Sql quoting corrections</p> <p>26/07/10 Tim: DailyBankTransactions.php - New script to show daily bank transactions in bank account currency, and local currency</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 17:52:38
|
Revision: 3670 http://web-erp.svn.sourceforge.net/web-erp/?rev=3670&view=rev Author: tim_schofield Date: 2010-07-26 17:52:30 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections and layout changes Modified Paths: -------------- trunk/PDFCustTransListing.php trunk/doc/Change.log.html Modified: trunk/PDFCustTransListing.php =================================================================== --- trunk/PDFCustTransListing.php 2010-07-26 16:34:18 UTC (rev 3669) +++ trunk/PDFCustTransListing.php 2010-07-26 17:52:30 UTC (rev 3670) @@ -28,7 +28,7 @@ } echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; - echo '<table> + echo '<table class=selection> <tr> <td>' . _('Enter the date for which the transactions are to be listed') . ":</td> <td><input type=text name='Date' maxlength=10 size=10 class=date alt='" . $_SESSION['DefaultDateFormat'] . "' value='" . Date($_SESSION['DefaultDateFormat']) . "'></td> @@ -44,7 +44,7 @@ echo '</select></td></tr>'; - echo "</select></td></tr></table><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; + echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; include('includes/footer.inc'); @@ -62,7 +62,7 @@ ovgst, invtext FROM debtortrans - WHERE type=" . $_POST['TransType'] . " + WHERE type='" . $_POST['TransType'] . "' AND date_format(inputdate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; $result=DB_query($sql,$db,'','',false,false); @@ -75,7 +75,7 @@ prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br>' . $SQL,'error'); } include('includes/footer.inc'); - exit; + exit; } elseif (DB_num_rows($result) == 0){ $title = _('Payment Listing'); include('includes/header.inc'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 16:34:18 UTC (rev 3669) +++ trunk/doc/Change.log.html 2010-07-26 17:52:30 UTC (rev 3670) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFCustTransListing.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFCustomerList.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFChequeListing.php - Sql quoting corrections, add javascript date picker, and layout changes</p> <p>26/07/10 Tim: PDFBankingSummary.php - Sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 19:40:59
|
Revision: 3671 http://web-erp.svn.sourceforge.net/web-erp/?rev=3671&view=rev Author: tim_schofield Date: 2010-07-26 19:40:50 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections, bug fixes and layout changes Modified Paths: -------------- trunk/PDFDeliveryDifferences.php trunk/doc/Change.log.html Modified: trunk/PDFDeliveryDifferences.php =================================================================== --- trunk/PDFDeliveryDifferences.php 2010-07-26 17:52:30 UTC (rev 3670) +++ trunk/PDFDeliveryDifferences.php 2010-07-26 19:40:50 UTC (rev 3671) @@ -21,50 +21,53 @@ if (!isset($_POST['FromDate']) OR !isset($_POST['ToDate']) OR $InputError==1){ - $title = _('Delivery Differences Report'); - include ('includes/header.inc'); + $title = _('Delivery Differences Report'); + include ('includes/header.inc'); - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . sid . "'>"; - echo '<table><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . - ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']. - "' name='FromDate' maxlength=10 size=10 VALUE='" . - Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . "'></td></tr>"; - echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>"; - echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . _('Delivery Differences Report') . '</p>'; - $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; - $result = DB_query($sql,$db); + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . sid . "'>"; + echo '<table class=selection><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . + ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']. + "' name='FromDate' maxlength=10 size=10 value='" . + Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . "'></td></tr>"; + echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>"; + echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; + $result = DB_query($sql,$db); - echo "<select name='CategoryID'>"; - echo "<option selected VALUE='All'>" . _('Over All Categories'); - while ($myrow=DB_fetch_array($result)){ - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription']; - } + echo "<select name='CategoryID'>"; + echo "<option selected value='All'>" . _('Over All Categories'); + while ($myrow=DB_fetch_array($result)){ + echo "<option value='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription']; + } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>"; - echo "<option selected VALUE='All'>" . _('All Locations'); + echo '</select></td></tr>'; - $result= DB_query('SELECT loccode, locationname FROM locations',$db); - while ($myrow=DB_fetch_array($result)){ - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - } - echo '</select></td></tr>'; + echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>"; + echo "<option selected value='All'>" . _('All Locations'); - echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; - echo "<option selected VALUE='No'>" . _('No'); - echo "<option VALUE='Yes'>" . _('Yes'); - echo "</select></td></tr></table><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; + $result= DB_query('SELECT loccode, locationname FROM locations',$db); + while ($myrow=DB_fetch_array($result)){ + echo "<option value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + } + echo '</select></td></tr>'; - if ($InputError==1){ - prnMsg($msg,'error'); - } - include('includes/footer.inc'); - exit; + echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; + echo "<option selected value='No'>" . _('No'); + echo "<option value='Yes'>" . _('Yes'); + echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; + + if ($InputError==1){ + prnMsg($msg,'error'); + } + include('includes/footer.inc'); + exit; } else { include('includes/ConnectDB.inc'); } @@ -181,23 +184,23 @@ while ($myrow=DB_fetch_array($Result)){ - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,$myrow['invoiceno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,40,$FontSize,$myrow['orderno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos,200,$FontSize,$myrow['stockid'] . ' - ' . $myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,$myrow['invoiceno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,40,$FontSize,$myrow['orderno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+80,$YPos,200,$FontSize,$myrow['stockid'] . ' - ' . $myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,number_format($myrow['quantitydiff']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+335,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+385,$YPos,50,$FontSize,$myrow['branch'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+435,$YPos,50,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,50,$FontSize,number_format($myrow['quantitydiff']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+335,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+385,$YPos,50,$FontSize,$myrow['branch'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+435,$YPos,50,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $YPos -= ($line_height); - $TotalDiffs++; + $YPos -= ($line_height); + $TotalDiffs++; - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFDeliveryDifferencesPageHeader.inc'); - } /*end of new page header */ + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFDeliveryDifferencesPageHeader.inc'); + } /*end of new page header */ } /* end of while there are delivery differences to print */ @@ -205,44 +208,44 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,_('Total number of differences') . ' ' . number_format($TotalDiffs), 'left'); if ($_POST['CategoryID']=='All' AND $_POST['Location']=='All'){ - $sql = "SELECT COUNT(salesorderdetails.orderno) - FROM salesorderdetails INNER JOIN debtortrans - ON salesorderdetails.orderno=debtortrans.order_ - WHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "' + $sql = "SELECT COUNT(salesorderdetails.orderno) + FROM salesorderdetails INNER JOIN debtortrans + ON salesorderdetails.orderno=debtortrans.order_ + WHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "' AND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'"; } elseif ($_POST['CategoryID']!='All' AND $_POST['Location']=='All') { - $sql = "SELECT COUNT(salesorderdetails.orderno) - FROM salesorderdetails INNER JOIN debtortrans - ON salesorderdetails.orderno=debtortrans.order_ INNER JOIN stockmaster - ON salesorderdetails.stkcode=stockmaster.stockid - WHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "' - AND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "' + $sql = "SELECT COUNT(salesorderdetails.orderno) + FROM salesorderdetails INNER JOIN debtortrans + ON salesorderdetails.orderno=debtortrans.order_ INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "' + AND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND stockmaster.categoryid='" . $_POST['CategoryID'] . "'"; } elseif ($_POST['CategoryID']=='All' AND $_POST['Location']!='All'){ - $sql = "SELECT COUNT(salesorderdetails.orderno) - FROM salesorderdetails INNER JOIN debtortrans - ON salesorderdetails.orderno=debtortrans.order_ INNER JOIN salesorders - ON salesorderdetails.orderno = salesorders.orderno - WHERE debtortrans.trandate>='". FormatDateForSQL($_POST['FromDate']) . "' - AND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "' + $sql = "SELECT COUNT(salesorderdetails.orderno) + FROM salesorderdetails INNER JOIN debtortrans + ON salesorderdetails.orderno=debtortrans.order_ INNER JOIN salesorders + ON salesorderdetails.orderno = salesorders.orderno + WHERE debtortrans.trandate>='". FormatDateForSQL($_POST['FromDate']) . "' + AND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND salesorders.fromstkloc='" . $_POST['Location'] . "'"; } elseif ($_POST['CategoryID'] !='All' AND $_POST['Location'] !='All'){ - $sql = "SELECT COUNT(salesorderdetails.orderno) - FROM salesorderdetails INNER JOIN debtortrans ON salesorderdetails.orderno=debtortrans.order_ - INNER JOIN salesorders ON salesorderdetails.orderno = salesorders.orderno - INNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid - WHERE salesorders.fromstkloc ='" . $_POST['Location'] . "' - AND categoryid='" . $_POST['CategoryID'] . "' - AND trandate >='" . FormatDateForSQL($_POST['FromDate']) . "' + $sql = "SELECT COUNT(salesorderdetails.orderno) + FROM salesorderdetails INNER JOIN debtortrans ON salesorderdetails.orderno=debtortrans.order_ + INNER JOIN salesorders ON salesorderdetails.orderno = salesorders.orderno + INNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid + WHERE salesorders.fromstkloc ='" . $_POST['Location'] . "' + AND categoryid='" . $_POST['CategoryID'] . "' + AND trandate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "'"; } -$Errmsg = _('Could not retrieve the count of sales order lines in the period under review'); +$ErrMsg = _('Could not retrieve the count of sales order lines in the period under review'); $result = DB_query($sql,$db,$ErrMsg); @@ -272,7 +275,7 @@ if (file_exists($_SESSION['reports_dir'] . '/'.$ReportFileName)){ unlink($_SESSION['reports_dir'] . '/'.$ReportFileName); } - $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); + $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); fwrite ($fp, $pdfcode); fclose ($fp); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 17:52:30 UTC (rev 3670) +++ trunk/doc/Change.log.html 2010-07-26 19:40:50 UTC (rev 3671) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFDeliveryDifferences.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFCustTransListing.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFCustomerList.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFChequeListing.php - Sql quoting corrections, add javascript date picker, and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 20:20:49
|
Revision: 3672 http://web-erp.svn.sourceforge.net/web-erp/?rev=3672&view=rev Author: tim_schofield Date: 2010-07-26 20:20:43 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections, bug fixes and layout changes Modified Paths: -------------- trunk/PDFDIFOT.php trunk/doc/Change.log.html Modified: trunk/PDFDIFOT.php =================================================================== --- trunk/PDFDIFOT.php 2010-07-26 19:40:50 UTC (rev 3671) +++ trunk/PDFDIFOT.php 2010-07-26 20:20:43 UTC (rev 3672) @@ -21,133 +21,136 @@ if (!isset($_POST['FromDate']) OR !isset($_POST['ToDate']) OR $InputError==1){ - $title = _('Delivery In Full On Time (DIFOT) Report'); - include ('includes/header.inc'); + $title = _('Delivery In Full On Time (DIFOT) Report'); + include ('includes/header.inc'); - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . sid . "'>"; - echo '<table><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . "'></td></tr>"; - echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>"; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . _('DIFOT Report') . '</p>'; - if (!isset($_POST['DaysAcceptable'])){ - $_POST['DaysAcceptable'] = 1; - } + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . sid . "'>"; + echo '<table class=selection><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . "'></td></tr>"; + echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ":</td><td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>"; - echo '<tr><td>' . _('Enter the number of days considered acceptable between delivery requested date and invoice date(ie the date dispatched)') . ":</td><td><input type=text class=number name='DaysAcceptable' maxlength=2 size=2 VALUE=" . $_POST['DaysAcceptable'] . "></td></tr>"; - echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + if (!isset($_POST['DaysAcceptable'])){ + $_POST['DaysAcceptable'] = 1; + } - $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; - $result = DB_query($sql,$db); + echo '<tr><td>' . _('Enter the number of days considered acceptable between delivery requested date and invoice date(ie the date dispatched)') . ":</td><td><input type=text class=number name='DaysAcceptable' maxlength=2 size=2 VALUE=" . $_POST['DaysAcceptable'] . "></td></tr>"; + echo '<tr><td>' . _('Inventory Category') . '</td><td>'; + $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; + $result = DB_query($sql,$db); - echo "<select name='CategoryID'>"; - echo "<option selected VALUE='All'>" . _('Over All Categories'); - while ($myrow=DB_fetch_array($result)){ - echo "<option VALUE='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription']; - } + echo "<select name='CategoryID'>"; + echo "<option selected value='All'>" . _('Over All Categories'); + while ($myrow=DB_fetch_array($result)){ + echo "<option value='" . $myrow['categoryid'] . "'>" . $myrow['categorydescription']; + } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>"; - echo "<option selected VALUE='All'>" . _('All Locations'); + echo '</select></td></tr>'; - $result= DB_query('SELECT loccode, locationname FROM locations',$db); - while ($myrow=DB_fetch_array($result)){ - echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname']; - } - echo '</select></td></tr>'; + echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>"; + echo "<option selected value='All'>" . _('All Locations'); - echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; - echo "<option selected VALUE='No'>" . _('No'); - echo "<option VALUE='Yes'>" . _('Yes'); - echo "</select></td></tr></table><div class='centre'><input type=submit name='Go' VALUE='" . _('Create PDF') . "'></div>"; + $result= DB_query('SELECT loccode, locationname FROM locations',$db); + while ($myrow=DB_fetch_array($result)){ + echo "<option value='" . $myrow['loccode'] . "'>" . $myrow['locationname']; + } + echo '</select></td></tr>'; - if ($InputError==1){ - prnMsg($msg,'error'); - } - include('includes/footer.inc'); - exit; + echo '<tr><td>' . _('Email the report off') . ":</td><td><select name='Email'>"; + echo "<option selected value='No'>" . _('No'); + echo "<option value='Yes'>" . _('Yes'); + echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; + + if ($InputError==1){ + prnMsg($msg,'error'); + } + include('includes/footer.inc'); + exit; } else { - include('includes/ConnectDB.inc'); + include('includes/ConnectDB.inc'); } if ($_POST['CategoryID']=='All' AND $_POST['Location']=='All'){ $sql= "SELECT salesorders.orderno, - salesorders.deliverydate, - salesorderdetails.actualdispatchdate, - TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, - salesorderdetails.quantity, - salesorderdetails.stkcode, - stockmaster.description, - salesorders.debtorno, - salesorders.branchcode + salesorders.deliverydate, + salesorderdetails.actualdispatchdate, + TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, + salesorderdetails.quantity, + salesorderdetails.stkcode, + stockmaster.description, + salesorders.debtorno, + salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid INNER JOIN salesorders ON salesorderdetails.orderno=salesorders.orderno - WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' + WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND salesorders.deliverydate <='" . FormatDateForSQL($_POST['ToDate']) . "' - AND (TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate)) >" . $_POST['DaysAcceptable']; + AND (TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate)) >'" . $_POST['DaysAcceptable']."'"; } elseif ($_POST['CategoryID']!='All' AND $_POST['Location']=='All') { - $sql= "SELECT salesorders.orderno, - salesorders.deliverydate, - salesorderdetails.actualdispatchdate, - TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, - salesorderdetails.quantity, - salesorderdetails.stkcode, - stockmaster.description, - salesorders.debtorno, - salesorders.branchcode + $sql= "SELECT salesorders.orderno, + salesorders.deliverydate, + salesorderdetails.actualdispatchdate, + TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, + salesorderdetails.quantity, + salesorderdetails.stkcode, + stockmaster.description, + salesorders.debtorno, + salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid INNER JOIN salesorders ON salesorderdetails.orderno=salesorders.orderno - WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' + WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND salesorders.deliverydate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND stockmaster.categoryid='" . $_POST['CategoryID'] ."' - AND (TO_DAYS(salesorderdetails.actualdispatchdate) - - TO_DAYS(salesorders.deliverydate)) >" . $_POST['DaysAcceptable']; + AND (TO_DAYS(salesorderdetails.actualdispatchdate) + - TO_DAYS(salesorders.deliverydate)) >'" . $_POST['DaysAcceptable']."'"; } elseif ($_POST['CategoryID']=='All' AND $_POST['Location']!='All') { - $sql= "SELECT salesorders.orderno, - salesorders.deliverydate, - salesorderdetails.actualdispatchdate, - TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, - salesorderdetails.quantity, - salesorderdetails.stkcode, - stockmaster.description, - salesorders.debtorno, - salesorders.branchcode + $sql= "SELECT salesorders.orderno, + salesorders.deliverydate, + salesorderdetails.actualdispatchdate, + TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, + salesorderdetails.quantity, + salesorderdetails.stkcode, + stockmaster.description, + salesorders.debtorno, + salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid INNER JOIN salesorders ON salesorderdetails.orderno=salesorders.orderno - WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' + WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND salesorders.deliverydate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND salesorders.fromstkloc='" . $_POST['Location'] . "' - AND (TO_DAYS(salesorderdetails.actualdispatchdate) - - TO_DAYS(salesorders.deliverydate)) >" . $_POST['DaysAcceptable']; + AND (TO_DAYS(salesorderdetails.actualdispatchdate) + - TO_DAYS(salesorders.deliverydate)) >'" . $_POST['DaysAcceptable'] . "'"; -} elseif ($_POST['CategoryID']!='All' AND $_POST['location']!='All'){ +} elseif ($_POST['CategoryID']!='All' AND $_POST['Location']!='All'){ - $sql= "SELECT salesorders.orderno, - salesorders.deliverydate, - salesorderdetails.actualdispatchdate, - TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, - salesorderdetails.quantity, - salesorderdetails.stkcode, - stockmaster.description, - salesorders.debtorno, - salesorders.branchcode + $sql= "SELECT salesorders.orderno, + salesorders.deliverydate, + salesorderdetails.actualdispatchdate, + TO_DAYS(salesorderdetails.actualdispatchdate) - TO_DAYS(salesorders.deliverydate) AS daydiff, + salesorderdetails.quantity, + salesorderdetails.stkcode, + stockmaster.description, + salesorders.debtorno, + salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid INNER JOIN salesorders ON salesorderdetails.orderno=salesorders.orderno - WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' + WHERE salesorders.deliverydate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND salesorders.deliverydate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND stockmaster.categoryid='" . $_POST['CategoryID'] ."' AND salesorders.fromstkloc='" . $_POST['Location'] . "' - AND (TO_DAYS(salesorderdetails.actualdispatchdate) - - TO_DAYS(salesorders.deliverydate)) >" . $_POST['DaysAcceptable']; + AND (TO_DAYS(salesorderdetails.actualdispatchdate) + - TO_DAYS(salesorders.deliverydate)) >'" . $_POST['DaysAcceptable'] . "'"; } @@ -187,29 +190,29 @@ while ($myrow=DB_fetch_array($Result)){ - if (DayOfWeekFromSQLDate($myrow['actualdispatchdate'])==1){ - $DaysDiff = $myrow['daydiff']-2; - } else { - $DaysDiff = $myrow['daydiff']; - } - if ($DaysDiff > $_POST['DaysAcceptable']){ - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,$myrow['orderno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,200,$FontSize,$myrow['stkcode'] .' - ' . $myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,50,$FontSize,number_format($myrow['quantity']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+295,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+345,$YPos,50,$FontSize,$myrow['branchcode'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+395,$YPos,50,$FontSize,ConvertSQLDate($myrow['actualdispatchdate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+445,$YPos,20,$FontSize,$DaysDiff, 'left'); + if (DayOfWeekFromSQLDate($myrow['actualdispatchdate'])==1){ + $DaysDiff = $myrow['daydiff']-2; + } else { + $DaysDiff = $myrow['daydiff']; + } + if ($DaysDiff > $_POST['DaysAcceptable']){ + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,$myrow['orderno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,200,$FontSize,$myrow['stkcode'] .' - ' . $myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,50,$FontSize,number_format($myrow['quantity']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+295,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+345,$YPos,50,$FontSize,$myrow['branchcode'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+395,$YPos,50,$FontSize,ConvertSQLDate($myrow['actualdispatchdate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+445,$YPos,20,$FontSize,$DaysDiff, 'left'); - $YPos -= ($line_height); - $TotalDiffs++; + $YPos -= ($line_height); + $TotalDiffs++; - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFDIFOTPageHeader.inc'); - } /*end of new page header */ - } + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFDIFOTPageHeader.inc'); + } /*end of new page header */ + } } /* end of while there are delivery differences to print */ @@ -274,7 +277,7 @@ if (file_exists($_SESSION['reports_dir'] . '/'.$ReportFileName)){ unlink($_SESSION['reports_dir'] . '/'.$ReportFileName); } - $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); + $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); fwrite ($fp, $pdfcode); fclose ($fp); @@ -290,4 +293,4 @@ $result = $mail->send($DelDiffsRecipients); } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 19:40:50 UTC (rev 3671) +++ trunk/doc/Change.log.html 2010-07-26 20:20:43 UTC (rev 3672) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFDIFOT.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFDeliveryDifferences.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFCustTransListing.php - Sql quoting corrections and layout changes</p> <p>26/07/10 Tim: PDFCustomerList.php - Sql quoting corrections and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-26 20:39:08
|
Revision: 3673 http://web-erp.svn.sourceforge.net/web-erp/?rev=3673&view=rev Author: tim_schofield Date: 2010-07-26 20:38:59 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Sql quoting corrections, bug fixes Modified Paths: -------------- trunk/PDFGrn.php trunk/doc/Change.log.html Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2010-07-26 20:20:43 UTC (rev 3672) +++ trunk/PDFGrn.php 2010-07-26 20:38:59 UTC (rev 3673) @@ -31,14 +31,14 @@ if ($GRNNo=='Preview') { $ListCount = 1; // UldisN } else { - $sql='SELECT grns.itemcode, + $sql="SELECT grns.itemcode, grns.grnno, grns.deliverydate, grns.itemdescription, grns.qtyrecd, grns.supplierid FROM grns - WHERE grnbatch='.$GRNNo; + WHERE grnbatch='".$GRNNo."'"; $result=DB_query($sql, $db); $ListCount = DB_num_rows($result); // UldisN @@ -54,27 +54,35 @@ $Quantity='XXXXX.XX'; $Supplier=str_pad('',25,'x'); } else { - $sql='SELECT orddate from purchorders WHERE orderno='.$_GET['PONo']; + $sql="SELECT orddate from purchorders WHERE orderno='".$_GET['PONo']."'"; $purchorderresult=DB_query($sql, $db); $purchorderdate=DB_fetch_array($purchorderresult); $myrow=DB_fetch_array($result); - $datesql='SELECT max(effectivefrom) FROM purchdata WHERE supplierno="'.$myrow['supplierid'].'" AND stockid="'.$myrow['itemcode'].'" AND effectivefrom<="'.$purchorderdate[0].'"'; + $datesql="SELECT max(effectivefrom) + FROM purchdata + WHERE supplierno='".$myrow['supplierid']."' + AND stockid='".$myrow['itemcode']."' + AND effectivefrom<='".$purchorderdate[0]."'"; $dateresult=DB_query($datesql, $db); $date=DB_fetch_row($dateresult); if ($date[0]!='') { - $sql='SELECT unitsofmeasure.unitname, + $sql="SELECT unitsofmeasure.unitname, suppliers_partno, conversionfactor FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$myrow['supplierid'].'" - AND stockid="'.$myrow['itemcode'].'" - AND effectivefrom="'.$date[0].'"'; + WHERE supplierno='".$myrow['supplierid']."' + AND stockid='".$myrow['itemcode']."' + AND effectivefrom='".$date[0]."'"; $purchdataresult=DB_query($sql, $db); $myrow2=DB_fetch_array($purchdataresult); } else { - $sql='SELECT units as unitname, stockid as suppliers_partno, 1 as conversionfactor FROM stockmaster WHERE stockid="'.$StockID.'"'; + $sql="SELECT units as unitname, + stockid as suppliers_partno, + 1 as conversionfactor + FROM stockmaster + WHERE stockid='".$myrow['itemcode']."'"; $purchdataresult=DB_query($sql, $db); $myrow2=DB_fetch_array($purchdataresult); } @@ -85,9 +93,9 @@ $Quantity=$myrow[4]; $SupplierID=$myrow[5]; if ($myrow2['unitname']=='') { - $sql='SELECT units + $sql="SELECT units FROM stockmaster - WHERE stockid="'.$myrow['itemcode'].'"'; + WHERE stockid='".$myrow['itemcode']."'"; $uomresult=DB_query($sql, $db); $uomrow=DB_fetch_array($uomresult); $units=$uomrow['units']; @@ -95,17 +103,17 @@ } else { $units=$myrow2['unitname']; } - $sql='SELECT units, + $sql="SELECT units, decimalplaces FROM stockmaster - WHERE stockid="'.$myrow['itemcode'].'"'; + WHERE stockid='".$myrow['itemcode']."'"; $uomresult=DB_query($sql, $db); $uomrow=DB_fetch_array($uomresult); $stockunits=$uomrow['units']; - $sql='SELECT suppname + $sql="SELECT suppname FROM suppliers - WHERE supplierid="'.$SupplierID.'"'; + WHERE supplierid='".$SupplierID."'"; $supplierresult=DB_query($sql, $db); $suppliermyrow=DB_fetch_array($supplierresult); $Supplier=$suppliermyrow[0]; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-26 20:20:43 UTC (rev 3672) +++ trunk/doc/Change.log.html 2010-07-26 20:38:59 UTC (rev 3673) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>26/07/10 Tim: PDFGrn.php - Sql quoting corrections, bug fixes</p> <p>26/07/10 Tim: PDFDIFOT.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFDeliveryDifferences.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFCustTransListing.php - Sql quoting corrections and layout changes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-28 13:32:22
|
Revision: 3677 http://web-erp.svn.sourceforge.net/web-erp/?rev=3677&view=rev Author: tim_schofield Date: 2010-07-28 13:32:15 +0000 (Wed, 28 Jul 2010) Log Message: ----------- Ensure line() method has compatible declaration with ancestor class Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/class.pdf.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-28 13:31:46 UTC (rev 3676) +++ trunk/doc/Change.log.html 2010-07-28 13:32:15 UTC (rev 3677) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>28/07/10 Tim: class.pdf.php - Ensure line() method has compatible declaration with ancestor class</p> <p>26/07/10 Tim: PDFGrn.php - Sql quoting corrections, bug fixes</p> <p>26/07/10 Tim: PDFDIFOT.php - Sql quoting corrections, bug fixes and layout changes</p> <p>26/07/10 Tim: PDFDeliveryDifferences.php - Sql quoting corrections, bug fixes and layout changes</p> Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2010-07-28 13:31:46 UTC (rev 3676) +++ trunk/includes/class.pdf.php 2010-07-28 13:32:15 UTC (rev 3677) @@ -8,7 +8,7 @@ Due to limitation of R&OS class for foreign character support, this wrapper class was written to allow the same code base to use the more functional fpdf.class by Olivier Plathey. - However, due to limitations of FPDF class for UTF-8 support, now this class inherits from + However, due to limitations of FPDF class for UTF-8 support, now this class inherits from the TCPDF class by Nicola Asuni. Work to move from FPDF to TCPDF by: @@ -54,7 +54,7 @@ } $this->SetFont($userpdffont, '', 11); - // SetFont($family, $style='', $size=0, $fontfile='') + // SetFont($family, $style='', $size=0, $fontfile='') } @@ -62,37 +62,37 @@ /* Javier: $this->setPrintHeader(false); This is not a removed call but added in. */ $this->AddPage(); } - - function line($x1,$y1,$x2,$y2) { + + function line($x1,$y1,$x2,$y2,$style=array()) { // Javier FPDF::line($x1, $this->h-$y1, $x2, $this->h-$y2); // Javier: width, color and style might be edited - TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2); + TCPDF::Line ($x1,$this->h-$y1,$x2,$this->h-$y2,$style); } - - function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0) + + function addText($xb,$yb,$size,$text)//,$angle=0,$wordSpaceAdjust=0) { // Javier $text = html_entity_decode($text); $this->SetFontSize($size); $this->Text($xb, $this->h-$yb, $text); } - + function addinfo($label, $value) { if ($label == 'Creator') { -/* Javier: Some scripts set the creator to be WebERP like this +/* Javier: Some scripts set the creator to be WebERP like this $pdf->addInfo('Creator', 'WebERP http://www.weberp.org'); But the Creator is TCPDF by Nicola Asuni, PDF_CREATOR is defined as 'TCPDF' in tcpdf/config/tcpdfconfig.php */ $this->SetCreator(PDF_CREATOR); } if ($label == 'Author') { -/* Javier: Many scripts set the author to be WebERP like this +/* Javier: Many scripts set the author to be WebERP like this $pdf->addInfo('Author', 'WebERP ' . $Version); But the Author might be set to be the user or make it constant here. */ $this->SetAuthor( $value ); } if ($label == 'Title') { $this->SetTitle( $value ); - } + } if ($label == 'Subject') { $this->SetSubject( $value ); } @@ -105,18 +105,18 @@ function addJpegFromFile($img,$x,$y,$w=0,$h=0){ $this->Image($img, $x, $this->h-$y-$h, $w, $h); } - + /* * Next Two functions are adopted from R&OS pdf class */ - + /** * draw a part of an ellipse */ function partEllipse($x0,$y0,$astart,$afinish,$r1,$r2=0,$angle=0,$nSeg=8) { $this->ellipse($x0,$y0,$r1,$r2,$angle,$nSeg,$astart,$afinish,0); } - + /** * draw an ellipse * note that the part and filled ellipse are just special cases of this function @@ -124,11 +124,11 @@ * draws an ellipse in the current line style * centered at $x0,$y0, radii $r1,$r2 * if $r2 is not set, then a circle is drawn - * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a + * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a * pretty crappy shape at 2, as we are approximating with bezier curves. */ function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0) { - + if ($r1==0){ return; } @@ -138,14 +138,14 @@ if ($nSeg<2){ $nSeg=2; } - + $astart = deg2rad((float)$astart); $afinish = deg2rad((float)$afinish); $totalAngle =$afinish-$astart; - + $dt = $totalAngle/$nSeg; $dtm = $dt/3; - + if ($angle != 0){ $a = -1*deg2rad((float)$angle); $tmp = "\n q "; @@ -156,13 +156,13 @@ } else { $tmp=''; } - + $t1 = $astart; $a0 = $x0+$r1*cos($t1); $b0 = $y0+$r2*sin($t1); $c0 = -$r1*sin($t1); $d0 = $r2*cos($t1); - + $tmp.="\n".sprintf('%.3f',$a0).' '.sprintf('%.3f',$b0).' m '; for ($i=1;$i<=$nSeg;$i++){ // draw this bit of the total curve @@ -176,7 +176,7 @@ $a0=$a1; $b0=$b1; $c0=$c1; - $d0=$d1; + $d0=$d1; } if ($fill){ //$this->objects[$this->currentContents]['c'] @@ -202,7 +202,7 @@ */ function OutputI($DocumentFilename = 'Document.pdf') { - if (($DocumentFilename == null) or ($DocumentFilename == '')) { + if (($DocumentFilename == null) or ($DocumentFilename == '')) { $DocumentFilename = _('Document.pdf'); } $this->Output($DocumentFilename,'I'); @@ -245,15 +245,15 @@ // $txt = html_entity_decode($txt); $this->x = $xb; $this->y = $this->h - $yb - $h; - + switch($align) { case 'right': $align = 'R'; break; - case 'center': + case 'center': $align = 'C'; break; - default: + default: $align = 'L'; - + } $this->SetFontSize($h); $cw=&$this->CurrentFont['cw']; @@ -287,9 +287,9 @@ $l= $ls=0; $ns=0; while($i<$nb) { - + $c=$s{$i}; - + if($c==' ' AND $i>0) { $sep=$i; $ls=$l; @@ -298,12 +298,12 @@ $l+=$cw[$i]; if($l>$wmax) break; - else + else $i++; } if($sep==-1) { if($i==0) $i++; - + if(isset($this->ws) and $this->ws>0) { $this->ws=0; $this->_out('0 Tw'); @@ -313,15 +313,15 @@ if($align=='J') { $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; $this->_out(sprintf('%.3f Tw',$this->ws*$this->k)); - } + } } - + $this->Cell($w,$h,substr($s,0,$sep),$b,2,$align,$fill); $this->x=$this->lMargin; - + return substr($s,$sep); } - + } // end of class } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-28 13:32:42
|
Revision: 3678 http://web-erp.svn.sourceforge.net/web-erp/?rev=3678&view=rev Author: tim_schofield Date: 2010-07-28 13:32:33 +0000 (Wed, 28 Jul 2010) Log Message: ----------- Ensure ellipse() method has compatible declaration with ancestor class Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/class.pdf.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-28 13:32:15 UTC (rev 3677) +++ trunk/doc/Change.log.html 2010-07-28 13:32:33 UTC (rev 3678) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>28/07/10 Tim: class.pdf.php - Ensure ellipse() method has compatible declaration with ancestor class</p> <p>28/07/10 Tim: class.pdf.php - Ensure line() method has compatible declaration with ancestor class</p> <p>26/07/10 Tim: PDFGrn.php - Sql quoting corrections, bug fixes</p> <p>26/07/10 Tim: PDFDIFOT.php - Sql quoting corrections, bug fixes and layout changes</p> Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2010-07-28 13:32:15 UTC (rev 3677) +++ trunk/includes/class.pdf.php 2010-07-28 13:32:33 UTC (rev 3678) @@ -127,7 +127,7 @@ * nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a * pretty crappy shape at 2, as we are approximating with bezier curves. */ - function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0) { + function ellipse($x0,$y0,$r1,$r2=0,$angle=0,$nSeg=8,$astart=0,$afinish=360,$close=1,$fill=0,$fill_color=array(),$nc=8) { if ($r1==0){ return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-28 14:02:46
|
Revision: 3679 http://web-erp.svn.sourceforge.net/web-erp/?rev=3679&view=rev Author: tim_schofield Date: 2010-07-28 14:02:38 +0000 (Wed, 28 Jul 2010) Log Message: ----------- Change locatransfers table so that recd quantity on bulk stock transfers is a double field not integer Modified Paths: -------------- trunk/doc/Change.log.html trunk/sql/mysql/upgrade3.11.1-3.12.sql Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-28 13:32:33 UTC (rev 3678) +++ trunk/doc/Change.log.html 2010-07-28 14:02:38 UTC (rev 3679) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>28/07/10 Simon Peter Otandeka: Change locatransfers table so that recd quantity on bulk stock transfers is a double field not integer</p> <p>28/07/10 Tim: class.pdf.php - Ensure ellipse() method has compatible declaration with ancestor class</p> <p>28/07/10 Tim: class.pdf.php - Ensure line() method has compatible declaration with ancestor class</p> <p>26/07/10 Tim: PDFGrn.php - Sql quoting corrections, bug fixes</p> Modified: trunk/sql/mysql/upgrade3.11.1-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-28 13:32:33 UTC (rev 3678) +++ trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-07-28 14:02:38 UTC (rev 3679) @@ -282,4 +282,6 @@ UPDATE `securitytokens` SET `tokenname`='Prices Security' WHERE tokenid=12; ALTER TABLE `www_users` CHANGE `supplierid` `supplierid` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; -ALTER TABLE `orderdeliverydifferenceslog` DROP PRIMARY KEY; \ No newline at end of file +ALTER TABLE `orderdeliverydifferenceslog` DROP PRIMARY KEY; + +ALTER TABLE `loctransfers` CHANGE COLUMN `recqty` `recqty` double NOT NULL DEFAULT 0.0; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-02 09:53:39
|
Revision: 3681 http://web-erp.svn.sourceforge.net/web-erp/?rev=3681&view=rev Author: tim_schofield Date: 2010-08-02 09:53:33 +0000 (Mon, 02 Aug 2010) Log Message: ----------- Show currencies correctly when transaction is in different currency to bank currency Modified Paths: -------------- trunk/DailyBankTransactions.php trunk/doc/Change.log.html Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2010-07-30 11:37:22 UTC (rev 3680) +++ trunk/DailyBankTransactions.php 2010-08-02 09:53:33 UTC (rev 3681) @@ -55,7 +55,7 @@ echo '<br><div class="centre"><input type="submit" name="Show" value="' . _('Show transactions'). '"></div>'; echo '</form>'; } else { - $sql="SELECT *, + $sql="SELECT banktrans.*, bankaccounts.bankaccountname, systypes.typename, systypes.typeid @@ -88,8 +88,8 @@ echo '<td>'.$myrow['ref'].'</td>'; echo '<td class=number>'.number_format($myrow['amount'],2).'</td>'; echo '<td class=number>'.number_format($myrow['amount'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate'],2).'</td>'; + echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td>'; + echo '<td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td>'; echo '</tr>'; $AccountCurrTotal = $myrow['amount']; $LocalCurrTotal = $myrow['amount']/$myrow['functionalexrate']; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-30 11:37:22 UTC (rev 3680) +++ trunk/doc/Change.log.html 2010-08-02 09:53:33 UTC (rev 3681) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>02/08/10 Tim: DailyBankTransactions.php - Show currencies correctly when transaction is in different currency to bank currency</p> +<p>30/07/10 Tim: Payments.php - Syntax error in sql statement</p> <p>28/07/10 Simon Peter Otandeka: Change locatransfers table so that recd quantity on bulk stock transfers is a double field not integer</p> <p>28/07/10 Tim: class.pdf.php - Ensure ellipse() method has compatible declaration with ancestor class</p> <p>28/07/10 Tim: class.pdf.php - Ensure line() method has compatible declaration with ancestor class</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-06 17:14:26
|
Revision: 3683 http://web-erp.svn.sourceforge.net/web-erp/?rev=3683&view=rev Author: tim_schofield Date: 2010-08-06 17:14:20 +0000 (Fri, 06 Aug 2010) Log Message: ----------- Purchase Ordering - Set the allow print flag when the order is re-authorised Modified Paths: -------------- trunk/PO_AuthoriseMyOrders.php trunk/PO_Header.php trunk/doc/Change.log.html Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2010-08-02 09:54:13 UTC (rev 3682) +++ trunk/PO_AuthoriseMyOrders.php 2010-08-06 17:14:20 UTC (rev 3683) @@ -22,9 +22,10 @@ $status=$_POST['status'.$orderno]; $comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:'. $emailrow['email'].'">'.$_SESSION['UserID'].'</a><br>'.$_POST['comment']; - $sql="UPDATE purchorders + $sql="UPDATE purchorders SET status='".$status."', - stat_comment='".$comment."' + stat_comment='".$comment."', + allowprint=1 WHERE orderno=".$orderno; $result=DB_query($sql, $db); } @@ -33,13 +34,13 @@ /* Retrieve the purchase order header information */ -$sql='SELECT purchorders.*, +$sql='SELECT purchorders.*, suppliers.suppname, suppliers.currcode, www_users.realname, www_users.email FROM purchorders - LEFT JOIN suppliers + LEFT JOIN suppliers ON suppliers.supplierid=purchorders.supplierno LEFT JOIN www_users ON www_users.userid=purchorders.initiator @@ -59,7 +60,7 @@ echo '</tr>'; while ($myrow=DB_fetch_array($result)) { - + $authsql='SELECT authlevel FROM purchorderauth WHERE userid="'.$_SESSION['UserID'].'" AND currabrev="'.$myrow['currcode'].'"'; @@ -67,15 +68,15 @@ $authresult=DB_query($authsql, $db); $myauthrow=DB_fetch_array($authresult); $authlevel=$myauthrow['authlevel']; - + $ordervaluesql='SELECT sum(unitprice*quantityord) as ordervalue - FROM purchorderdetails + FROM purchorderdetails WHERE orderno='.$myrow['orderno']; $ordervalueresult=DB_query($ordervaluesql, $db); $myordervaluerow=DB_fetch_array($ordervalueresult); $ordervalue=$myordervaluerow['ordervalue']; - + if ($authlevel>=$ordervalue) { echo '<tr>'; echo '<td>'.$myrow['orderno'].'</td>'; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2010-08-02 09:54:13 UTC (rev 3682) +++ trunk/PO_Header.php 2010-08-06 17:14:20 UTC (rev 3683) @@ -86,6 +86,7 @@ '</a>'.$_POST['StatComments'].'<br>'.$_POST['statcommentscomplete']; $_SESSION['PO'.$identifier]->StatComments=$StatusComment; $_SESSION['PO'.$identifier]->Stat=$NewStatus; + $_SESSION['PO'.$identifier]->AllowPrintPO=1; } else { $OK_to_updstat=0; prnMsg( _('You do not have permission to authorise this purchase order').'.<br>'. _('This order is for').' '. @@ -148,10 +149,15 @@ if($_SESSION['ExistingOrder']!=0){ - + if ($_SESSION['PO'.$identifier]->Stat==PurchOrder::STATUS_AUTHORISED) { + $AllowPrint=1; + } else { + $AllowPrint=0; + } $SQL = "UPDATE purchorders SET status='" . $_POST['Stat']. "', - stat_comment='" . $StatusComment ."' + stat_comment='" . $StatusComment ."', + allowprint='".$AllowPrint."' WHERE purchorders.orderno =" . $_SESSION['ExistingOrder']; $ErrMsg = _('The order status could not be updated because'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-02 09:54:13 UTC (rev 3682) +++ trunk/doc/Change.log.html 2010-08-06 17:14:20 UTC (rev 3683) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>06/08/10 Tim: Purchase Ordering - Set the allow print flag when the order is re-authorised</p> <p>02/08/10 Tim: DailyBankTransactions.php - Show currencies correctly when transaction is in different currency to bank currency</p> <p>30/07/10 Tim: Payments.php - Syntax error in sql statement</p> <p>28/07/10 Simon Peter Otandeka: Change locatransfers table so that recd quantity on bulk stock transfers is a double field not integer</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-07 10:04:46
|
Revision: 3684 http://web-erp.svn.sourceforge.net/web-erp/?rev=3684&view=rev Author: tim_schofield Date: 2010-08-07 10:04:40 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Unset $result variable once used as it was causing search errors later in the script Modified Paths: -------------- trunk/SelectCustomer.php trunk/doc/Change.log.html Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2010-08-06 17:14:20 UTC (rev 3683) +++ trunk/SelectCustomer.php 2010-08-07 10:04:40 UTC (rev 3684) @@ -73,6 +73,7 @@ </script>'; echo '<body onload="load()" onunload="GUnload()">'; } +unset($result); $msg = ""; if (isset($_POST['Go1']) or isset($_POST['Go2'])) { $_POST['PageOffset'] = (isset($_POST['Go1']) ? $_POST['PageOffset1'] : $_POST['PageOffset2']); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-06 17:14:20 UTC (rev 3683) +++ trunk/doc/Change.log.html 2010-08-07 10:04:40 UTC (rev 3684) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was causing search errors later in the script</p> <p>06/08/10 Tim: Purchase Ordering - Set the allow print flag when the order is re-authorised</p> <p>02/08/10 Tim: DailyBankTransactions.php - Show currencies correctly when transaction is in different currency to bank currency</p> <p>30/07/10 Tim: Payments.php - Syntax error in sql statement</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-07 11:15:47
|
Revision: 3685 http://web-erp.svn.sourceforge.net/web-erp/?rev=3685&view=rev Author: tim_schofield Date: 2010-08-07 11:15:40 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Sql quoting correction, layout changes, and assorted minor bug corrections Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log.html Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-08-07 10:04:40 UTC (rev 3684) +++ trunk/PO_Items.php 2010-08-07 11:15:40 UTC (rev 3685) @@ -143,7 +143,7 @@ stat_comment, deliverydate, paymentterms) - VALUES(" . $_SESSION['PO'.$identifier]->OrderNo . ", + VALUES( '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $_SESSION['PO'.$identifier]->SupplierID . "', '" . $_SESSION['PO'.$identifier]->Comments . "', '" . Date('Y-m-d') . "', @@ -205,13 +205,13 @@ total_quantity, total_amount ) VALUES ( - " . $_SESSION['PO'.$identifier]->OrderNo . ", + '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', '" . $POLine->ItemDescription . "', - " . $POLine->GLCode . ", - " . $POLine->Price . ", - " . $POLine->Quantity . ", + '" . $POLine->GLCode . "', + '" . $POLine->Price . "', + '" . $POLine->Quantity . "', '" . $POLine->ShiptRef . "', '" . $POLine->JobRef . "', '" . $POLine->itemno . "', @@ -228,14 +228,12 @@ )"; $ErrMsg =_('One of the purchase order detail records could not be inserted into the database because'); $DbgMsg =_('The SQL statement used to insert the purchase order detail record and failed was'); - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); + $result =DB_query($sql,$db,$ErrMsg,$DbgMsg,true); } } /* end of the loop round the detail line items on the order */ echo '<p>'; prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('on') . ' ' . $_SESSION['PO'.$identifier]->SupplierName . ' ' . _('has been created'),'success'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . - _('Print') . '" alt="">' . ' ' . _('Print Purchase Order') . ''; } else { /*its an existing order need to update the old order info */ // $_SESSION['PO'.$identifier]->version += 0.01; $date = date($_SESSION['DefaultDateFormat']); @@ -244,7 +242,7 @@ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , comments='" . $_SESSION['PO'.$identifier]->Comments . "', - rate=" . $_SESSION['PO'.$identifier]->ExRate . ", + rate='" . $_SESSION['PO'.$identifier]->ExRate . "', initiator='" . $_SESSION['PO'.$identifier]->Initiator . "', requisitionno= '" . $_SESSION['PO'.$identifier]->RequisitionNo . "', version= '" . $_SESSION['PO'.$identifier]->version . "', @@ -269,7 +267,7 @@ supptel='" . $_SESSION['PO'.$identifier]->supptel . "', contact='" . $_SESSION['PO'.$identifier]->contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->paymentterms . "', - allowprint=" . $_SESSION['PO'.$identifier]->AllowPrintPO . " + allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); @@ -280,14 +278,14 @@ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { $sql="UPDATE purchorders SET status = '" . PurchOrder::STATUS_PENDING . "' - WHERE orderno = " . $_SESSION['PO'.$identifier]->OrderNo; - $result=DB_query($sql,$db); + WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo . "'"; + $result=DB_query($sql,$db,'','',true); if ($POLine->Deleted==true) { if ($POLine->PODetailRec!='') { $sql="DELETE FROM purchorderdetails WHERE podetailitem='" . $POLine->PODetailRec . "'"; $ErrMsg = _('The purchase order could not be deleted because'); $DbgMsg = _('The SQL statement used to delete the purchase order header record, that failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); } } else if ($POLine->PODetailRec=='') { @@ -313,14 +311,14 @@ total_quantity, total_amount ) - VALUES (" - . $_SESSION['PO'.$identifier]->OrderNo . ", + VALUES ( + '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $POLine->StockID . "', '" . FormatDateForSQL($POLine->ReqDelDate) . "', '" . $POLine->ItemDescription . "', - " . $POLine->GLCode . ", - " . $POLine->Price . ", - " . $POLine->Quantity . ", + '" . $POLine->GLCode . "', + '" . $POLine->Price . "', + '" . $POLine->Quantity . "', '" . $POLine->ShiptRef . "', '" . $POLine->JobRef . "', '" . $POLine->itemno . "', @@ -342,9 +340,9 @@ itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', itemdescription='" . $POLine->ItemDescription . "', - glcode=" . $POLine->GLCode . ", - unitprice=" . $POLine->Price . ", - quantityord=" . $POLine->Quantity . ", + glcode='" . $POLine->GLCode . "', + unitprice='" . $POLine->Price . "', + quantityord='" . $POLine->Quantity . "', shiptref='" . $POLine->ShiptRef . "', jobref='" . $POLine->JobRef . "', itemno='" . $POLine->itemno . "', @@ -359,15 +357,15 @@ total_quantity='" . $POLine->total_quantity . "', total_amount='" . $POLine->total_amount . "', completed=1 - WHERE podetailitem=" . $POLine->PODetailRec; + WHERE podetailitem='" . $POLine->PODetailRec . "'"; } else { $sql = "UPDATE purchorderdetails SET itemcode='" . $POLine->StockID . "', deliverydate ='" . FormatDateForSQL($POLine->ReqDelDate) . "', itemdescription='" . $POLine->ItemDescription . "', - glcode=" . $POLine->GLCode . ", - unitprice=" . $POLine->Price . ", - quantityord=" . $POLine->Quantity . ", + glcode='" . $POLine->GLCode . "', + unitprice='" . $POLine->Price . "', + quantityord='" . $POLine->Quantity . "', shiptref='" . $POLine->ShiptRef . "', jobref='" . $POLine->JobRef . "', itemno='" . $POLine->itemno . "', @@ -381,19 +379,19 @@ cuft='" . $POLine->cuft . "', total_quantity='" . $POLine->total_quantity . "', total_amount='" . $POLine->total_amount . "' - WHERE podetailitem=" . $POLine->PODetailRec; + WHERE podetailitem='" . $POLine->PODetailRec . "'"; } } $ErrMsg = _('One of the purchase order detail records could not be updated because'); $DbgMsg = _('The SQL statement used to update the purchase order detail record that failed was'); $result =DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - } /* end of the loop round the detail line items on the order */ - echo '<br><br>'; - prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('has been updated'),'success'); - if ($_SESSION['PO'.$identifier]->AllowPrintPO==1){ - // echo '<br><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a>'; - } + } /* end of the loop round the detail line items on the order */ + echo '<br><br>'; + prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('has been updated'),'success'); + if ($_SESSION['PO'.$identifier]->AllowPrintPO==1){ + // echo '<br><a target="_blank" href="'.$rootpath.'/PO_PDFPurchOrder.php?' . SID . '&OrderNo=' . $_SESSION['PO'.$identifier]->OrderNo . '">' . _('Print Purchase Order') . '</a>'; + } } /*end of if its a new order or an existing one */ $sql = 'COMMIT'; @@ -426,8 +424,9 @@ AND stockmaster.mbflag!='A' AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid"; + AND stockmaster.description LIKE '" . $SearchString ."' + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } else { $sql = "SELECT stockmaster.stockid, stockmaster.description, @@ -438,9 +437,10 @@ AND stockmaster.mbflag!='A' AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description LIKE '". $SearchString ."' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } } elseif ($_POST['StockCode']){ @@ -457,8 +457,9 @@ AND stockmaster.mbflag!='A' AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid"; + AND stockmaster.stockid LIKE '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid + LIMIT '".$_SESSION['DefaultDisplayRecordsMax']."'"; } else { $sql = "SELECT stockmaster.stockid, stockmaster.description, @@ -469,9 +470,10 @@ AND stockmaster.mbflag!='A' AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.stockid LIKE '" . $_POST['StockCode'] . "' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } } else { @@ -485,7 +487,8 @@ AND stockmaster.mbflag!='A' AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid"; + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } else { $sql = "SELECT stockmaster.stockid, stockmaster.description, @@ -497,7 +500,8 @@ AND stockmaster.mbflag!='K' and stockmaster.discontinued!=1 AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; + ORDER BY stockmaster.stockid + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } } @@ -564,9 +568,9 @@ if ($_SESSION['PO'.$identifier]->GLLink==1) { /*Check for existance of GL Code selected */ - $sql = 'SELECT accountname + $sql = "SELECT accountname FROM chartmaster - WHERE accountcode =' . $_SESSION['PO'.$identifier]->LineItems[$_POST['LineNo']]->GLCode; + WHERE accountcode ='" . $_SESSION['PO'.$identifier]->LineItems[$_POST['LineNo']]->GLCode ."'"; $ErrMsg = _('The account name for') . ' ' . $_POST['GLCode'] . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the account details but failed was'); $GLActResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -644,9 +648,9 @@ /*need to check GL Code is valid if GLLink is active */ if ($_SESSION['PO'.$identifier]->GLLink==1){ - $sql = 'SELECT accountname + $sql = "SELECT accountname FROM chartmaster - WHERE accountcode =' . (int) $_POST['GLCode']; + WHERE accountcode ='" . (int) $_POST['GLCode'] . "'"; $ErrMsg = _('The account details for') . ' ' . $_POST['GLCode'] . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the details of the account, but failed was'); $GLValidResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,false,false); @@ -735,10 +739,10 @@ } } if ($AlreadyOnThisOrder!=1 and $Quantity>0){ - $purchdatasql='SELECT COUNT(supplierno) + $purchdatasql="SELECT COUNT(supplierno) FROM purchdata - WHERE purchdata.supplierno = "' . $_SESSION['PO'.$identifier]->SupplierID . '" - AND purchdata.stockid="'. $ItemCode . '"'; + WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' + AND purchdata.stockid='". $ItemCode . "'"; $purchdataresult=DB_query($purchdatasql, $db); $myrow=DB_fetch_row($purchdataresult); if ($myrow[0]>0) { @@ -773,7 +777,7 @@ WHERE purchdata.stockid='". $ItemCode . "' AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "')"; } else { - $sql='SELECT stockmaster.description, + $sql="SELECT stockmaster.description, stockmaster.stockid, stockmaster.units, stockmaster.decimalplaces, @@ -786,7 +790,7 @@ stockmaster WHERE chartmaster.accountcode = stockcategory.stockact AND stockcategory.categoryid = stockmaster.categoryid - AND stockmaster.stockid = "'. $ItemCode . '"'; + AND stockmaster.stockid = '". $ItemCode . "'"; } $ErrMsg = _('The supplier pricing details for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because'); @@ -845,7 +849,7 @@ 0, 0, $myrow['accountname'], - 0, + $myrow['decimalplaces'], $ItemCode, $myrow['units'], 1, @@ -892,7 +896,7 @@ echo ' ' . _('Purchase Order') .' '. $_SESSION['PO'.$identifier]->OrderNo ; } echo '<br><b>'._(' Order Summary') . '</b>'; - echo '<table cellpadding=2 colspan=7 border=1>'; + echo '<table cellpadding=2 colspan=7 class=selection>'; echo "<tr> <th>" . _('Item Code') . "</th> <th>" . _('Description') . "</th> @@ -930,15 +934,15 @@ echo '<tr class="OddTableRows">'; $k=1; } - $uomsql='SELECT conversionfactor, + $uomsql="SELECT conversionfactor, suppliersuom, unitsofmeasure. unitname FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" - AND stockid="'.$POLine->StockID.'"'; + WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' + AND stockid='".$POLine->StockID."'"; $uomresult=DB_query($uomsql, $db); if (DB_num_rows($uomresult)>0) { @@ -968,7 +972,7 @@ $DisplayTotal = number_format($_SESSION['PO'.$identifier]->total,2); echo '<tr><td colspan=6 class=number>' . _('TOTAL') . _(' excluding Tax') . '</td><td class=number><b>' . $DisplayTotal . '</b></td></tr></table>'; echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="Update Order Lines">'; - echo '<br><input type="submit" name="Commit" value="Process Order">'; + echo ' <input type="submit" name="Commit" value="Process Order"></div>'; if (!isset($_POST['NewItem']) and isset($_GET['Edit'])) { /*show a form for putting in a new line item with or without a stock entry */ @@ -978,7 +982,7 @@ if (isset($_POST['NonStockOrder'])) { - echo '<br><table><tr><td>'._('Item Description').'</td>'; + echo '<br><table class=selection><tr><td>'._('Item Description').'</td>'; echo '<td><input type=text name=ItemDescription size=40></td></tr>'; echo '<tr><td>'._('General Ledger Code').'</td>'; echo '<td><select name="GLCode">'; @@ -1016,8 +1020,7 @@ $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table class=selection><tr><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . - _('Print') . '" alt="">' . ' ' . _('Search For Stock Items') . ''; + echo '<table class=selection><tr><th colspan=3><font size=3 color=blue>'. _('Search For Stock Items') . '</th>'; echo ":</font></tr><tr><td><select name='StockCat'>"; @@ -1042,16 +1045,16 @@ } echo '</select></td> - <td><font size=2>' . _('Enter text extracts in the description') . ":</font></td> + <td>' . _('Enter text extracts in the description') . ":</td> <td><input type='text' name='Keywords' size=20 maxlength=25 value='" . $_POST['Keywords'] . "'></td></tr> <tr><td></td> - <td><font size=3><b>" . _('OR') . ' </b></font><font size=2>' . _('Enter extract of the Stock Code') . - ":</font></td> + <td><font size=3><b>" . _('OR') . ' </b></font>' . _('Enter extract of the Stock Code') . + ":</td> <td><input type='text' name='StockCode' size=15 maxlength=18 value='" . $_POST['StockCode'] . "'></td> </tr> <tr><td></td> - <td><font size=3><b>" . _('OR') . ' </b></font><font size=2><a target="_blank" href="'.$rootpath.'/Stocks.php?"' . SID . - '">' . _('Create a New Stock Item') . "</a></font></td></tr> + <td><font size=3><b>" . _('OR') . ' </b></font><a target="_blank" href="'.$rootpath.'/Stocks.php?"' . SID . + '">' . _('Create a New Stock Item') . "</a></td></tr> </table><br> <div class='centre'><input type=submit name='Search' value='" . _('Search Now') . "'> <input type=submit name='NonStockOrder' value='" . _('Order a non stock item') . "'> @@ -1063,13 +1066,13 @@ if (isset($SearchResult)) { - echo "<table cellpadding=1 colspan=7>"; + echo "<table cellpadding=1 colspan=7 class=selection>"; $tableheader = "<tr> <th>" . _('Code') . "</th> <th>" . _('Description') . "</th> <th>" . _('Units') . "</th> - <th><a href='#end'>"._('Go to end of list')."</a></th> + <th colspan=2><a href='#end'>"._('Go to end of list')."</a></th> </tr>"; echo $tableheader; @@ -1096,14 +1099,14 @@ $ImageSource = '<i>'._('No Image').'</i>'; } - $uomsql='SELECT conversionfactor, + $uomsql="SELECT conversionfactor, suppliersuom, unitsofmeasure.unitname FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" - AND stockid="'.$myrow['stockid'].'"'; + WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' + AND stockid='".$myrow['stockid']."'"; $uomresult=DB_query($uomsql, $db); if (DB_num_rows($uomresult)>0) { @@ -1121,7 +1124,7 @@ <td>".$uom."</td> <td>".$ImageSource."</td> <td><input class='number' type='text' size=6 value=0 name='qty".$myrow['stockid']."'></td> - <td><input type='hidden' size=6 value=".$uom." name=uom></td> + <input type='hidden' size=6 value=".$uom." name=uom> </tr>"; $PartsDisplayed++; @@ -1142,8 +1145,6 @@ echo '<a name="end"></a><br><div class="centre"><input type="submit" name="NewItem" value="Order some"></div>'; }#end if SearchResults to show -echo '<hr>'; - echo '</form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-07 10:04:40 UTC (rev 3684) +++ trunk/doc/Change.log.html 2010-08-07 11:15:40 UTC (rev 3685) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was causing search errors later in the script</p> <p>06/08/10 Tim: Purchase Ordering - Set the allow print flag when the order is re-authorised</p> <p>02/08/10 Tim: DailyBankTransactions.php - Show currencies correctly when transaction is in different currency to bank currency</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-07 16:27:44
|
Revision: 3686 http://web-erp.svn.sourceforge.net/web-erp/?rev=3686&view=rev Author: tim_schofield Date: 2010-08-07 16:27:37 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Sql quoting correction, layout changes, and assorted minor bug corrections Modified Paths: -------------- trunk/PDFLowGP.php trunk/doc/Change.log.html trunk/includes/PDFLowGPPageHeader.inc trunk/index.php Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2010-08-07 11:15:40 UTC (rev 3685) +++ trunk/PDFLowGP.php 2010-08-07 16:27:37 UTC (rev 3686) @@ -10,7 +10,7 @@ if (!isset($_POST['FromCat']) OR $_POST['FromCat']=='') { $title=_('Low Gross Profit Sales'); } - +$debug=0; if (isset($_POST['PrintPDF'])) { include('includes/PDFStarter.php'); @@ -29,82 +29,82 @@ exit; } - - - /*Now figure out the data to report for the category range under review */ + /*Now figure out the data to report for the category range under review */ $SQL = "SELECT stockmaster.categoryid, - stockmaster.stockid, - stockmoves.transno, - stockmoves.trandate, - systypes.typename, - stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost as unitcost, - stockmoves.qty, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.price*(1-stockmoves.discountpercent) as sellingprice, - (stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS gp - FROM stockmaster, - stockmoves, - systypes - WHERE stockmoves.type=systypes.typeid - AND stockmaster.stockid=stockmoves.stockid - AND stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' - AND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "' - AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . ($_POST['GPMin']/100) . " - ORDER BY stockmaster.stockid"; + stockmaster.stockid, + stockmoves.transno, + stockmoves.trandate, + systypes.typename, + stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost as unitcost, + stockmoves.qty, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.price*(1-stockmoves.discountpercent) as sellingprice, + (stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS gp, + debtorsmaster.name + FROM stockmaster, + stockmoves, + systypes, + debtorsmaster + WHERE stockmoves.type=systypes.typeid + AND stockmaster.stockid=stockmoves.stockid + AND stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' + AND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "' + AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . ($_POST['GPMin']/100) . " + AND stockmoves.debtorno=debtorsmaster.debtorno + ORDER BY stockmaster.stockid"; $LowGPSalesResult = DB_query($SQL,$db,'','',false,false); if (DB_error_no($db) !=0) { include('includes/header.inc'); - prnMsg(_('The low GP items could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error'); - echo "<br><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; - if ($debug==1){ - echo "<br>$SQL"; - } - include('includes/footer.inc'); - exit; + prnMsg(_('The low GP items could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error'); + echo "<br><a href='" .$rootpath ."/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$SQL"; + } + include('includes/footer.inc'); + exit; } if (DB_num_rows($LowGPSalesResult) == 0) { - include('includes/header.inc'); - prnMsg(_('No low GP items retrieved'), 'warn'); - echo "<br><a href='" . $rootpath . "/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; - if ($debug==1){ - echo "<br>$SQL"; - } - include('includes/footer.inc'); - exit; + include('includes/header.inc'); + prnMsg(_('No low GP items retrieved'), 'warn'); + echo "<br><a href='" . $rootpath . "/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + if ($debug==1){ + echo "<br>$SQL"; + } + include('includes/footer.inc'); + exit; } include ('includes/PDFLowGPPageHeader.inc'); $Tot_Val=0; $Category = ''; $CatTot_Val=0; - While ($LowGPItems = DB_fetch_array($LowGPSalesResult,$db)){ + while ($LowGPItems = DB_fetch_array($LowGPSalesResult,$db)){ $YPos -=$line_height; $FontSize=8; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,30,$FontSize,$LowGPItems['typename']); - $LeftOvers = $pdf->addTextWrap(80,$YPos,30,$FontSize,$LowGPItems['transno']); - $LeftOvers = $pdf->addTextWrap(110,$YPos,50,$FontSize,$LowGPItems['stockid']); - $LeftOvers = $pdf->addTextWrap(160,$YPos,50,$FontSize,$LowGPItems['debtorno']); - $LeftOvers = $pdf->addTextWrap(210,$YPos,50,$FontSize,$LowGPItems['branchcode']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+2,$YPos,30,$FontSize,$LowGPItems['typename']); + $LeftOvers = $pdf->addTextWrap(100,$YPos,30,$FontSize,$LowGPItems['transno']); + $LeftOvers = $pdf->addTextWrap(130,$YPos,50,$FontSize,$LowGPItems['stockid']); + $LeftOvers = $pdf->addTextWrap(220,$YPos,50,$FontSize,$LowGPItems['name']); $DisplayUnitCost = number_format($LowGPItems['unitcost'],2); $DisplaySellingPrice = number_format($LowGPItems['sellingprice'],2); $DisplayGP = number_format($LowGPItems['gp'],2); $DisplayGPPercent = number_format(($LowGPItems['gp']*100)/$LowGPItems['sellingprice'],1); - $LeftOvers = $pdf->addTextWrap(320,$YPos,60,$FontSize,$DisplaySellingPrice,'right'); - $LeftOvers = $pdf->addTextWrap(380,$YPos,60,$FontSize,$DisplayUnitCost, 'right'); + $LeftOvers = $pdf->addTextWrap(330,$YPos,60,$FontSize,$DisplaySellingPrice,'right'); + $LeftOvers = $pdf->addTextWrap(380,$YPos,62,$FontSize,$DisplayUnitCost, 'right'); $LeftOvers = $pdf->addTextWrap(440,$YPos,60,$FontSize,$DisplayGP, 'right'); - $LeftOvers = $pdf->addTextWrap(500,$YPos,30,$FontSize,$DisplayGPPercent . '%', 'right'); + $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplayGPPercent . '%', 'right'); if ($YPos < $Bottom_Margin + $line_height){ - include('includes/PDFLowGPPageHeader.inc'); + include('includes/PDFLowGPPageHeader.inc'); } } /*end low GP items while loop */ @@ -116,14 +116,14 @@ $pdfcode = $pdf->output(); $len = strlen($pdfcode); - if ($len<=20){ + if ($len<=20){ $title = _('Print Low GP Items Error'); include('includes/header.inc'); prnMsg (_('There were no items below print out for the location specified'),'error'); echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; - } else { + } else { header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename=LowGPSales.pdf'); @@ -134,37 +134,40 @@ $pdf->Output('PDFLowGP.pdf', 'I'); } */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_LowGPSales_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_LowGPSales_' . date('Y-m-d') . '.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit */ include('includes/header.inc'); - if (strlen($_POST['FromDate'])<1 OR strlen($_POST['ToDate'])<1) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . _('Low Gross Profit Report') . '</p>'; + if (!isset($_POST['FromDate']) OR !isset($_POST['ToDate'])) { + /*if $FromDate is not set then show a form to allow input */ $_POST['FromDate']=Date($_SESSION['DefaultDateFormat']); $_POST['ToDate']=Date($_SESSION['DefaultDateFormat']); $_POST['GPMin']=0; - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table>"; + echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; echo '<tr><td>' . _('Sales Made From') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . "):</td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' size=10 maxlength=10 VALUE='" . $_POST['FromDate'] . "'></td> - </tr>"; + <td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' size=10 maxlength=10 VALUE='" . $_POST['FromDate'] . "'></td> + </tr>"; echo '<tr><td>' . _('Sales Made To') . ' (' . _('in the format') . ' ' . $_SESSION['DefaultDateFormat'] . "):</td> - <td><input type=TEXT class='date' alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size=10 maxlength=10 VALUE='" . $_POST['ToDate'] . "'></td> - </tr>"; + <td><input type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size=10 maxlength=10 VALUE='" . $_POST['ToDate'] . "'></td> + </tr>"; echo '<tr><td>' . _('Show sales with GP % below') . ":</td> - <td><input type=text class='number' name='GPMin' maxlength=3 size=3 VALUE=" . $_POST['GPMin'] . "></td> - </tr>"; + <td><input type=text class='number' name='GPMin' maxlength=3 size=3 value=" . $_POST['GPMin'] . "></td> + </tr>"; - echo "</table><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; + echo "</table><br><div class='centre'><input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; } include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-07 11:15:40 UTC (rev 3685) +++ trunk/doc/Change.log.html 2010-08-07 16:27:37 UTC (rev 3686) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was causing search errors later in the script</p> <p>06/08/10 Tim: Purchase Ordering - Set the allow print flag when the order is re-authorised</p> Modified: trunk/includes/PDFLowGPPageHeader.inc =================================================================== --- trunk/includes/PDFLowGPPageHeader.inc 2010-08-07 11:15:40 UTC (rev 3685) +++ trunk/includes/PDFLowGPPageHeader.inc 2010-08-07 16:27:37 UTC (rev 3686) @@ -24,17 +24,30 @@ $pdf->line($Left_Margin, $YPos- $line_height,$Page_Width-$Right_Margin, $YPos- $line_height); $pdf->line($Page_Width-$Right_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos- $line_height); +$pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height); +$pdf->line($Left_Margin, $YPos+$line_height,$Left_Margin, $Bottom_Margin); +$pdf->line($Left_Margin, $Bottom_Margin, $Page_Width-$Right_Margin, $Bottom_Margin); +$pdf->line($Page_Width-$Right_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $Bottom_Margin); + +$pdf->line(98, $YPos+$line_height, 98, $Bottom_Margin); +$pdf->line(128, $YPos+$line_height, 128, $Bottom_Margin); +$pdf->line(218, $YPos+$line_height, 218, $Bottom_Margin); +$pdf->line(338, $YPos+$line_height, 338, $Bottom_Margin); +$pdf->line(398, $YPos+$line_height, 398, $Bottom_Margin); +$pdf->line(448, $YPos+$line_height, 448, $Bottom_Margin); +$pdf->line(503, $YPos+$line_height, 503, $Bottom_Margin); + /*set up the headings */ $Xpos = $Left_Margin+1; $LeftOvers = $pdf->addTextWrap($Xpos,$YPos,100-$Left_Margin,$FontSize,_('Trans'), 'centre'); $LeftOvers = $pdf->addTextWrap(100,$YPos,50,$FontSize,_('No'), 'centre'); -$LeftOvers = $pdf->addTextWrap(150,$YPos,50,$FontSize,_('Item'), 'centre'); -$LeftOvers = $pdf->addTextWrap(250,$YPos,100,$FontSize,_('Customer'), 'centre'); -$LeftOvers = $pdf->addTextWrap(350,$YPos,50,$FontSize,_('Cost'), 'centre'); -$LeftOvers = $pdf->addTextWrap(390,$YPos,60,$FontSize,_('Sell Price'), 'centre'); -$LeftOvers = $pdf->addTextWrap(450,$YPos,60,$FontSize,_('GP'), 'centre'); -$LeftOvers = $pdf->addTextWrap(510,$YPos,60,$FontSize,_('GP') . ' %', 'centre'); +$LeftOvers = $pdf->addTextWrap(130,$YPos,50,$FontSize,_('Item'), 'centre'); +$LeftOvers = $pdf->addTextWrap(220,$YPos,130,$FontSize,_('Customer'), 'centre'); +$LeftOvers = $pdf->addTextWrap(340,$YPos,50,$FontSize,_('Sell Price'), 'right'); +$LeftOvers = $pdf->addTextWrap(380,$YPos,62,$FontSize,_('Cost'), 'right'); +$LeftOvers = $pdf->addTextWrap(440,$YPos,60,$FontSize,_('GP'), 'right'); +$LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,_('GP') . ' %', 'right'); $FontSize=8; $YPos =$YPos - (2*$line_height); Modified: trunk/index.php =================================================================== --- trunk/index.php 2010-08-07 11:15:40 UTC (rev 3685) +++ trunk/index.php 2010-08-07 16:27:37 UTC (rev 3686) @@ -213,6 +213,11 @@ </tr> <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/PDFLowGP.php?' . sid . '">' . _('Sales With Low Gross Profit Report') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> <?php echo GetRptLinks('ord'); ?> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-08-08 07:43:20
|
Revision: 3687 http://web-erp.svn.sourceforge.net/web-erp/?rev=3687&view=rev Author: daintree Date: 2010-08-08 07:43:13 +0000 (Sun, 08 Aug 2010) Log Message: ----------- work on contracts Modified Paths: -------------- trunk/Contracts.php trunk/CounterSales.php trunk/DeliveryDetails.php trunk/SelectContract.php trunk/Stocks.php trunk/doc/Change.log.html trunk/doc/Manual/ManualCurrencies.html trunk/includes/DefineContractClass.php trunk/includes/MiscFunctions.php trunk/sql/mysql/weberp-demo.sql Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/Contracts.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -52,7 +52,6 @@ $_POST['SelectedCustomer'] = $_GET['SelectedCustomer']; - $_SESSION['Contract'.$identifier]->Status =0; /*The customer is checked for credit and the Contract Object populated * using the usual logic of when a customer is selected * */ @@ -155,8 +154,8 @@ /*read in all the guff from the selected contract into the contract Class variable */ $ContractHeaderSQL = "SELECT contractdescription, - debtorno, - branchcode, + contracts.debtorno, + contracts.branchcode, status, categoryid, orderno, @@ -164,8 +163,16 @@ wo, requireddate, drawing, - exrate - FROM contracts + exrate, + debtorsmaster.name, + custbranch.brname, + debtorsmaster.currcode + FROM contracts INNER JOIN debtorsmaster + ON contracts.debtorno=debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno WHERE contractref= '" . $_GET['ModifyContractRef'] . "'"; $ErrMsg = _('The contract cannot be retrieved because'); @@ -187,6 +194,11 @@ $_SESSION['Contract'.$identifier]->RequiredDate = ConvertSQLDate($myrow['requireddate']); $_SESSION['Contract'.$identifier]->Drawing = $myrow['drawing']; $_SESSION['Contract'.$identifier]->ExRate = $myrow['exrate']; + $_SESSION['Contract'.$identifier]->BranchName = $myrow['brname']; + $_SESSION['RequireCustomerSelection'] = 0; + $_SESSION['Contract'.$identifier]->CustomerName = $myrow['name']; + $_SESSION['Contract'.$identifier]->CurrCode = $myrow['currcode']; + /*now populate the contract BOM array with the items required for the contract */ @@ -241,33 +253,36 @@ if (isset($_POST['CancelContract'])) { /*The cancel button on the header screen - to delete the contract */ - $OK_to_delete = 1; //assume this in the first instance + $OK_to_delete = true; //assume this in the first instance if(!isset($_SESSION['ExistingContract']) OR $_SESSION['ExistingContract']!=0) { - /* need to check that not already ordered by the customer - status = 0 */ - if($_SESSION['Contract'.$identifier]->Status==1){ - $result = DB_query('SELECT orderno FROM salesorders WHERE orderno=' . $_SESSION['Contract'.$identifier]->OrderNo,$db); - if (DB_num_rows($result)==1){ - $OK_to_delete =0; - prnMsg( _('The contract has already been ordered by the customer the order must also be deleted first before the contract can be deleted'),'warn'); - } + /* need to check that not already ordered by the customer - status = 100 */ + if($_SESSION['Contract'.$identifier]->Status==2){ + $OK_to_delete = false; + prnMsg( _('The contract has already been ordered by the customer the order must also be deleted first before the contract can be deleted'),'warn'); } } - if ($OK_to_delete==1){ - if($_SESSION['ExistingContract']!=0){ - - $sql = "DELETE FROM contractbom WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; - $ErrMsg = _('The contract bill of materials could not be deleted because'); + + if ($OK_to_delete==true){ + $sql = "DELETE FROM contractbom WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; + $ErrMsg = _('The contract bill of materials could not be deleted because'); + $DelResult=DB_query($sql,$db,$ErrMsg); + $sql = "DELETE FROM contractreqts WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; + $ErrMsg = _('The contract requirements could not be deleted because'); + $DelResult=DB_query($sql,$db,$ErrMsg); + $sql= "DELETE FROM contracts WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; + $ErrMsg = _('The contract could not be deleted because'); + $DelResult=DB_query($sql,$db,$ErrMsg); + + if ($_SESSION['Contract'.$identifier]->Status==1){ + $sql = "DELETE FROM salesorderdetails WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; + $ErrMsg = _('The quotation line for the contract could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); - $sql = "DELETE FROM contractreqts WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; - $ErrMsg = _('The contract requirements could not be deleted because'); + $sql = "DELETE FROM salesorders WHERE orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; + $ErrMsg = _('The quotation for the contract could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); - $sql= "DELETE FROM contracts WHERE contractref='" . $_SESSION['Contract'.$identifier]->ContractRef . "'"; - $ErrMsg = _('The contract could not be deleted because'); - $DelResult=DB_query($sql,$db,$ErrMsg); - - prnMsg( _('Contract').' '.$_SESSION['Contract'.$identifier]->ContractRef.' '._('has been cancelled'), 'success'); - unset($_SESSION['ExistingContract']); } + prnMsg( _('Contract').' '.$_SESSION['Contract'.$identifier]->ContractRef.' '._('has been cancelled'), 'success'); + unset($_SESSION['ExistingContract']); unset($_SESSION['Contract'.$identifier]->ContractBOM); unset($_SESSION['Contract'.$identifier]->ContractReqts); unset($_SESSION['Contract'.$identifier]); @@ -283,10 +298,9 @@ $_SESSION['ExistingContract']= 0; $_SESSION['Contract'.$identifier] = new Contract; - - $_SESSION['Contract'.$identifier]->Status = 0; //new contracts are just quotes ... - - if ($_SESSION['Contract'.$identifier]->DebtorNo=='' OR !isset($_SESSION['Contract'.$identifier]->DebtorNo)){ + + if ($_SESSION['Contract'.$identifier]->DebtorNo=='' + OR !isset($_SESSION['Contract'.$identifier]->DebtorNo)){ /* a session variable will have to maintain if a supplier * has been selected for the order or not the session @@ -298,7 +312,7 @@ } } -if (isset($_POST['CommitContract'])){ +if (isset($_POST['CommitContract']) OR isset($_POST['CreateQuotation'])){ /*This is the bit where the contract object is commited to the database after a bit of error checking */ //First update the session['Contract'.$identifier] variable with all inputs from the form @@ -308,9 +322,14 @@ prnMsg(_('The contract reference is expected to be more than 2 characters long. Please alter the contract reference before proceeding.'),'error'); $InputError = true; } + if(ContainsIllegalCharacters($_POST['ContractRef'])){ + prnMsg(_('The contract reference cannot contain any spaces, slashes, or inverted commas. Please alter the contract reference before proceeding.'),'error'); + $InputError = true; + } + //The contractRef cannot be the same as an existing stockid or contractref $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['ContractRef'] . "'",$db); - if (DB_num_rows($result)==1){ + if (DB_num_rows($result)==1 AND $_SESSION['Contract'.$identifier]->Status ==0){ prnMsg(_('The contract reference cannot be the same as a previously created stock item. Please modify the contract reference before continuing'),'error'); $InputError=true; } @@ -361,8 +380,6 @@ requireddate, margin, customerref, - quantityreqd, - units, exrate, status FROM contracts @@ -420,9 +437,37 @@ } if ($ExistingContract['status']==1 AND ! $InputError){ //then the quotation will need to be updated with the revised contract cost if necessary + $ContractBOMCost =0; + foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { + $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); + } + $ContractReqtsCost=0; + foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { + $ContractReqtsCost += ($Requirement->CostPerUnit * $Requirement->Quantity); + } + $ContractCost = $ContractReqtsCost+$ContractBOMCost; + $ContractPrice = ($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100); + + $sql = "UPDATE stockmaster SET description='" . $_SESSION['Contract'.$identifier]->ContractDescription . "', + longdescription='" . $_SESSION['Contract'.$identifier]->ContractDescription . "', + categoryid = '" . $_SESSION['Contract'.$identifier]->CategoryID . "', + materialcost= '" . $ContractCost . "' + WHERE stockid ='" . $_SESSION['Contract'.$identifier]->ContractRef."'"; + $ErrMsg = _('The contract item could not be updated because'); + $DbgMsg = _('The SQL that was used to update the contract item failed was'); + $InsertNewItemResult = DB_query($sql,$db, $ErrMsg, $DbgMsg); + + //update the quotation + $sql = "UPDATE salesorderdetails + SET unitprice = '" . $ContractPrice* $_SESSION['Contract'.$identifier]->ExRate . "' + WHERE stkcode='" . $_SESSION['Contract'.$identifier]->ContractRef . "' + AND orderno='" . $_SESSION['Contract'.$identifier]->OrderNo . "'"; + $ErrMsg = _('The contract quotation could not be updated because'); + $DbgMsg = _('The SQL that failed to update the quotation was'); + $UpdQuoteResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); + pnMsg(_('The contract quotation has been updated based on the new contract cost and margin'),'success'); + echo '<br><a href="' .$rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . _('Go to Quotation') . ' ' . $_SESSION['Contract'.$identifier]->OrderNo . '</a>'; - - } if ($ExistingContract['status'] == 0 AND $_POST['Status']==1){ /*we are updating the status on the contract to a quotation so we need to @@ -434,11 +479,6 @@ } } elseif (!$InputError) { /*Its a new contract - so insert */ - if ($_POST['Status'] !=0){ - //a new contract being created with a status of not a quotation - create it anyway but with status=0 - prnMsg(_('A contract can only be created with a status of costing initially'),'warn'); - } - $sql = "INSERT INTO contracts ( contractref, debtorno, branchcode, @@ -488,20 +528,168 @@ $result = DB_query($sql,$db,$ErrMsg); } prnMsg(_('The new contract has been added to the database'),'success'); - unset($_SESSION['Contract'.$identifier]->ContractBOM); - unset($_SESSION['Contract'.$identifier]->ContractReqts); - unset($_SESSION['Contract' . $identifier]); - unset($_POST['ContractRef']); - unset($_POST['Description']); - unset($_POST['CategoryID']); - unset($_POST['RequiredDate']); - unset($_POST['Margin']); - unset($_POST['CustomerRef']); - unset($_POST['ExRate']); - + } //end of adding a new contract }//end of commital to database +if(isset($_POST['CreateQuotation']) AND !$InputError){ +//Create a quotation for the contract as entered +//First need to create the item in stockmaster + +//calculate the item's contract cost + $ContractBOMCost =0; + foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { + $ContractBOMCost += ($Component->ItemCost * $Component->Quantity); + } + $ContractReqtsCost=0; + foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { + $ContractReqtsCost += ($Requirement->CostPerUnit * $Requirement->Quantity); + } + $ContractCost = $ContractReqtsCost+$ContractBOMCost; + $ContractPrice = ($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100); + +//Check if the item exists already + $sql = "SELECT * FROM stockmaster WHERE stockid='" . $_SESSION['Contract'.$identifier]->ContractRef."'"; + $ErrMsg = _('The item could not be retrieved because'); + $DbgMsg = _('The SQL that was used to find the item failed was'); + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg); + if (DB_num_rows($result)==0) { //then the item doesn't currently exist so add it + + $sql = "INSERT INTO stockmaster (stockid, + description, + longdescription, + categoryid, + mbflag, + taxcatid, + materialcost) + VALUES ('" . $_SESSION['Contract'.$identifier]->ContractRef."', + '" . $_SESSION['Contract'.$identifier]->ContractDescription . "', + '" . $_SESSION['Contract'.$identifier]->ContractDescription . "', + '" . $_SESSION['Contract'.$identifier]->CategoryID . "', + 'M', + '" . $_SESSION['DefaultTaxCategory'] . "', + '" . $ContractCost . "')"; + $ErrMsg = _('The new contract item could not be added because'); + $DbgMsg = _('The SQL that was used to insert the contract item failed was'); + $InsertNewItemResult = DB_query($sql,$db, $ErrMsg, $DbgMsg); + $sql = "INSERT INTO locstock (loccode, + stockid) + SELECT locations.loccode, + '" . $_SESSION['Contract'.$identifier]->ContractRef . "' + FROM locations"; + + $ErrMsg = _('The locations for the item') . ' ' . $_SESSION['Contract'.$identifier]->ContractRef . ' ' . _('could not be added because'); + $DbgMsg = _('NB Locations records can be added by opening the utility page') . ' <i>Z_MakeStockLocns.php</i> ' . _('The SQL that was used to add the location records that failed was'); + $InsLocnsResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); + } + //now add the quotation for the item + + //first need to get some more details from the customer/branch record + $sql = "SELECT debtorsmaster.salestype, + custbranch.defaultshipvia, + custbranch.brname, + custbranch.braddress1, + custbranch.braddress2, + custbranch.braddress3, + custbranch.braddress4, + custbranch.braddress5, + custbranch.braddress6, + custbranch.phoneno, + custbranch.email, + custbranch.defaultlocation + FROM debtorsmaster INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + WHERE debtorsmaster.debtorno='" . $_SESSION['Contract'.$identifier]->DebtorNo . "' + AND custbranch.branchcode='" . $_SESSION['Contract'.$identifier]->BranchCode . "'"; + $ErrMsg = _('The customer and branch details could not be retrieved because'); + $DbgMsg = _('The SQL that was used to find the customer and branch details failed was'); + $CustomerDetailsResult = DB_query($sql,$db, $ErrMsg, $DbgMsg); + + $CustomerDetailsRow = DB_fetch_array($CustomerDetailsResult); + + //start a DB transaction + $Result = DB_Txn_Begin($db); + $OrderNo = GetNextTransNo(30, $db); + $HeaderSQL = "INSERT INTO salesorders ( + orderno, + debtorno, + branchcode, + customerref, + orddate, + ordertype, + shipvia, + deliverto, + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + contactphone, + contactemail, + fromstkloc, + deliverydate, + quotedate, + quotation) + VALUES ( + '". $OrderNo . "', + '" . DB_escape_string($_SESSION['Contract'.$identifier]->DebtorNo) . "', + '" . DB_escape_string($_SESSION['Contract'.$identifier]->BranchCode) . "', + '". DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) ."', + '" . DB_escape_string(Date('Y-m-d H:i')) . "', + '" . DB_escape_string($CustomerDetailsRow['salestype']) . "', + '" . DB_escape_string($CustomerDetailsRow['defaultshipvia']) ."', + '". DB_escape_string($CustomerDetailsRow['brname']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress1']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress2']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress3']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress4']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress5']) . "', + '" . DB_escape_string($CustomerDetailsRow['braddress6']) . "', + '" . DB_escape_string($CustomerDetailsRow['phoneno']) . "', + '" . DB_escape_string($CustomerDetailsRow['email']) . "', + '" . DB_escape_string($CustomerDetailsRow['defaultlocation']) ."', + '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "', + '" . Date('Y-m-d') . "', + '1' )"; + + $ErrMsg = _('The quotation cannot be added because'); + $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg,true); + $LineItemSQL = "INSERT INTO salesorderdetails ( orderlineno, + orderno, + stkcode, + unitprice, + quantity, + poline, + itemdue) + VALUES ('0', + '" . $OrderNo . "', + '" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "', + '" . ($ContractPrice * $_SESSION['Contract'.$identifier]->ExRate) . "', + '1', + '" . DB_escape_string($_SESSION['Contract'.$identifier]->CustomerRef) . "', + '" . FormatDateForSQL($_SESSION['Contract'.$identifier]->RequiredDate) . "')"; + $DbgMsg = _('The SQL that failed was'); + $ErrMsg = _('Unable to add the quotation line'); + $Ins_LineItemResult = DB_query($LineItemSQL,$db,$ErrMsg,$DbgMsg,true); + //end of adding the quotation to salesorders/details + + //make the status of the contract 1 - to indicate that it is now quoted + $sql = "UPDATE contracts SET orderno='" . $OrderNo . "', + status='" . 1 . "' + WHERE contractref='" . DB_escape_string($_SESSION['Contract'.$identifier]->ContractRef) . "'"; + $ErrMsg = _('Unable to update the contract status and order number because'); + $UpdContractResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $Result = DB_Txn_Commit($db); + $_SESSION['Contract'.$identifier]->Status=1; + $_SESSION['Contract'.$identifier]->OrderNo=$OrderNo; + prnMsg(_('The contract has been made into quotation number') . ' ' . $OrderNo,'info'); + echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $OrderNo . '&Quotations=Quotes_Only">' . _('Go to quotation number:') . ' ' . $OrderNo . '</a>'; + +} //end of if making a quotation + + + if (isset($_POST['SearchCustomers'])){ if (($_POST['CustKeywords']!='') AND (($_POST['CustCode']!='') OR ($_POST['CustPhone']!=''))) { @@ -723,7 +911,7 @@ echo '<table>'; echo '<tr><td>' . _('Contract Reference') . ':</td><td>'; - if ($_SESSION['Contract'.$identifier]->Status==100) { + if ($_SESSION['Contract'.$identifier]->Status==0) { /*Then the contract has not become an order yet and we can allow changes to the ContractRef */ echo '<input type="text" name="ContractRef" size=21 maxlength=20 value="' . $_SESSION['Contract'.$identifier]->ContractRef . '">'; } else { @@ -749,19 +937,6 @@ echo '</select><a target="_blank" href="'. $rootpath . '/StockCategories.php?' . SID . '">' . _('Add or Modify Contract Categories') . '</a></td></tr>'; - echo '<tr><td>' . _('Units of Measure') . ':</td><td><select name="Units">'; - $sql = 'SELECT unitname FROM unitsofmeasure ORDER by unitname'; - $UOMResult = DB_query($sql,$db); - - while( $UOMrow = DB_fetch_array($UOMResult) ) { - if (isset($_SESSION['Contract'.$identifier]->Units) AND $_SESSION['Contract'.$identifier]->Units==$UOMrow['unitname']){ - echo '<option selected value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; - } else { - echo '<option value="' . $UOMrow['unitname'] . '">' . $UOMrow['unitname'] . '</option>'; - } - } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Contract Description'); echo ':</td><td><textarea name="ContractDescription" style="width:100%" rows=5>' . $_SESSION['Contract'.$identifier]->ContractDescription . '</textarea></td></tr>'; @@ -795,15 +970,15 @@ if ($_SESSION['Contract'.$identifier]->Status == 0){ echo _('Contract Setup'); } elseif ($_SESSION['Contract'.$identifier]->Status == 1){ - echo _('Customer Already Quoted'); + echo _('Customer Quoted'); } elseif ($_SESSION['Contract'.$identifier]->Status == 2){ echo _('Order Placed'); } echo '</select></td></tr>'; - if ($_SESSION['Contract'.$identifier]->Status>=1) { - echo '<tr><td>' . _('Quotation Reference/Sales Order No') . ':</td><td>' . $_SESSION['Contract'.$identifier]->OrderNo . '</td></tr>'; + if ($_SESSION['Contract'.$identifier]->Status >=1) { + echo '<tr><td>' . _('Quotation Reference/Sales Order No') . ':</td><td><a href="' . $rootpath . '/SelectSalesOrder.php?OrderNumber=' . $_SESSION['Contract'.$identifier]->OrderNo . '&Quotations=Quotes_Only">' . $_SESSION['Contract'.$identifier]->OrderNo . '</a></td></tr>'; } - if ($_SESSION['Contract'.$identifier]->Status!=0) { + if ($_SESSION['Contract'.$identifier]->Status!=2) { echo '<tr><td>' . _('Contract Work Order Ref') . ':</td><td>' . $_SESSION['Contract'.$identifier]->WorkOrder . '</td></tr>'; } echo '</table><hr>'; @@ -858,10 +1033,18 @@ echo'<table><tr><th>' . _('Total Contract Cost') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost),2) . '</th><th>' . _('Contract Price') . '</th><th class="number">' . number_format(($ContractBOMCost+$ContractReqtsCost)/((100-$_SESSION['Contract'.$identifier]->Margin)/100),2) . '</th></tr></table>'; echo'<p></p>'; - echo '<div class="centre"><input type="submit" name="EnterContractBOM" value="' . _('Enter Items Required') . '"> - <input type=submit name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'"> - <input type=submit name="CommitContract" value="' . _('Commit Changes') .'"></div>'; + <input type=submit name="EnterContractRequirements" value="' . _('Enter Other Requirements') .'">'; + if($_SESSION['Contract'.$identifier]->Status==0){ // not yet quoted + echo '<input type=submit name="CommitContract" value="' . _('Commit Changes') .'">'; + } elseif($_SESSION['Contract'.$identifier]->Status==1){ //quoted but not yet ordered + echo '<input type=submit name="CommitContract" value="' . _('Update Quotation') .'">'; + } + if($_SESSION['Contract'.$identifier]->Status==0){ //not yet quoted + echo ' <input type=submit name="CreateQuotation" value="' . _('Create Quotation') .'"></div>'; + } else { + echo '</div>'; + } if ($_SESSION['Contract'.$identifier]->Status!=2) { echo '<p><div class="centre"><input type="submit" name="CancelContract" value="' . _('Cancel and Delete Contract') . '"></div></p>'; } Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/CounterSales.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -1601,10 +1601,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items'.$identifier]->DefaultSalesType, $db) . ", + '" . $PeriodNo . "', + '" . GetCOGSGLAccount($Area, $OrderLine->StockID, $_SESSION['Items'.$identifier]->DefaultSalesType, $db) . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->Quantity . " @ " . $OrderLine->StandardCost . "', - " . $OrderLine->StandardCost * $OrderLine->Quantity . ")"; + '" . $OrderLine->StandardCost * $OrderLine->Quantity . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost of sales GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1623,10 +1623,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . $StockGLCode['stockact'] . ", + '" . $PeriodNo . "', + '" . $StockGLCode['stockact'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->Quantity . " @ " . $OrderLine->StandardCost . "', - " . (-$OrderLine->StandardCost * $OrderLine->Quantity) . ")"; + '" . (-$OrderLine->StandardCost * $OrderLine->Quantity) . "')"; $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'); @@ -1649,10 +1649,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . $SalesGLAccounts['salesglcode'] . ", + '" . $PeriodNo . "', + '" . $SalesGLAccounts['salesglcode'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . " x " . $OrderLine->Quantity . " @ " . $OrderLine->Price . "', - " . (-$OrderLine->Price * $OrderLine->Quantity/$ExRate) . ")"; + '" . (-$OrderLine->Price * $OrderLine->Quantity/$ExRate) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales GL posting could not be inserted because'); $DbgMsg = '<br>' ._('The following SQL to insert the GLTrans record was used'); @@ -1671,10 +1671,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . $SalesGLAccounts['discountglcode'] . ", + '" . $PeriodNo . "', + '" . $SalesGLAccounts['discountglcode'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . " - " . $OrderLine->StockID . " @ " . ($OrderLine->DiscountPercent * 100) . "%', - " . ($OrderLine->Price * $OrderLine->Quantity * $OrderLine->DiscountPercent/$ExRate) . ")"; + '" . ($OrderLine->Price * $OrderLine->Quantity * $OrderLine->DiscountPercent/$ExRate) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales discount GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1697,10 +1697,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . $_SESSION['CompanyRecord']['debtorsact'] . ", + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['debtorsact'] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - " . (($_SESSION['Items'.$identifier]->total + $TaxTotal)/$ExRate) . ")"; + '" . (($_SESSION['Items'.$identifier]->total + $TaxTotal)/$ExRate) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The total debtor GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the total debtors control GLTrans record was used'); @@ -1720,10 +1720,10 @@ VALUES ( 10, " . $InvoiceNo . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", - " . $TaxGLCodes[$TaxAuthID] . ", + '" . $PeriodNo . "', + '" . $TaxGLCodes[$TaxAuthID] . "', '" . $_SESSION['Items'.$identifier]->DebtorNo . "', - " . (-$TaxAmount/$ExRate) . ")"; + '" . (-$TaxAmount/$ExRate) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The tax GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GLTrans record was used'); @@ -1745,10 +1745,10 @@ VALUES (12, ' . $ReceiptNumber . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ", + '" . $PeriodNo . "', '" . $_POST['BankAccount'] . "', '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', - " . ($_POST['AmountPaid']/$ExRate) . ')'; + '" . ($_POST['AmountPaid']/$ExRate) . "')"; $DbgMsg = _('The SQL that failed to insert the GL transaction for the bank account debit was'); $ErrMsg = _('Cannot insert a GL transaction for the bank account debit'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1764,11 +1764,10 @@ VALUES (12, ' . $ReceiptNumber . ", '" . $DefaultDispatchDate . "', - " . $PeriodNo . ', - ' . $_SESSION['CompanyRecord']['debtorsact'] . ", - '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', - " . -($_POST['AmountPaid']/$ExRate) . ' - )'; + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['debtorsact'] . "', + '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', + '" . -($_POST['AmountPaid']/$ExRate) . "')"; $DbgMsg = _('The SQL that failed to insert the GL transaction for the debtors account credit was'); $ErrMsg = _('Cannot insert a GL transaction for the debtors account credit'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -1800,7 +1799,7 @@ //insert the banktrans record in the currency of the bank account - $SQL='INSERT INTO banktrans (type, + $SQL="INSERT INTO banktrans (type, transno, bankact, ref, @@ -1811,14 +1810,14 @@ amount, currcode) VALUES (12, - ' . $ReceiptNumber . ', - ' . $_POST['BankAccount'] . ", + '" . $ReceiptNumber . "', + '" . $_POST['BankAccount'] . "', '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') . ' ' . $InvoiceNo . "', - " . $ExRate . ", - " . $BankAccountExRate . ", + '" . $ExRate . "', + '" . $BankAccountExRate . "', '" . $DefaultDispatchDate . "', '" . $_POST['PaymentMethod'] . "', - " . ($_POST['AmountPaid'] * $BankAccountExRate) . ", + '" . ($_POST['AmountPaid'] * $BankAccountExRate) . "', '" . $_SESSION['Items'.$identifier]->DefaultCurrency . "')"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); @@ -1843,11 +1842,11 @@ '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $DefaultDispatchDate . "', '" . date('Y-m-d H-i-s') . "', - " . $PeriodNo . ", - " . $InvoiceNo . ", - " . $ExRate . ", - " . -$_POST['AmountPaid'] . ", - " . -$_POST['AmountPaid'] . ", + '" . $PeriodNo . "', + '" . $InvoiceNo . "', + '" . $ExRate . "', + '" . -$_POST['AmountPaid'] . "', + '" . -$_POST['AmountPaid'] . "', '" . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('Counter Sale') ."')"; $DbgMsg = _('The SQL that failed to insert the customer receipt transaction was'); @@ -1857,7 +1856,7 @@ $ReceiptDebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); $SQL = "UPDATE debtorsmaster SET lastpaiddate = '" . $DefaultDispatchDate . "', - lastpaid=" . $_POST['AmountPaid'] ." + lastpaid='" . $_POST['AmountPaid'] . "' WHERE debtorsmaster.debtorno='" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $DbgMsg = _('The SQL that failed to update the date of the last payment received was'); @@ -1872,8 +1871,8 @@ transid_allocto ) VALUES (' . $_POST['AmountPaid'] . ", '" . $DefaultDispatchDate . "', - " . $ReceiptDebtorTransID . ", - " . $DebtorTransID . ')'; + '" . $ReceiptDebtorTransID . "', + '" . $DebtorTransID . "')"; $DbgMsg = _('The SQL that failed to insert the allocation of the receipt to the invoice was'); $ErrMsg = _('Cannot insert the customer allocation of the receipt to the invoice because'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/DeliveryDetails.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -601,9 +601,89 @@ $DelDate = FormatDateforSQL($_SESSION['Items'.$identifier]->DeliveryDate); $QuotDate = FormatDateforSQL($_SESSION['Items'.$identifier]->QuoteDate); $ConfDate = FormatDateforSQL($_SESSION['Items'.$identifier]->ConfirmedDate); - + $Result = DB_Txn_Begin($db); + /*see if this is a contract quotation being changed to an order? */ + if ($_SESSION['Items'.$identifier]->Quotation==0) { //now its being changed? to an order + $ContractResult = DB_query("SELECT contractref, + requireddate + FROM contracts WHERE orderno='" . $_SESSION['ExistingOrder'] ."' + AND status=1",$db); + if (DB_num_rows($ContractResult)==1){ //then it is a contract quotation being changed to an order + $ContractRow = DB_fetch_array($ContractResult); + $WONo = GetNextTransNo(40,$db); + $ErrMsg = _('Could not update the contract status'); + $DbgMsg = _('The SQL that failed to update the contract status was'); + $UpdContractResult=DB_query("UPDATE contracts SET status=2, + wo='" . $WONo . "' + WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); + $ErrMsg = _('Could not insert the contract bill of materials'); + $InsContractBOM = DB_query("INSERT INTO bom (parent, + component, + workcentreadded, + location, + effectiveafter, + effectiveto) + SELECT contractref, + stockid, + workcentreadded, + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . Date('Y-m-d') . "', + '2037-12-31' + FROM contractbom + WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); + + $ErrMsg = _('Unable to insert a new work order for the sales order item'); + $InsWOResult = DB_query("INSERT INTO workorders (wo, + loccode, + requiredby, + startdate) + VALUES ('" . $WONo . "', + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . $ContractRow['requireddate'] . "', + '" . Date('Y-m-d'). "')", + $db,$ErrMsg,$DbgMsg); + //Need to get the latest BOM to roll up cost but also add the contract other requirements + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost + FROM stockmaster INNER JOIN contractbom + ON stockmaster.stockid=contractbom.stockid + WHERE contractbom.contractref='" . $ContractRow['contractref'] . "'", + $db); + $CostRow = DB_fetch_row($CostResult); + if (is_null($CostRow[0]) OR $CostRow[0]==0){ + $Cost =0; + prnMsg(_('In automatically creating a work order for') . ' ' . $ContractRow['contractref'] . ' ' . _('an item on this sales order, 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[0]; //cost of contract BOM + } + $CostResult = DB_query("SELECT SUM(costperunit*quantity) AS cost + FROM contractreqts + WHERE contractreqts.contractref='" . $ContractRow['contractref'] . "'", + $db); + $CostRow = DB_fetch_row($CostResult); + //add other requirements cost to cost of contract BOM + $Cost += $CostRow[0]; + + // insert parent item info + $sql = "INSERT INTO woitems (wo, + stockid, + qtyreqd, + stdcost) + VALUES ( '" . $WONo . "', + '" . $ContractRow['contractref'] . "', + '1', + '" . $Cost . "')"; + $ErrMsg = _('The work order item could not be added'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements + WoRealRequirements($db, $WONo, $_SESSION['Items'.$identifier]->Location, $ContractRow['contractref']); + + } //end processing if the order was a contract quotation being changed to an order + } //end test to see if the order was a contract quotation being changed to an order + + $HeaderSQL = "UPDATE salesorders SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', @@ -625,9 +705,6 @@ contactemail = '" . $_SESSION['Items'.$identifier]->Email . "', freightcost = '" . $_SESSION['Items'.$identifier]->FreightCost ."', fromstkloc = '" . $_SESSION['Items'.$identifier]->Location ."', - deliverydate = '" . $DelDate . "', - quotedate = '" . $QuotDate . "', - confirmeddate = '" . $ConfDate . "', printedpackingslip = '" . $_POST['ReprintPackingSlip'] . "', quotation = '" . $_SESSION['Items'.$identifier]->Quotation . "', deliverblind = '" . $_SESSION['Items'.$identifier]->DeliverBlind . "' Modified: trunk/SelectContract.php =================================================================== --- trunk/SelectContract.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/SelectContract.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -162,11 +162,11 @@ } $ModifyPage = $rootpath . '/Contracts.php?' . SID . '&ModifyContractRef=' . $myrow['contractref']; - $OrderModifyPage = $rootpath . '/SelectOrderItems.php?' . SID . '&ModifyOrderNo=' . $myrow['orderno']; + $OrderModifyPage = $rootpath . '/SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; $IssueToWOPage = $rootpath . '/WOIssue.php?' . SID . '&WO=' . $myrow['wo']; $FormatedRequiredDate = ConvertSQLDate($myrow['requireddate']); - if ($myrow['status']==0){ //still setting up the contract + if ($myrow['status']==0 OR $myrow['status']==1){ //still setting up the contract echo '<td><a href="' . $ModifyPage . '">' . _('Modify') . '</a></td>'; } else { echo '<td>' . _('n/a') . '</td>'; Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/Stocks.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -102,7 +102,7 @@ $Errors[$i] = 'StockID'; $i++; } - if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'.') OR strstr($StockID,'"')) { + if (ContainsIllegalCharacters($StockID)) { $InputError = 1; prnMsg(_('The stock item code cannot contain any of the following characters') . " - ' & + \" \\ " . _('or a space'),'error'); $Errors[$i] = 'StockID'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/doc/Change.log.html 2010-08-08 07:43:13 UTC (rev 3687) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>08/08/10 Phil: Contracts.php SelectContracts.php DeliveryDetails.php - more work to convert Contracts to quotations and on conversion of contract quotations to orders to create contract work order to issue materials to <p>07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: SelectCustomer.php - Unset $result variable once used as it was causing search errors later in the script</p> Modified: trunk/doc/Manual/ManualCurrencies.html =================================================================== --- trunk/doc/Manual/ManualCurrencies.html 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/doc/Manual/ManualCurrencies.html 2010-08-08 07:43:13 UTC (rev 3687) @@ -21,4 +21,4 @@ <br><br> For all credit ratings set up, this field indicates whether or not the rating is serious enough to prohibit future invoicing to customers set up with this credit rating. -<!-- Help End: CreditStatus --> +<!-- Help End: Currencies --> Modified: trunk/includes/DefineContractClass.php =================================================================== --- trunk/includes/DefineContractClass.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/includes/DefineContractClass.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -11,7 +11,7 @@ var $CustomerName; var $BranchCode; var $BranchName; - var $Status; /* 0 = initiated - 1=quoted - 2=completed */ + var $Status; /* 100 = initiated - 1=quoted - 2=completed */ var $CategoryID; /* the category where the contract will be when converted to an item for quotation*/ var $OrderNo; /* the order number created when the contract is quoted */ var $CustomerRef; @@ -33,7 +33,7 @@ $this->ContractReqts = array(); $this->BOMComponentCounter=0; $this->RequirementsCounter=0; - $this->Status =100; + $this->Status = 0; } function Add_To_ContractBOM($StockID, Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/includes/MiscFunctions.php 2010-08-08 07:43:13 UTC (rev 3687) @@ -110,15 +110,15 @@ } +function ContainsIllegalCharacters ($CheckVariable) { -Function ContainsIllegalCharacters ($CheckVariable) { - if (strstr($CheckVariable,"'") OR strstr($CheckVariable,'+') OR strstr($CheckVariable,"\"") OR strstr($CheckVariable,'&') OR strstr($CheckVariable,"\\") - OR strstr($CheckVariable,'"')){ + OR strstr($CheckVariable,'"') + OR strstr($CheckVariable,' ')){ return true; } else { Modified: trunk/sql/mysql/weberp-demo.sql =================================================================== --- trunk/sql/mysql/weberp-demo.sql 2010-08-07 16:27:37 UTC (rev 3686) +++ trunk/sql/mysql/weberp-demo.sql 2010-08-08 07:43:13 UTC (rev 3687) @@ -10,7 +10,8 @@ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - +CREATE DATABASE weberpdemo; +USE weberpdemo; -- -- Table structure for table `accountgroups` -- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-09 13:35:18
|
Revision: 3688 http://web-erp.svn.sourceforge.net/web-erp/?rev=3688&view=rev Author: tim_schofield Date: 2010-08-09 13:35:12 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Paul Thursby: SelectProduct.php - Variable $msg will never print. Elimnate to use function prnMsg() instead. Modified Paths: -------------- trunk/SelectProduct.php trunk/doc/Change.log.html Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2010-08-08 07:43:13 UTC (rev 3687) +++ trunk/SelectProduct.php 2010-08-09 13:35:12 UTC (rev 3688) @@ -5,7 +5,7 @@ include ('includes/session.inc'); $title = _('Search Inventory Items'); include ('includes/header.inc'); -$msg = ''; + if (isset($_GET['StockID'])) { //The page is called with a StockID $_GET['StockID'] = trim(strtoupper($_GET['StockID'])); @@ -453,7 +453,7 @@ echo '</td></tr></table>'; } // end displaying item options if there is one and only one record echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; -echo '<b>' . $msg . '</b>'; + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Search for Inventory Items'); echo '<table class=selection><tr>'; echo '<td>' . _('In Stock Category') . ':'; @@ -502,7 +502,7 @@ $_POST['PageOffset'] = 1; } if ($_POST['Keywords'] AND $_POST['StockCode']) { - $msg = _('Stock description keywords have been used in preference to the Stock code extract entered'); + prnMsg (_('Stock description keywords have been used in preference to the Stock code extract entered'), 'info'); } if ($_POST['Keywords']) { //insert wildcard characters in spaces Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-08 07:43:13 UTC (rev 3687) +++ trunk/doc/Change.log.html 2010-08-09 13:35:12 UTC (rev 3688) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/08/10 Paul Thursby: SelectProduct.php - Variable $msg will never print. Elimnate to use function prnMsg() instead.</p> <p>08/08/10 Phil: Contracts.php SelectContracts.php DeliveryDetails.php - more work to convert Contracts to quotations and on conversion of contract quotations to orders to create contract work order to issue materials to <p>07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> <p>07/08/10 Tim: PO_Items.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-08-10 08:27:21
|
Revision: 3689 http://web-erp.svn.sourceforge.net/web-erp/?rev=3689&view=rev Author: daintree Date: 2010-08-10 08:27:14 +0000 (Tue, 10 Aug 2010) Log Message: ----------- Russ fix for narrative box on SelectOrderItems - Phil Contracts Manual Modified Paths: -------------- trunk/SelectOrderItems.php trunk/doc/Change.log.html trunk/doc/Manual/ManualContents.php Added Paths: ----------- trunk/doc/Manual/ManualContracts.html Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-08-09 13:35:12 UTC (rev 3688) +++ trunk/SelectOrderItems.php 2010-08-10 08:27:14 UTC (rev 3689) @@ -1284,7 +1284,7 @@ if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ echo $RowStarter; - echo '<td colspan=10>' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="200" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br></td></tr>'; + echo '<td colspan=10>' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="100%" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br></td></tr>'; } else { echo '<input type=hidden name="Narrative" value="">'; } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-09 13:35:12 UTC (rev 3688) +++ trunk/doc/Change.log.html 2010-08-10 08:27:14 UTC (rev 3689) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/08/10 Russell (Regal Prods): Fix SelectOrderItems.php width of narrative box was making screen unusable!! <p>07/08/10 Paul Thursby: SelectProduct.php - Variable $msg will never print. Elimnate to use function prnMsg() instead.</p> <p>08/08/10 Phil: Contracts.php SelectContracts.php DeliveryDetails.php - more work to convert Contracts to quotations and on conversion of contract quotations to orders to create contract work order to issue materials to <p>07/08/10 Tim: PDFLowGP.php - Sql quoting correction, layout changes, and assorted minor bug corrections</p> Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2010-08-09 13:35:12 UTC (rev 3688) +++ trunk/doc/Manual/ManualContents.php 2010-08-10 08:27:14 UTC (rev 3689) @@ -616,6 +616,27 @@ <?php if (!isset($_POST['Submit'])) { ?> + <input type="checkbox" name="SelectContractCosting"> + <A HREF="<?php echo $_SERVER['PHP_SELF'] . '?ViewTopic=Contracts'; ?>">Contract Costing</A> +<?php + } else { +?> + <A HREF="#Contracts">Contract Costing</A> +<?php + } +?> + <UL> + <LI>Contract Costing Overview</LI> + <LI>Creating A New Contract</LI> + <LI>Selecting A Contract</LI> + <LI>Charging Against Contracts</LI> + </UL> + <BR> + </LI> + <LI> +<?php + if (!isset($_POST['Submit'])) { +?> <input type="checkbox" name="SelectManufacturing"> <A HREF="<?php echo $_SERVER['PHP_SELF'] . '?ViewTopic=Manufacturing'; ?>">Manufacturing</A> <?php @@ -976,7 +997,9 @@ if ($_GET['ViewTopic'] == 'Shipments' OR isset($_POST['SelectShipments'])) { include('ManualShipments.html'); } - +if ($_GET['ViewTopic'] == 'Contracts' OR isset($_POST['SelectContractCosting'])) { + include('ManualContracts.html'); +} if ($_GET['ViewTopic'] == 'GeneralLedger' OR isset($_POST['SelectGeneralLedger'])) { include('ManualGeneralLedger.html'); } Added: trunk/doc/Manual/ManualContracts.html =================================================================== --- trunk/doc/Manual/ManualContracts.html (rev 0) +++ trunk/doc/Manual/ManualContracts.html 2010-08-10 08:27:14 UTC (rev 3689) @@ -0,0 +1,58 @@ +<!-- Help Begin: Contracts --> +<br><br> +<a name="Contracts"><font size="+3"><b>Contract Costing</b></font></a> +<br><br> +<font size="+1"><b>Overview</b></font> +<br><br> +The Contracts module allows for construction of costings for specific customer projects where a bill of materials to be taken from inventory for the contract can be defined, together with a costed list of other requirements. By entering a gross profit percentage figure a price can then be arrived at to charge the customer. The contract can then be converted to a quotation. While the contract is at the quotation stage it is possible to modify the stock components and other requirements - the quotation will be updated with the new costing on commital. The quotation can then be resubmitted to the customer. +<br><br> +When a contract is converted to a quotation the system actually creates a manuafactured inventory item with the name of the contract refence and with the description from the contract description. +<br><br> +When (if) the quotation is accepted by the customer, the quotation can be converted to an order in the usual way by modifying the quotation flag from quotation to order. Committing this change then changes the status of the contract to ordered so that changes are no longer allowed. This process also creates a work order so that stock required for the contract can be issued to it. By using the work order issue functionality the stock is reduced and work in progress is increased. +<br><br> +When supplier invoices (accounts payable) are entered there is the option to specify the contract that is to be charged with the cost. The cost of contract charges also goes to the work in progress account (as determined from the stock category record of the contract). Any number of contract charges can be entered against a supplier invoice (or credit note). In entering contract charges there is also the possibility of flagging whether or not the charge was orignially envisaged and costed into the contract or not. Contract charges records are created for each entry. +<br><br> +The original contract costing can be compared against the actual charges against the contract, to see how much was made on the contract. When all charges are entered against the contract it needs the status of the contract to be changed to complete. This process closes the work order and compares the original contract cost against actual costs and takes the value not charged to cost of sales to the price variances account (based on the stock category of the contract item) and clears the balance that would otherwise be left in work in progress. +<br><br> +<font size="+1"><b>Creating a New Contract</b></font> +<br><br> +From the contract tab of the main menu, select Create Contract. The first step is to select the customer for whom the contract is for. +<br><br> +The contract requires a reference up to 20 characters - without spaces, slashes or inverted commas - that will be used for the contract code. It must be unique from other contracts and also from any existing inventory item codes already in the system. A description of the contract is also required. The description can be any length and is a text field but will be truncated in the stockmaster to X characters when the contract is converted to a quotation. The description in the contract record is retained. +<br><br> +Each contract must also specify the category - the existing inventory categories are displayed to select from but new categories can be created. It is important to realise that the posting for the general ledger is performed based on the general ledger codes set up against the inventory category selected. e.g. charges against the contract will be posted to the work in progress account against this inventory category and the price variance account of this category will be used for any difference between the contract total cost and the original costing. +<br><br> +The gross profit percentage entered is the factor used based on the cost to arrive at the contract price. +<br><br> +The date that the customer requires the contract to be completed is also specified in the contract. This propogates through to the quotation and order. +<br><br> +If the contract is for a customer that is invoiced in a foriegn currency the currency exchange rate can also be specified - it is defaulted based on the current table of exchange rates at the time the contract is created. +<br><br> +There are two buttons on the contract setup page that allow the stock required for the contract to be specified and the requirments that are not stock items to be recorded. +<br><br> +Entering the bill of materials for the contract is done from a screen that shows a stock selection options - it is possible to choose by stock category or search for individual items by code or description. The list of items matching the criteria entered displays and the quantity of each item required should be entered in the box next to the item. There is no limit to how many items can be selected. Once all the items from stock have been selected there is a button that brings back the contract details (Back to Contract Header). The contract screen will now show the bill of materials as selected and the cost of each together with the quantity of each required extending to the total value of all stock items required for the contract. +<br><br> +Entering the other requirements is more straightforward as a new screen allows entry of descriptions of the other items required, the quantity of the item and the cost per unit of the items. Again, a button to go back to the contract header allows the user to switch back to the contract definition screen which will now show the other requirements listed and extended to arrive at the total cost. +<br><br> +The sum of the cost of the bill of materials together with the total cost of the other requirements is shown as the total contract cost. This cost is used together with the GP % entered to work out the total contract cost. The GP% is the % of the total contract price that is profit - so 1 minus the GP% is % of the total contract price that is the cost. The calculation is therefore - contract total cost divided by (1 - the GP%). +<br><br> +<font size="+1"><b>Selecting A Contract</b></font> +<br><br> +From the Contracts tab of the main menu, Select Contract allows contracts for a specific customer to be selected, or contracts of a specific status. Contracts can have a status of: +<ul> +<li>Setup and defining requirements</li> +<li>Quoted - item has been created and sales quotation created based on contract costs</li> +<li>Ordered - customer has accepted the quotation and the quotation has been turned into an order. This releases the work order so that stock can be issued to the contract through the work order issue system</li> +<li>Closed - the contract has been completed and finished - the contract work order is closed so no more stock can be issued to it and no more charges can be made to it. through accounts payable</li> +</ul> +The contracts meeting the criteria specified are displayed with links to perform actions depending on their status. If the contract is quoted there is a link to select the quotation for printing. If the quotation is ordered then there is a link to issue items to the contract work order. In all cases a link to open the contract definition is available. However, the option to modify the contract definition is disabled once the contract has been ordered by the customer. +<br><br> +When the contract has been ordered by the customer a link to show the actual contract cost in comparison to the originally estimated costs. +<br><br> +<font size="+1"><b>Entering Contract Costs</b></font> +<br><br> +The act of issuing stock items to the contract work order, puts the cost of those items as contract costs. Issues to contract work orders is the same as issuing stock to any other work order. See work orders/manufacturing manual. +<br><br> +Other contract costs are entered at the time of entering AP invoices or credit notes. There is an option on this screen to enter against a contract - in a similar way to entry against a shipment. It is possible to enter a supplier invoice against any number of contracts. The amount of the supplier invoice (or credit note) that is entered against contracts is posted in the general ledger to work in progress. The contract charges records are also created referring to the supplier invoice. + +<!-- Help End: Contracts --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-08-14 09:55:46
|
Revision: 3690 http://web-erp.svn.sourceforge.net/web-erp/?rev=3690&view=rev Author: daintree Date: 2010-08-14 09:55:38 +0000 (Sat, 14 Aug 2010) Log Message: ----------- New contracts work to charge purchase invocies against contracts Modified Paths: -------------- trunk/CreditStatus.php trunk/DeliveryDetails.php trunk/GLTransInquiry.php trunk/SuppShiptChgs.php trunk/SuppTransGLAnalysis.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/doc/Change.log.html trunk/doc/Manual/ManualContents.php trunk/includes/DefineSuppTransClass.php trunk/index.php trunk/sql/mysql/upgrade3.11.1-3.12.sql Removed Paths: ------------- trunk/SuppInvGLAnalysis.php Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/CreditStatus.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -66,14 +66,14 @@ if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']=='on'){ $sql = "UPDATE holdreasons SET - reasondescription='" . $_POST['ReasonDescription'] . "', - dissallowinvoices=1 - WHERE reasoncode = '".$SelectedReason."'"; + reasondescription='" . $_POST['ReasonDescription'] . "', + dissallowinvoices=1 + WHERE reasoncode = '".$SelectedReason."'"; } else { $sql = "UPDATE holdreasons SET - reasondescription='" . $_POST['ReasonDescription'] . "', - dissallowinvoices=0 - WHERE reasoncode = '".$SelectedReason."'"; + reasondescription='" . $_POST['ReasonDescription'] . "', + dissallowinvoices=0 + WHERE reasoncode = '".$SelectedReason."'"; } $msg = _('The credit status record has been updated'); @@ -193,7 +193,7 @@ if (!isset($_GET['delete'])) { - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; if (isset($SelectedReason) and ($InputError!=1)) { //editing an existing status code @@ -232,17 +232,17 @@ $_POST['ReasonDescription'] = ''; } echo '<tr> - <td>'. _('Description') .":</td> - <td><input " . (in_array('ReasonDescription',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=2 type='text' name='ReasonDescription' VALUE='". $_POST['ReasonDescription'] ."' size=28 maxlength=30> - </td></tr> - <tr><td>". _('Disallow Invoices') . "</td>"; + <td>'. _('Description') .':</td> + <td><input ' . (in_array('ReasonDescription',$Errors) ? 'class="inputerror"' : '' ) . + ' tabindex=2 type="text" name="ReasonDescription" VALUE="'. $_POST['ReasonDescription'] .'" size="28" maxlength="30"> + </td></tr> + <tr><td>'. _('Disallow Invoices') . '</td>'; if (isset($_POST['DisallowInvoices']) and $_POST['DisallowInvoices']==1) { - echo "<td><input tabindex=3 type='checkbox' checked name='DisallowInvoices'></td></tr>"; + echo '<td><input tabindex=3 type="checkbox" checked name="DisallowInvoices"></td></tr>'; } else { - echo "<td><input tabindex=3 type='checkbox' name='DisallowInvoices'></td></tr>"; + echo '<td><input tabindex=3 type="checkbox" name="DisallowInvoices"></td></tr>'; } - echo "</table><br><div class='centre'><input tabindex=4 type='Submit' name='submit' value='" . _('Enter Information') . "'></div></form>"; + echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/DeliveryDetails.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -620,35 +620,35 @@ WHERE orderno='" .$_SESSION['ExistingOrder'] . "'", $db,$ErrMsg,$DbgMsg,true); $ErrMsg = _('Could not insert the contract bill of materials'); $InsContractBOM = DB_query("INSERT INTO bom (parent, - component, - workcentreadded, - location, - effectiveafter, - effectiveto) - SELECT contractref, - stockid, - workcentreadded, - '" . $_SESSION['Items'.$identifier]->Location ."', - '" . Date('Y-m-d') . "', - '2037-12-31' - FROM contractbom - WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); + component, + workcentreadded, + loccode, + effectiveafter, + effectiveto) + SELECT contractref, + stockid, + workcentreadded, + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . Date('Y-m-d') . "', + '2037-12-31' + FROM contractbom + WHERE contractref='" . $ContractRow['contractref'] . "'",$db,$ErrMsg,$DbgMsg); $ErrMsg = _('Unable to insert a new work order for the sales order item'); $InsWOResult = DB_query("INSERT INTO workorders (wo, - loccode, - requiredby, - startdate) - VALUES ('" . $WONo . "', - '" . $_SESSION['Items'.$identifier]->Location ."', - '" . $ContractRow['requireddate'] . "', - '" . Date('Y-m-d'). "')", - $db,$ErrMsg,$DbgMsg); + loccode, + requiredby, + startdate) + VALUES ('" . $WONo . "', + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . $ContractRow['requireddate'] . "', + '" . Date('Y-m-d'). "')", + $db,$ErrMsg,$DbgMsg); //Need to get the latest BOM to roll up cost but also add the contract other requirements - $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost - FROM stockmaster INNER JOIN contractbom - ON stockmaster.stockid=contractbom.stockid - WHERE contractbom.contractref='" . $ContractRow['contractref'] . "'", + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*contractbom.quantity) AS cost + FROM stockmaster INNER JOIN contractbom + ON stockmaster.stockid=contractbom.stockid + WHERE contractbom.contractref='" . $ContractRow['contractref'] . "'", $db); $CostRow = DB_fetch_row($CostResult); if (is_null($CostRow[0]) OR $CostRow[0]==0){ Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/GLTransInquiry.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -52,22 +52,22 @@ </tr>'; $SQL = "SELECT gltrans.type, - gltrans.trandate, - gltrans.periodno, - gltrans.account, - gltrans.narrative, - gltrans.amount, - gltrans.posted, - chartmaster.accountname, - periods.lastdate_in_period - FROM gltrans, - chartmaster, - periods - WHERE gltrans.account = chartmaster.accountcode - AND periods.periodno=gltrans.periodno - AND gltrans.type= '" . $_GET['TypeID'] . "' - AND gltrans.typeno = '" . $_GET['TransNo'] . "' - ORDER BY gltrans.counterindex"; + gltrans.trandate, + gltrans.periodno, + gltrans.account, + gltrans.narrative, + gltrans.amount, + gltrans.posted, + chartmaster.accountname, + periods.lastdate_in_period + FROM gltrans, + chartmaster, + periods + WHERE gltrans.account = chartmaster.accountcode + AND periods.periodno=gltrans.periodno + AND gltrans.type= '" . $_GET['TypeID'] . "' + AND gltrans.typeno = '" . $_GET['TransNo'] . "' + ORDER BY gltrans.counterindex"; $TransResult = DB_query($SQL,$db); $Posted = _('Yes'); @@ -135,23 +135,33 @@ $j++; } echo '<td>' . $TranDate . '</td> - <td class=number>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> - <td><a href="' . $URL . '">' . $TransRow['accountname'] . '</a></td> - <td class=number>' . $DebitAmount . '</td> - <td class=number>' . $CreditAmount . '</td> - <td>' . $TransRow['narrative'] . '</td> - <td>' . $Posted . '</td> - </tr>'; + <td>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> + <td><a href="' . $URL . '">' . $TransRow['accountname'] . '</a></td> + <td class=number>' . $DebitAmount . '</td> + <td class=number>' . $CreditAmount . '</td> + <td>' . $TransRow['narrative'] . '</td> + <td>' . $Posted . '</td> + </tr>'; } if ($DetailResult) { while ( $DetailRow = DB_fetch_row($DetailResult) ) { if ( $TransRow['amount'] > 0){ - $Debit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); - $Credit = ' '; + if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { + $Debit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Credit = ' '; + } else { + $Debit = number_format((-$DetailRow[1] - $DetailRow[2]) / $DetailRow[3],2); + $Credit = ' '; + } } else { - $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); - $Debit = ' '; + if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { + $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Debit = ' '; + } else { + $Credit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Debit = ' '; + } } if ($j==1) { @@ -162,13 +172,13 @@ $j++; } echo '<td>' . $TranDate . '</td> - <td class=number>' . $TransRow['periodno'] . '</td> - <td><a href="' . $URL . $DetailRow[0] . $date . '">' . $TransRow['accountname'] . ' - ' . $DetailRow[4] . '</a></td> - <td class=number>' . $Debit . '</td> - <td class=number>' . $Credit . '</td> - <td>' . $TransRow['narrative'] . '</td> - <td>' . $Posted . '</td> - </tr>'; + <td>' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '</td> + <td><a href="' . $URL . $DetailRow[0] . $date . '">' . $TransRow['accountname'] . ' - ' . $DetailRow[4] . '</a></td> + <td class=number>' . $Debit . '</td> + <td class=number>' . $Credit . '</td> + <td>' . $TransRow['narrative'] . '</td> + <td>' . $Posted . '</td> + </tr>'; } DB_free_result($DetailResult); } Deleted: trunk/SuppInvGLAnalysis.php =================================================================== --- trunk/SuppInvGLAnalysis.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/SuppInvGLAnalysis.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -1,90 +0,0 @@ -<?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 */ -$PageSecurity=5; -include('includes/DefineSuppTransClass.php'); -/* Session started in header.inc for password checking and authorisation level check */ -include('includes/session.inc'); - -$title = _('Supplier Invoice General Ledger Analysis'); - -include('includes/header.inc'); - - -if (!isset($_SESSION['SuppInv'])){ - prnMsg( _('To enter a supplier invoice the supplier must first be selected from the supplier selection screen') . ', ' . _('then the link to enter a supplier invoice must be clicked on'),'info'); - echo '<br><a href="' . $rootpath . '/SelectSupplier.php?' . SID . '">' . _('Select A Supplier to Enter an Invoice For') . '</a>'; - include('includes/footer.inc'); - exit; - /*It all stops here if there aint no supplier selected and invoice initiated ie $_SESSION['SuppInv'] started off*/ -} - -/*If the user hit the Add to Invoice button then process this first before showing all GL codes on the invoice otherwise it wouldnt show the latest addition*/ - -if (isset($_POST['AddGLCodeToInvoice']) ){ - - $InputError=False; - - if ($InputError==False){ - $_SESSION['SuppInv']->Add_GLCodes_To_Trans($GLCode, - $Amount, - $ShiptRef, - $JobRef, - $Narrative); - } -} - -if (isset($_GET['Delete'])){ - - $_SESSION['SuppInv']->Remove_GLCodes_From_Trans($_GET['Delete']); - -} - - -/*Show all the selected GLCodes so far from the SESSION['SuppInv']->GLCodes array */ -echo '<div class="centre"><font size=4 color=blue>' . _('General Ledger Analysis of Invoice From') . ' ' . $_SESSION['SuppInv']->SupplierName.'</div>'; -echo '<table cellpadding=2><tr><th>' . _('Account') . '</th> - <th>' . _('Name') . '</th> - <th>' . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppInv']->CurrCode . '</th> - <th>' . _('Shipment') . '</th> - <th>' . _('Job') . '</th> - <th>' . _('Narrative') . '</th></tr>'; - -$TotalGLValue=0; - -foreach ($_SESSION['SuppInv']->GLCodes as $EnteredGLCode){ - - echo '<tr><td>' . $EnteredGLCode->GLCode . '</td> - <td>' . $EnteredGLCode->GLActName . '</td> - <td class=number>' . number_format($EnteredGLCode->Amount,2) . '</td> - <td>' . $EnteredGLCode->ShiptRef . '</td> - <td>' .$EnteredGLCode->JobRef . '</td> - <td>' . $EnteredGLCode->Narrative . '</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $EnteredGLCode->Counter . '">' . _('Delete') . '</a></td></tr>'; - - $TotalGLValue = $TotalGLValue + ($EnteredGLCode->ChgPrice * $EnteredGLCode->This_QuantityInv); - - $i++; - if ($i>15){ - $i=0; - echo '<tr><td bgcolor=#800000><font color=#ffffff><b>' . _('Account') . '</b></td> - <td bgcolor=#800000><font color=#ffffff><b>' . _('Name') . '</b></td> - <td bgcolor=#800000><font color=#ffffff><b>' . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppInv']->CurrCode . '</b></td> - <td bgcolor=#800000><font color=#ffffff><b>' . _('Shipment') . '</b></td> - <td bgcolor=#800000><font color=#ffffff><b>' . _('Job') . '</b></td> - <td bgcolor=#800000><font color=#ffffff><b>' . _('Narrative') . '</b></td></tr>'; - } -} - -echo '<tr><td colspan=2 class=number><font size=4 color=BLUE>' . _('Total') . ':</font></td> - <td class=number><font size=4 color=BLUE><U>' . number_format($TotalGLValue,2) . '</U></font></td></tr>'; -echo '</table><br><a href="' . $rootpath . '/SupplierInvoice.php?' . SID . '">' . _('Back to Invoice Entry') . '</a><hr>'; - -/*Set up a form to allow input of new GL entries */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; - -echo '</form>'; -include('includes/footer.inc'); -?> Modified: trunk/SuppShiptChgs.php =================================================================== --- trunk/SuppShiptChgs.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/SuppShiptChgs.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -58,16 +58,15 @@ /*Show all the selected ShiptRefs so far from the SESSION['SuppInv']->Shipts array */ if ($_SESSION['SuppTrans']->InvoiceOrCredit=='Invoice'){ - echo '<div class="centre"><font size=4 color=BLUE>' . _('Shipment charges on Invoice') . ' '; + echo '<div class="centre"><p class="page_title_text">'. _('Shipment charges on Invoice') . ' '; } else { - echo '<div class="centre"><font size=4 color=BLUE>' . _('Shipment credits on Credit Note') . ' '; + echo '<div class="centre"><p class="page_title_text">' . _('Shipment credits on Credit Note') . ' '; } -echo '</div>'; echo $_SESSION['SuppTrans']->SuppReference . ' ' ._('From') . ' ' . $_SESSION['SuppTrans']->SupplierName; - -echo "<table cellpadding=2>"; -$TableHeader = "<tr><th>" . _('Shipment') . "</th> - <th>" . _('Amount') . '</th></tr>'; +echo '</div>'; +echo '<table cellpadding=2>'; +$TableHeader = '<tr><th>' . _('Shipment') . '</th> + <th>' . _('Amount') . '</th></tr>'; echo $TableHeader; $TotalShiptValue = 0; @@ -75,8 +74,8 @@ foreach ($_SESSION['SuppTrans']->Shipts as $EnteredShiptRef){ echo '<tr><td>' . $EnteredShiptRef->ShiptRef . '</td> - <td class=number>' . number_format($EnteredShiptRef->Amount,2) . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "&Delete=" . $EnteredShiptRef->Counter . "'>" . _('Delete') . '</a></td></tr>'; + <td class=number>' . number_format($EnteredShiptRef->Amount,2) . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $EnteredShiptRef->Counter . '">' . _('Delete') . '</a></td></tr>'; $TotalShiptValue = $TotalShiptValue + $EnteredShiptRef->Amount; @@ -89,29 +88,29 @@ </table>'; if ($_SESSION['SuppTrans']->InvoiceOrCredit == 'Invoice'){ - echo "<br><a href='$rootpath/SupplierInvoice.php?" . SID . "'>" . _('Back to Invoice Entry') . '</a><hr>'; + echo '<br><a href="' . $rootpath . '/SupplierInvoice.php?' . SID . '">' . _('Back to Invoice Entry') . '</a><hr>'; } else { - echo "<br><a href='$rootpath/SupplierCredit.php?" . SID . "'>" . _('Back to Credit Note Entry') . '</a><hr>'; + echo '<br><a href="' . $rootpath . '/SupplierCredit.php?' . SID . '">' . _('Back to Credit Note Entry') . '</a><hr>'; } /*Set up a form to allow input of new Shipment charges */ -echo "<form action='" . $_SERVER['PHP_SELF'] . "?" . SID . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="post">'; if (!isset($_POST['ShiptRef'])) { $_POST['ShiptRef']=''; } echo '<table>'; -echo '<tr><td>' . _('Shipment Reference') . ":</td> - <td><input type='Text' name='ShiptRef' size=12 maxlength=11 VALUE=" . $_POST['ShiptRef'] . '></td></tr>'; -echo '<tr><td>' . _('Shipment Selection') . ':<br><font size=1>' . _('If you know the code enter it above') . '<br>' . _('otherwise select the shipment from the list') . "</font></td><td><select name='ShiptSelection'>"; +echo '<tr><td>' . _('Shipment Reference') . ':</td> + <td><input type="text" name="ShiptRef" size="12" maxlength="11" VALUE="' . $_POST['ShiptRef'] . '"></td></tr>'; +echo '<tr><td>' . _('Shipment Selection') . ':<br> ' . _('If you know the code enter it above') . '<br>' . _('otherwise select the shipment from the list') . '</td><td><select name="ShiptSelection">'; -$sql = "SELECT shiptref, - vessel, - eta, - suppname - FROM shipments INNER JOIN suppliers - ON shipments.supplierid=suppliers.supplierid - WHERE closed=0"; +$sql = 'SELECT shiptref, + vessel, + eta, + suppname + FROM shipments INNER JOIN suppliers + ON shipments.supplierid=suppliers.supplierid + WHERE closed=0'; $result = DB_query($sql, $db); @@ -121,7 +120,7 @@ } else { echo '<option VALUE='; } - echo $myrow['shiptref'] . '>' . $myrow['shiptref'] . ' - ' . $myrow['vessel'] . ' ' . _('ETA') . ' ' . ConvertSQLDate($myrow['eta']) . ' ' . _('from') . ' ' . $myrow['suppname']; + echo $myrow['shiptref'] . '>' . $myrow['shiptref'] . ' - ' . $myrow['vessel'] . ' ' . _('ETA') . ' ' . ConvertSQLDate($myrow['eta']) . ' ' . _('from') . ' ' . $myrow['suppname'] . '</option>'; } echo '</select></td></tr>'; @@ -129,12 +128,12 @@ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; } -echo '<tr><td>' . _('Amount') . ":</td> - <td><input type='Text' name='Amount' size=12 maxlength=11 VALUE=" . $_POST['Amount'] . '></td></tr>'; +echo '<tr><td>' . _('Amount') . ':</td> + <td><input type="text" name="Amount" size="12" maxlength="11" VALUE="' . $_POST['Amount'] . '"></td></tr>'; echo '</table>'; -echo "<input type='Submit' name='AddShiptChgToInvoice' VALUE='" . _('Enter Shipment Charge') . "'>"; +echo '<input type="submit" name="AddShiptChgToInvoice" VALUE="' . _('Enter Shipment Charge') . '">'; echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SuppTransGLAnalysis.php =================================================================== --- trunk/SuppTransGLAnalysis.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/SuppTransGLAnalysis.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -86,13 +86,12 @@ } echo '</p><table cellpadding=2>'; -$TableHeader = "<tr> - <th>" . _('Account') . "</th> - <th>" . _('Name') . "</th> - <th>" . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . "</th> - <th>" . _('Job') . "</th> - <th>" . _('Narrative') . '</th> - </tr>'; +$TableHeader = '<tr> + <th>' . _('Account') . '</th> + <th>' . _('Name') . '</th> + <th>' . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> + <th>' . _('Narrative') . '</th> + </tr>'; echo $TableHeader; $TotalGLValue=0; @@ -102,12 +101,11 @@ <td>' . $EnteredGLCode->GLCode . '</td> <td>' . $EnteredGLCode->GLActName . '</td> <td class=number>' . number_format($EnteredGLCode->Amount,2) . '</td> - <td>' .$EnteredGLCode->JobRef . '</td> <td>' . $EnteredGLCode->Narrative . "</td> <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "Delete=" . $EnteredGLCode->Counter . "'>" . _('Delete') . '</a></td> </tr>'; - $TotalGLValue = $TotalGLValue + $EnteredGLCode->Amount; + $TotalGLValue += $EnteredGLCode->Amount; $i++; if ($i>15){ @@ -124,27 +122,27 @@ if ($_SESSION['SuppTrans']->InvoiceOrCredit == 'Invoice'){ - echo "<br><a href='$rootpath/SupplierInvoice.php?" . SID . "'>" . _('Back to Invoice Entry') . '</a><hr>'; + echo '<br><a href="' . $rootpath . '/SupplierInvoice.php?' . SID . '">' . _('Back to Invoice Entry') . '</a><hr>'; } else { - echo "<br><a href='$rootpath/SupplierCredit.php?" . SID . "'>" . _('Back to Credit Note Entry') . '</a><hr>'; + echo '<br><a href="' . $rootpath . '/SupplierCredit.php?' . SID . '">' . _('Back to Credit Note Entry') . '</a><hr>'; } /*Set up a form to allow input of new GL entries */ -echo "<form action='" . $_SERVER['PHP_SELF'] . "?" . SID . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="post">'; echo '<table>'; if (!isset($_POST['GLCode'])) { $_POST['GLCode']=''; } echo '<tr> - <td>' . _('Account Code') . ":</td> - <td><input type='Text' name='GLCode' size=12 maxlength=11 VALUE=" . $_POST['GLCode'] . '></td> + <td>' . _('Account Code') . ':</td> + <td><input type="text" name="GLCode" size=12 maxlength=11 VALUE="' . $_POST['GLCode'] . '"></td> </tr>'; echo '<tr> - <td>' . _('Account Selection') . ':<br><font size=1>' . _('If you know the code enter it above') . '<br>' . _('otherwise select the account from the list') . "</font></td> - <td><select name='AcctSelection'>"; + <td>' . _('Account Selection') . ':<br>(' . _('If you know the code enter it above') . '<br>' . _('otherwise select the account from the list') . ')</td> + <td><select name="AcctSelection">'; -$sql = "SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode"; +$sql = 'SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode'; $result = DB_query($sql, $db); @@ -165,32 +163,21 @@ $_POST['Amount']=0; } echo '<tr> - <td>' . _('Amount') . ":</td> - <td><input type='Text' class='number' name='Amount' size=12 maxlength=11 VALUE=" . $_POST['Amount'] . '></td> + <td>' . _('Amount') . ':</td> + <td><input type="text" class="number" name="Amount" size="12" maxlength="11" VALUE="' . $_POST['Amount'] . '"></td> </tr>'; - if (!isset($_POST['JobRef'])) { - $_POST['JobRef']=''; - } -echo '<tr> - <td>' . _('Contract Ref') . ":</td> - <td><input type='Text' name='JobRef' size=21 maxlength=20 VALUE=" . $_POST['JobRef'] . ">"; - /* Once the contract stuff is written then it would be appropriate to have: - <a TARGET='_blank' href='$rootpath/ContractsList.php?" . SID . "'>" . _('View Open Contracts/Jobs') . '</a> */ - -echo ' </td> - </tr>'; - if (!isset($_POST['Narrative'])) { - $_POST['Narrative']=''; - } +if (!isset($_POST['Narrative'])) { + $_POST['Narrative']=''; +} echo '<tr> - <td>' . _('Narrative') . ":</td> - <td><TEXTAREA name='Narrative' COLS=40 ROWS=2>" . $_POST['Narrative'] . '</TEXTAREa></td> + <td>' . _('Narrative') . ':</td> + <td><TEXTAREA name="Narrative" cols=40 rows=2>' . $_POST['Narrative'] . '</textarea></td> </tr> </table>'; -echo "<input type='Submit' name='AddGLCodeToTrans' VALUE='" . _('Enter GL Line') . "'>"; +echo '<input type="submit" name="AddGLCodeToTrans" VALUE="' . _('Enter GL Line') . '">'; echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/SupplierCredit.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -68,23 +68,23 @@ /*Now retrieve supplier information - name, currency, default ex rate, terms, tax rate etc */ $sql = "SELECT suppliers.suppname, - suppliers.supplierid, - paymentterms.terms, - paymentterms.daysbeforedue, - paymentterms.dayinfollowingmonth, - suppliers.currcode, - currencies.rate AS exrate, - suppliers.taxgroupid, - taxgroups.taxgroupdescription - FROM suppliers, - taxgroups, - currencies, - paymentterms, - taxauthorities - WHERE suppliers.taxgroupid=taxgroups.taxgroupid - AND suppliers.currcode=currencies.currabrev - AND suppliers.paymentterms=paymentterms.termsindicator - AND suppliers.supplierid = '" . $_GET['SupplierID'] . "'"; + suppliers.supplierid, + paymentterms.terms, + paymentterms.daysbeforedue, + paymentterms.dayinfollowingmonth, + suppliers.currcode, + currencies.rate AS exrate, + suppliers.taxgroupid, + taxgroups.taxgroupdescription + FROM suppliers, + taxgroups, + currencies, + paymentterms, + taxauthorities + WHERE suppliers.taxgroupid=taxgroups.taxgroupid + AND suppliers.currcode=currencies.currabrev + AND suppliers.paymentterms=paymentterms.termsindicator + AND suppliers.supplierid = '" . $_GET['SupplierID'] . "'"; $ErrMsg = _('The supplier record selected') . ': ' . $_GET['SupplierID'] . ' ' ._('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); @@ -110,8 +110,8 @@ $_SESSION['SuppTrans']->SupplierID = $_GET['SupplierID']; $LocalTaxProvinceResult = DB_query("SELECT taxprovinceid - FROM locations - WHERE loccode = '" . $_SESSION['UserStockLocation'] . "'", $db); + FROM locations + WHERE loccode = '" . $_SESSION['UserStockLocation'] . "'", $db); if(DB_num_rows($LocalTaxProvinceResult)==0){ prnMsg(_('The tax province associated with your user account has not been set up in this database. Tax calculations are based on the tax group of the supplier and the tax province of the user entering the invoice. The system administrator should redefine your account with a valid default stocking location and this location should refer to a valid tax province'),'error'); @@ -134,7 +134,7 @@ } elseif (!isset($_SESSION['SuppTrans'])){ prnMsg(_('To enter a supplier credit note the supplier must first be selected from the supplier selection screen'),'warn'); - echo "<br><a href='$rootpath/SelectSupplier.php?" . SID ."'>" . _('Select A Supplier to Enter an Credit Note For') . '</a>'; + echo '<br><a href="' . $rootpath . '/SelectSupplier.php?' . SID .'">' . _('Select A Supplier to Enter an Credit Note For') . '</a>'; include('includes/footer.inc'); exit; @@ -173,12 +173,17 @@ } if (count($_SESSION['SuppTrans']->GLCodes) > 0){ foreach ( $_SESSION['SuppTrans']->GLCodes as $GLLine){ - $_SESSION['SuppTrans']->OvAmount = $_SESSION['SuppTrans']->OvAmount + $GLLine->Amount; + $_SESSION['SuppTrans']->OvAmount += $GLLine->Amount; } } + if (count($_SESSION['SuppTrans']->Contracts) > 0){ + foreach ( $_SESSION['SuppTrans']->Contracts as $Contract){ + $_SESSION['SuppTrans']->OvAmount += $Contract->Amount; + } + } if (count($_SESSION['SuppTrans']->Shipts) > 0){ foreach ( $_SESSION['SuppTrans']->Shipts as $ShiptLine){ - $_SESSION['SuppTrans']->OvAmount = $_SESSION['SuppTrans']->OvAmount + $ShiptLine->Amount; + $_SESSION['SuppTrans']->OvAmount += $ShiptLine->Amount; } } /*OvAmount must be entered manually */ @@ -194,10 +199,10 @@ /*This ensures that any changes in the page are stored in the session before calling the grn page */ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . "/SuppCreditGRNs.php?" . SID . "'>"; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SuppCreditGRNs.php?' . SID . '">'; echo '<p>' . _('You should automatically be forwarded to the entry of credit notes against goods received page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='" . $rootpath . "/SuppCreditGRNs.php?" . SID . "'>" . + '<a href="' . $rootpath . '/SuppCreditGRNs.php?' . SID . '">' . _('click here') . '</a> ' . _('to continue') . '.<br>'; include('includes/footer.inc'); exit; @@ -206,10 +211,10 @@ /*This ensures that any changes in the page are stored in the session before calling the shipments page */ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . "/SuppShiptChgs.php?" . SID . "'>"; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SuppShiptChgs.php?' . SID . '">'; echo '<p>' . _('You should automatically be forwarded to the entry of credit notes against shipments page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='" . $rootpath . "/SuppShiptChgs.php?" . SID . "'>" . + '<a href="' . $rootpath . '/SuppShiptChgs.php?' . SID . '">' . _('click here') . '</a> ' . _('to continue') . '.<br>'; include('includes/footer.inc'); exit; @@ -218,14 +223,22 @@ /*This ensures that any changes in the page are stored in the session before calling the shipments page */ - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . "/SuppTransGLAnalysis.php?" . SID . "'>"; + echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SuppTransGLAnalysis.php?' . SID . '">'; echo '<p>' . _('You should automatically be forwarded to the entry of credit notes against the general ledger page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='" . $rootpath . "/SuppTransGLAnalysis.php?" . SID . "'>" . + '<a href="' . $rootpath . '/SuppTransGLAnalysis.php?' . SID . '">' . _('click here') . '</a> ' . _('to continue') . '.<br>'; include('includes/footer.inc'); exit; } +if (isset($_POST['Contracts']) and $_POST['Contracts'] == _('Enter Against Contracts')){ + /*This ensures that any changes in the page are stored in the session before calling the shipments page */ + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/SuppContractChgs.php?' . SID . '">'; + echo '<DIV class="centre">' . _('You should automatically be forwarded to the entry of invoices against contracts page') . + '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh'). ') ' . + '<a href="' . $rootpath . '/SuppContractChgs.php?' . SID . '">' . _('click here') . '</a> ' . _('to continue') . '.</DIV><br>'; + exit; + } /* everything below here only do if a Supplier is selected fisrt add a header to show who we are making an credit note for */ @@ -257,14 +270,17 @@ <td><input type=TEXT class='number' size=11 maxlength=10 name='ExRate' VALUE=" . $_SESSION['SuppTrans']->ExRate . '></td></tr>'; echo '</table>'; -echo "<br><div class='centre'><input type=submit name='GRNS' VALUE='" . _('Enter Credit Against Goods Recd') . "'> "; -echo "<input type=submit name='Shipts' VALUE='" . _('Enter Credit Against Shipment') . "'> "; +echo '<br><div class="centre"><input type="submit" name="GRNS" VALUE="' . _('Enter Credit Against Goods Recd') . '"> '; +echo '<input type="submit" name="Shipts" value="' . _('Enter Credit Against Shipment') . '"> '; +echo '<input type="submit" name="Contracts" VALUE="' . _('Enter Against Contracts') . '"> '; if ( $_SESSION['SuppTrans']->GLLink_Creditors ==1){ - echo "<input type=submit name='GL' VALUE='" . _('Enter General Ledger Analysis') . "'></div>"; + echo '<input type="submit" name="GL" value="' . _('Enter General Ledger Analysis') . '"></div>'; } else { echo '</div>'; } + + if (count($_SESSION['SuppTrans']->GRNs)>0){ /*if there are some GRNs selected for crediting then */ /*Show all the selected GRNs so far from the SESSION['SuppInv']->GRNs array @@ -312,10 +328,12 @@ foreach ($_SESSION['SuppTrans']->Shipts as $EnteredShiptRef){ - echo '<tr><td>' . $EnteredShiptRef->ShiptRef . '</td><td class=number>' . - number_format($EnteredShiptRef->Amount,2) . '</td></tr>'; + echo '<tr> + <td>' . $EnteredShiptRef->ShiptRef . '</td> + <td class=number>' . number_format($EnteredShiptRef->Amount,2) . '</td> + </tr>'; - $TotalShiptValue = $TotalShiptValue + $EnteredShiptRef->Amount; + $TotalShiptValue += $EnteredShiptRef->Amount; } @@ -323,16 +341,47 @@ <td class=number><font size=4 color=red><U>' . number_format($TotalShiptValue,2) . '</U></font></td></tr>'; } +if (count( $_SESSION['SuppTrans']->Contracts) > 0){ /*if there are any contract charges on the invoice*/ + + echo '<table cellpadding="2">'; + $TableHeader = '<tr><th>' . _('Contract') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Narrative') . '</th></tr>'; + echo $TableHeader; + + $TotalContractsValue = 0; + $i=0; + foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ + + echo '<tr><td>' . $Contract->ContractRef . '</td> + <td class=number>' . number_format($Contract->Amount,2) . '</td> + <td>' . $Contract->Narrative . '</td> + </tr>'; + + $TotalContractsValue += $Contract->Amount; + + $i++; + if ($i == 15){ + $i = 0; + echo $TableHeader; + } + } + + echo '<tr><td class="number">' . _('Total') . ':</font></td> + <td class="number">' . number_format($TotalContractsValue,2) . '</td> + </tr></table>'; +} + + if ($_SESSION['SuppTrans']->GLLink_Creditors ==1){ if (count($_SESSION['SuppTrans']->GLCodes)>0){ echo '<table cellpadding=2>'; - $TableHeader = "<tr><th>" . _('Account') . "</th> - <th>" . _('Name') . "</th> - <th>" . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . "</th> - <th>" . _('Shipment') . "</th> - <th>" . _('Job') . "</th> - <th>" . _('Narrative') . '</th></tr>'; + $TableHeader = '<tr><th>' . _('Account') . '</th> + <th>' . _('Name') . '</th> + <th>' . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> + <th>' . _('Shipment') . '</th> + <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; $TotalGLValue=0; @@ -343,7 +392,6 @@ <td>' . $EnteredGLCode->GLActName . '</td> <td class=number>' . number_format($EnteredGLCode->Amount,2) . '</td> <td>' . $EnteredGLCode->ShiptRef . '</td> - <td>' . $EnteredGLCode->JobRef . '</td> <td>' . $EnteredGLCode->Narrative . '</td></tr>'; $TotalGLValue = $TotalGLValue + $EnteredGLCode->Amount; @@ -369,14 +417,18 @@ if (!isset($TotalShiptValue)) { $TotalShiptValue=0; } - - $_SESSION['SuppTrans']->OvAmount = round($TotalGRNValue + $TotalGLValue + $TotalShiptValue,2); + if (!isset($TotalContractsValue)){ + $TotalContractsValue = 0; + } + + $_SESSION['SuppTrans']->OvAmount = round($TotalGRNValue + $TotalGLValue + $TotalShiptValue + $TotalContractsValue,2); + echo '<table><tr><td><font color=red>' . _('Credit Amount in Supplier Currency') . ':</font></td> <td colspan=2 class=number>' . number_format($_SESSION['SuppTrans']->OvAmount,2) . '</td></tr>'; } else { - echo '<table><tr><td><font color=red>' . _("Credit Amount in Supplier Currency") . + echo '<table><tr><td><font color=red>' . _('Credit Amount in Supplier Currency') . ':</font></td> - <td colspan=2 class=number><input type=TEXT size=12 maxlength=10 name=OvAmount VALUE=' . number_format($_SESSION['SuppTrans']->OvAmount,2) . '></td></tr>'; + <td colspan=2 class=number><input type=TEXT size="12" maxlength="10" name="OvAmount" VALUE=' . number_format($_SESSION['SuppTrans']->OvAmount,2) . '></td></tr>'; } echo "<tr><td colspan=2><input type=Submit name='ToggleTaxMethod'VALUE='" . _('Change Tax Calculation Method') . @@ -456,7 +508,6 @@ foreach ($_SESSION['SuppTrans']->Taxes as $Tax) { - /*Set the tax rate to what was entered */ if (isset($_POST['TaxRate' . $Tax->TaxCalculationOrder])){ $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate = $_POST['TaxRate' . $Tax->TaxCalculationOrder]/100; @@ -517,13 +568,8 @@ /*Start an SQL transaction */ - $SQL = 'BEGIN'; + DB_Txn_Begin($db); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The database does not support transactions'); - $DbgMsg = _('The following SQL to start an SQL transaction was used'); - - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg); - /*Get the next transaction number for internal purposes and the period to post GL transactions in based on the credit note date*/ $CreditNoteNo = GetNextTransNo(21, $db); @@ -619,7 +665,44 @@ $LocalTotal += round($ShiptChg->Amount/$_SESSION['SuppTrans']->ExRate,2); } + + foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ + /*contract postings need to get the WIP from the contract item's stock category record + * debit postings to this WIP account + * the WIP account is tidied up when the contract is closed*/ + $result = DB_query("SELECT wipact FROM stockcategory + INNER JOIN stockmaster ON + stockcategory.categoryid=stockmaster.categoryid + WHERE stockmaster.stockid='" . $Contract->ContractRef . "'",$db); + $WIPRow = DB_fetch_row($result); + $WIPAccount = $WIPRow[0]; + + $SQL = 'INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (21, ' . + $CreditNoteNo . ", + '" . SQLCreditNoteDate. "', + '" . $PeriodNo . "', + '". $WIPAccount . "', + '" . $_SESSION['SuppTrans']->SupplierID . ' ' . _('Contract charge against') . ' ' . $Contract->ContractRef . "', + '" . (-$Contract->Amount/ $_SESSION['SuppTrans']->ExRate) . "')"; + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the contract') . ' ' . $Contract->ContractRef . ' ' . _('could not be added because'); + + $DbgMsg = _('The following SQL to insert the GL transaction was used'); + + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); + + $LocalTotal += ($Contract->Amount/ $_SESSION['SuppTrans']->ExRate); + + } + foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ if (strlen($EnteredGRN->ShiptRef)==0 OR $EnteredGRN->ShiptRef=="" OR $EnteredGRN->ShiptRef==0){ /*so its not a shipment item */ @@ -852,31 +935,31 @@ foreach ($_SESSION['SuppTrans']->Taxes as $Tax){ /* Now the TAX account */ + if ($Tax->TaxOvAmount/ $_SESSION['SuppTrans']->ExRate !=0){ + $SQL = 'INSERT INTO gltrans (type, + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (21, ' . + $CreditNoteNo . ", + '" . $SQLCreditNoteDate . "', + " . $PeriodNo . ', + ' . $Tax->TaxGLCode . ", + '" . $_SESSION['SuppTrans']->SupplierID . ' - ' . _('Credit note') . ' ' . + $_SESSION['SuppTrans']->SuppReference . ' ' . $_SESSION['SuppTrans']->CurrCode . + $Tax->TaxOvAmount . ' @ ' . _('a rate of') . ' ' . $_SESSION['SuppTrans']->ExRate . + "', + " . round(-$Tax->TaxOvAmount/ $_SESSION['SuppTrans']->ExRate,2) . ')'; - $SQL = 'INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (21, ' . - $CreditNoteNo . ", - '" . $SQLCreditNoteDate . "', - " . $PeriodNo . ', - ' . $Tax->TaxGLCode . ", - '" . $_SESSION['SuppTrans']->SupplierID . ' - ' . _('Credit note') . ' ' . - $_SESSION['SuppTrans']->SuppReference . ' ' . $_SESSION['SuppTrans']->CurrCode . - $Tax->TaxOvAmount . ' @ ' . _('a rate of') . ' ' . $_SESSION['SuppTrans']->ExRate . - "', - " . round(-$Tax->TaxOvAmount/ $_SESSION['SuppTrans']->ExRate,2) . ')'; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the tax could not be added because'); - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the tax could not be added because'); - - $DbgMsg = _('The following SQL to insert the GL transaction was used'); - - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - + $DbgMsg = _('The following SQL to insert the GL transaction was used'); + + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); + }/* if the tax is not 0 */ } /*end of loop to post the tax */ /* Now the control account */ @@ -1011,12 +1094,35 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); } - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The COMMIT SQL command failed'); - $DbgMsg = _('The COMMIT SQL failed'); + /*Add contract charges records as necessary */ - $SQL='COMMIT'; - $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg); + foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ + + if($Contract->AnticipatedCost ==true){ + $Anticipated =1; + } else { + $Anticipated =0; + } + $SQL = "INSERT INTO contractcharges (contractref, + transtype, + transno, + amount, + narrative, + anticipated) + VALUES ('" . $Contract->ContractRef . "', + '21', + '" . $CreditNoteNo . "', + '" . -$Contract->Amount/ $_SESSION['SuppTrans']->ExRate . "', + '" . $Contract->Narrative . "', + '" . $Anticipated . "')"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The contract charge record for contract') . ' ' . $Contract->ContractRef . ' ' . _('could not be added because'); + $DbgMsg = _('The following SQL to insert the contract charge record was used'); + $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); + } + + DB_Txn_Commit($db); + prnMsg(_('Supplier credit note number') . ' ' . $CreditNoteNo . ' ' . _('has been processed'),'success'); echo '<br><div class="centre"><a href="' . $rootpath . '/SupplierCredit.php?&SupplierID=' .$_SESSION['SuppTrans']->SupplierID . '">' . _('Enter another Credit Note for this Supplier') . '</a></div>'; unset($_SESSION['SuppTrans']->GRNs); Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2010-08-10 08:27:14 UTC (rev 3689) +++ trunk/SupplierInvoice.php 2010-08-14 09:55:38 UTC (rev 3690) @@ -52,23 +52,23 @@ /*Now retrieve supplier information - name, currency, default ex rate, terms, tax rate etc */ $sql = "SELECT suppliers.suppname, - suppliers.supplierid, - paymentterms.terms, - paymentterms.daysbeforedue, - paymentterms.dayinfollowingmonth, - suppliers.currcode, - currencies.rate AS exrate, - suppliers.taxgroupid, - taxgroups.taxgroupdescription - FROM suppliers, - taxgroups, - currencies, - paymentterms, - taxauthorities - WHERE suppliers.taxgroupid=taxgroups.taxgroupid - AND suppliers.currcode=currencies.currabrev - AND suppliers.paymentterms=paymentterms.termsindicator - AND suppliers.supplierid = '" . $_GET['SupplierID'] . "'"; + suppliers.supplierid, + paymentterms.terms, + paymentterms.daysbeforedue, + paymentterms.dayinfollowingmonth, + suppliers.currcode, + currencies.rate AS exrate, + suppliers.taxgroupid, + taxgroups.taxgroupdescription + FROM suppliers, + taxgroups, + currencies, + paymentterms, + taxauthorities + WHERE suppliers.taxgroupid=taxgroups.taxgroupid + AND suppliers.currcode=currencies.currabrev + AND suppliers.paymentterms=paymentterms.termsindicator + AND suppliers.supplierid = '" . $_GET['SupplierID'] . "'"; $ErrMsg = _('The supplier record selected') . ': ' . $_GET['SupplierID'] . ' ' ._('cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); @@ -147,19 +147,24 @@ $_SESSION['SuppTrans']->OvAmount = 0; /* for starters */ if (count($_SESSION['SuppTrans']->GRNs) > 0){ foreach ( $_SESSION['SuppTrans']->GRNs as $GRN){ - $_SESSION['SuppTrans']->OvAmount = $_SESSION['SuppTrans']->OvAmount + ($GRN->This_QuantityInv * $GRN->ChgPrice); + $_SESSION['SuppTrans']->OvAmount += ($GRN->This_QuantityInv * $GRN->ChgPrice); } } if (count($_SESSION['SuppTrans']->GLCodes) > 0){ foreach ( $_SESSION['SuppTrans']->GLCodes as $GLLine){ - $_SESSION['SuppTrans']->OvAmount = $_SESSION['SuppTrans']->OvAmount + $GLLine->Amount; + $_SESSION['SuppTrans']->OvAmount += $GLLine->Amount; } } if (count($_SESSION['SuppTrans']->Shipts) > 0){ foreach ( $_SESSION['SuppTrans']->Shipts as $ShiptLine){ - $_SESSION['SuppTrans']->OvAmount = $_SESSION['SuppTrans']->OvAmount + $ShiptLine->Amount; + $_SESSION['SuppTrans']->OvAmount += $ShiptLine->Amount; } } + if (count($_SESSION['SuppTrans']->Contracts) > 0){ + foreach ( $_SESSION['SuppTrans']->Contracts as $Contract){ + $_SESSION['SuppTrans']->OvAmount += $Contract->Amount; + } + } $_SESSION['SuppTrans']->OvAmount = round($_SESSION['SuppTrans']->OvAmount,2); }else { /*OvAmount must be entered manually */ @@ -178,7 +183,7 @@ "<a href='" . $rootpath . "/SuppInvGRNs.php?" . SID . "'>" . _('click here') . '</a> ' . _('to continue') . '.</DIV><br>'; exit; } - if (isset($_POST['Shipts']) and $_POST['Shipts'] == _('Enter Against Shipment')){ + if (isset($_POST['Shipts']) and $_POST['Shipts'] == _('Enter Against Shipments')){ /*This ensures that any changes in the page are stored in the session before calling the shipments page */ echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . "/SuppShiptChgs.php?" . SID . "'>"; echo '<DIV class="centre">' . _('You should automatically be forwarded to the entry of invoices against shipments page') . @@ -194,14 +199,22 @@ "<a href='" . $rootpath . "/SuppTransGLAnalysis.php?" . SID . "'>" . _('click here') . '</a> ' . _('to continue') . '.</DIV><br>'; exit; } + if (isset($_POST['Contracts']) and $_POST['Contracts'] == _('Enter Against Contracts')){ + /*This ensures that any changes in the page are stored in the session before calling the shipments page */ + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/SuppContractChgs.php?' . SID . '">'; + echo '<DIV class="centre">' . _('You should automatically be forwarded to the entry of invoices against contracts page') . + '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh'). ') ' . + '<a href="' . $rootpath . '/SuppContractChgs.php?' . SID . '">' . _('click here') . '</a> ' . _('to continue') . '.</DIV><br>'; + exit; + } /* everything below here only do if a Supplier is selected fisrt add a header to show who we are making an invoice for */ - echo "<table BORDER=2 colspan=4><tr><th>" . _('Supplier') . - "</th><th>" . _('Currency') . - "</th><th>" . _('Terms'). - "</th><th>" . _('Tax Authority') . '</th></tr>'; + echo '<table border=2 colspan=4><tr><th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Terms') . '</th> + <th>' . _('Tax Authority') . '</th></tr>'; echo '<tr><td><font color=blue><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></font></td> @@ -211,13 +224,13 @@ </tr> </table>'; - echo "<br><form action='" . $_SERVER['PHP_SELF'] . "?" . SID . "' method=post name=form1>"; + echo '<br><form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="post" name="form1">'; echo '<table>'; - echo '<tr><td>' . _('Supplier Invoice Reference') . ":</td> - <td><font size=2><input type=TEXT size=20 maxlength=20 name=SuppReference VALUE='" . - $_SESSION['SuppTrans']->SuppReference . "'></td>"; + echo '<tr><td>' . _('Supplier Invoice Reference') . ':</td> + <td><input type="text" size="20" maxlength="20" name="SuppReference" VALUE="' . + $_SESSION['SuppTrans']->SuppReference . '"></td>'; if (!isset($_SESSION['SuppTrans']->TranDate)){ $_SESSION['SuppTrans']->TranDate= Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))); @@ -225,16 +238,17 @@ echo '<td>' . _('Invoice Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</td> <td><input type="TEXT" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="11" maxlength="10" name="TranDate" VALUE="' . $_SESSION['SuppTrans']->TranDate . '"></td>'; - echo '<td>' . _('Exchange Rate') . ":</td> - <td><input type=TEXT class='number' size=11 maxlength=10 name='ExRate' VALUE=" . $_SESSION['SuppTrans']->ExRate . '></td></tr>'; + echo '<td>' . _('Exchange Rate') . ':</td> + <td><input type="text" class="number" size="11" maxlength="10" name="ExRate" VALUE="' . $_SESSION['SuppTrans']->ExRate . '"></td></tr>'; echo '</table>'; - echo "<br><div class='centre'><input type=submit name='GRNS' VALUE='" . _('Enter Against Goods Received') . "'> "; + echo '<br><div class="centre"><input type="submit" name="GRNS" value="' . _('Enter Against Goods Received') . '"> '; - echo "<input type=submit name='Shipts' VALUE='" . _('Enter Against Shipment') . "'> "; + echo '<input type="submit" name="Shipts" VALUE="' . _('Enter Against Shipments') . '"> '; + echo '<input type="submit" name="Contracts" VALUE="' . _('Enter Against Contracts') . '"> '; if ( $_SESSION['SuppTrans']->GLLink_Creditors == 1){ - echo "<input type=submit name='GL' VALUE='" . _('Enter General Ledger Analysis') . "'></div>"; + echo '<input type="submit" name="GL" VALUE="' . _('Enter General Ledger Analysis') . '"></div>'; } else { echo '</div>'; } @@ -244,12 +258,12 @@ /*Show all the selected GRNs so far from the SESSION['SuppInv']->GRNs array */ echo '<table cellpadding=2>'; - $tableheader = "<tr bgcolor=#800000><th>" . _('Seq') . " #</th> - <th>" . _('Item Code') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Quantity Charged') . "</th> - <th>" . _('Price in') . ' ' . $_SESSION['SuppTrans']->CurrCode . "</th> - <th>" . _('Line Total') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th></tr>'; + $tableheader = '<tr bgcolor=#800000><th>' . _('Seq') . ' #</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity Charged') . '</th> + <th>' . _('Price in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> + <th>' . _('Line Total') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th></tr>'; echo $tableheader; $TotalGRNValue = 0; @@ -298,36 +312,67 @@ echo '<tr><td colspan=2 class=number><font size=4 color=blue>' . _('Total') . ':</font></td> <td class=number><font size=4 color=BLUE><U>' . number_format($TotalShiptValue,2) . '</U></font></td></tr></table>'; } + + if (count( $_SESSION['SuppTrans']->Contracts) > 0){ /*if there are any contract charges on the invoice*/ + echo '<table cellpadding="2">'; + $TableHeader = '<tr><th>' . _('Contract') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Narrative') . '</th></tr>'; + echo $TableHeader; + $TotalContractsValue = 0; + $i=0; + foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ + + echo '<tr><td>' . $Contract->ContractRef . '</td> + <td class=number>' . number_format($Contract->Amount,2) . '</td> + <td>' . $Contract->Narrative . '</td> + </tr>'; + + $TotalContractsValue += $Contract->Amount; + + $i++; + if ($i == 15){ + $i = 0; + echo $TableHeader; + } + } + + echo '<tr><td class="number">' . _('Total') . ':</font></td> + <td class="number">' . number_format($TotalContractsValue,2) . '</td> + </tr></table>'; + } + + if ( $_SESSION['SuppTrans']->GLLink_Creditors == 1){ if (count($_SESSION['SuppTrans']->GLCodes) > 0){ echo '<br><table cellpadding=2>'; - $TableHeader = "<tr><th>" . _('Account') . - "</th><th>" . _('Name') . - "</th><th>" . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . "</th> - <th>" . _('Shipment') ."</th> - <th>" . _('Job') . "</th> - <th>" . _('Narrative') . '</th></tr>'; + $TableHeader = '<tr><th>' . _('Account') . '</th> + <th>' . _('Name') . '</th> + <th>' . _('Amount') . '<br>' . _('in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> + <th>' . _('Shipment') . '</th> + <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; $TotalGLValue = 0; foreach ($_SESSION['SuppTrans']->GLCodes as $EnteredGLCode){ - echo '<tr><td>' . $EnteredGLCode->GLCode . '</td><td>' . $EnteredGLCode->GLActName . - '</td><td class=number>' . number_format($EnteredGLCode->Amount,2) . - '</td><td>' . $EnteredGLCode->ShiptRef . '</td><td>' .$EnteredGLCode->JobRef . - '</td><td>' . $EnteredGLCode->Narrative . '</td></tr>'; + echo '<tr><td>' . $EnteredGLCode->GLCode . '</td> + <td>' . $EnteredGLCode->GLActName . '</td> + <td class=number>' . number_format($EnteredGLCode->Amount,2) . '</td> + <td>' . $EnteredGLCode->ShiptRef . '</td> + <td>' . $EnteredGLCode->Narrative . '</td></tr>'; - $TotalGLValue = $TotalGLValue + $EnteredGLCode->Amount; + $TotalGLValue += $EnteredGLCode->Amount; } - echo '<tr><td colspan=2 class=number><font size=4 color=blue>' . _('Total') . ':</font></td> - <td class=number><font size=4 color=blue><U>' . number_format($TotalGLValue,2) . '</U></font></td> - </tr></table>'; + echo '<tr><td colspan=2 class="number">' . _('Total') . ':</td> + <td class=number>' . number_format($TotalGLValue,2) . '</td> + </tr></table>'; } if (!isset($TotalGRNValue)){ @@ -339,24 +384,28 @@ if (!isset($TotalShiptValue)){ $TotalShiptValue = 0; } + if (!isset($TotalContractsValue)){ + $TotalContractsValue = 0; + } + $_SESSION['SuppTrans']->OvAmount = ($TotalGRNValue + $TotalGLValue + $TotalShiptValue + $TotalContractsValue); - $_SESSION['SuppTrans']->OvAmount = $TotalGRNValue + $TotalGLValue + $TotalShiptValue; - echo '<br><table><tr><td>' . _('Amount in supplier currency') . ':</td><td colspan=2 class=number>' . number_format( $_SESSION['SuppTrans']->OvAmount,2) . '</td></tr>'; } else { echo '<table><tr><td>' . _('Amount in supplier currency') . - ':</td><td colspan=2 class=number><input type=TEXT size=12 maxlength=10 name=OvAmount VALUE=' . + ':</td><td colspan=2 class=number><input type="text" size="12" maxlength="10" name="OvAmount" VALUE=' . number_format( $_SESSION['SuppTrans']->OvAmount,2) . '></td></tr>'; } - echo "<tr><td colspan=2><input type=Submit name='ToggleTaxMethod' VALUE='" . _('Update Tax Calculation') . - "'></td><td><select name='OverRideTax' onChange='ReloadForm(form1.ToggleTaxMethod)'>"; + echo '<tr><td colspan="2"><input type="submit" name="ToggleTaxMethod" VALUE="' . _('Update Tax Calculation') . + '"></td><td><select name="OverRideTax" onChange="ReloadForm(form1.ToggleTaxMethod)">'; if ($_POST['OverRideTax']=='Man'){ - echo "<option VALUE='Auto'>" . _('Automatic') . "<option selected VALUE='Man'>" . _('Manual'); + echo '<option value="Auto">' . _('Automatic') . '</option> + <option selected VALUE="Man">' . _('Manual') . '</option>'; } else { - echo "<option selected VALUE='Auto'>" . _('Automatic') . "<option VALUE='Man'>" . _('Manual'); + echo '<option selected value="Auto">' . _('Automatic') . '</option> + <option VALUE="Man">' . _('Manual') . '</option>'; } echo '</select></td></tr>'; @@ -375,7 +424,7 @@ if (!isset($_POST['OverRideTax']) or $_POST['OverRideTax']=='Auto'){ - echo ' <input type=TEXT class="number" name=TaxRate' . $Tax->TaxCalculationOrder . ' maxlength=4 size=4 VALUE=' . $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100 . '>%'; + echo ' <input type="text" class="number" name=TaxRate' . $Tax->TaxCalculationOrder . ' maxlength=4 size=4 VALUE=' . $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100 . '>%'; /*Now recaluclate the tax depending on the method */ if ($Tax->TaxOnTax ==1){ @@ -399,9 +448,9 @@ // } $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = $_POST['TaxAmount' . $Tax->TaxCalculationOrder]; - echo ' <input type=hidden name=TaxRate' . $Tax->TaxCalculationOrder . ' VALUE=' . $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100 . '>'; + echo ' <input type="hidden" name="TaxRate"' . $Tax->TaxCalculationOrder . ' value="' . $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100 . '">'; - echo '</td><td><input type=TEXT class="number" size=12 maxlength=12 name="TaxAmount' . $Tax->TaxCalculationOrder . '" VALUE=' . round($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount,2) . '>'; + echo '</td><td><input type="text" class="number" size="12" maxlength="12" name="TaxAmount' . $Tax->TaxCalculationOrder . '" VALUE=' . round($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount,2) . '>'; } $TaxTotal += $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount; @@ -412,12 +461,15 @@ $DisplayTotal = number_format(( $_SESSION['SuppTrans']->OvAmount + $TaxTotal), 2); - echo '<tr><td>' . _('Invoice Total') . ':</td><td colspan=2 class=number><b>' . $DisplayTotal . '</b></td></tr></table>'; + echo '<tr><td>' . _('Invoice Total') . ':</td> + <td colspan=2 class="number"><b>' . $DisplayTotal . '</b></td> + </tr></table>'; - echo '<table><tr><td>' . _('Comments') . '</td><td><textarea name=Comments COLS=40 ROWS=2>' . - $_SESSION['SuppTrans']->Comments . '</textarea></td></tr></table>'; + echo '<table><tr><td>' . _('Comments') . '</td> + <td><textarea name="Comments" cols="40" rows="2">' . $_SESSION['SuppTrans']->Comments . '</textarea></td> + </tr></table>'; - echo "<p><div class='centre'><input type=submit name='PostInvoice' VALUE='" . _('Enter Invoice') . "'></div>"; + echo '<p><div class="centre"><input type="submit" name="PostInvoice" value="' . _('Enter Invoice') . '"></div>'; } else { //do the postings -and dont show the button to process @@ -426,13 +478,11 @@ foreach ($_SESSION['SuppTrans']->Taxes as $Tax) { - /*Set the tax rate to what was entered */ if (isset($_POST['TaxRate' . $Tax->TaxCalculationOrder])){ $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate = $_POST['TaxRate' . $Tax->T... [truncated message content] |
From: <dai...@us...> - 2010-08-15 09:22:17
|
Revision: 3692 http://web-erp.svn.sourceforge.net/web-erp/?rev=3692&view=rev Author: daintree Date: 2010-08-15 09:22:08 +0000 (Sun, 15 Aug 2010) Log Message: ----------- Contract costing work Modified Paths: -------------- trunk/Contracts.php trunk/SelectContract.php trunk/WWW_Users.php trunk/WorkOrderIssue.php trunk/doc/Change.log.html trunk/index.php trunk/sql/mysql/upgrade3.11.1-3.12.sql Added Paths: ----------- trunk/ContractCosting.php trunk/includes/Contract_Readin.php Added: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php (rev 0) +++ trunk/ContractCosting.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -0,0 +1,190 @@ +<?php + +/* $Id: $*/ + +$PageSecurity = 6; +include('includes/DefineContractClass.php'); +include('includes/session.inc'); +$title = _('Contract Costing'); +/* Session started in header.inc for password checking and authorisation level check */ +include('includes/header.inc'); + + +if (empty($_GET['identifier'])) { + $identifier=date('U'); +} else { + $identifier=$_GET['identifier']; +} + +if (!isset($_GET['SelectedContract'])){ + echo '<br>'; + prnMsg( _('This page is expected to be called with the contract reference to show the costing for'), 'error'); + include ('includes/footer.inc'); + exit; +} else { + $ContractRef = $_GET['SelectedContract']; + $_SESSION['Contract'.$identifier] = new Contract; + include('includes/Contract_Readin.php'); +} + +/*Now read in actual usage of stock */ +$sql = "SELECT stockmoves.stockid, + stockmaster.description, + stockmaster.units, + SUM(stockmoves.qty) AS quantity, + SUM(stockmoves.qty*stockmoves.standardcost) AS totalcost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + WHERE stockmoves.type=28 + AND stockmoves.reference='" . $_SESSION['Contract'.$identifier]->WO . "' + GROUP BY stockmoves.stockid, + stockmaster.description, + stockmaster.units"; +$ErrMsg = _('Could not get the inventory issues for this contract because'); +$InventoryIssuesResult = DB_query($sql,$db,$ErrMsg); +$InventoryIssues = array(); +while ($InventoryIssuesRow = DB_fetch_array($InventoryIssuesResult)){ + $InventoryIssues[$InventoryIssuesRow['stockid']]->StockID = $InventoryIssuesRow['stockid']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->Description = $InventoryIssuesRow['description']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->Quantity = $InventoryIssuesRow['quantity']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->TotalCost = $InventoryIssuesRow['totalcost']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->Units = $InventoryIssuesRow['units']; + $InventoryIssues[$InventoryIssuesRow['stockid']]->Matched = 0; +} + +echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/contract.png" title="' . _('Contract') . '" alt=""> + ' . $_SESSION['Contract'.$identifier]->CustomerName . '<br>' . $_SESSION['Contract'.$identifier]->ContractDescription; + +echo '<table> + <tr> + <th colspan=6>' . _('Original Costing') .'</th> + <th colspan=6>' . _('Actual Costs') .'</th></tr> + <tr>'; + +echo '<tr><th colspan=12>' . _('Inventory Required') . '</th></tr>'; + +echo '<tr><th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th> + </tr>'; +$ContractBOMBudget =0; +$ContractBOMActual = 0; +foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $Component) { + echo '<tr><td>' . $Component->StockID . '</td> + <td>' . $Component->ItemDescription . '</td> + <td class="number">' . $Component->Quantity . '</td> + <td>' . $Component->UOM . '</td> + <td class="number">' . number_format($Component->ItemCost,2) . '</td> + <td class="number">' . number_format(($Component->ItemCost * $Component->Quantity),2) . '</td>'; + $ContractBOMBudget += ($Component->ItemCost * $Component->Quantity); + if (isset($InventoryIssues[$Component->StockID])){ + $InventoryIssues[$Component->StockID]->Matched=1; + echo '<td colspan=2 align="centre">' . _('Actual usage') . '</td> + <td class="number">' . -$InventoryIssues[$Component->StockID]->Quantity . '</td> + <td>' . $InventoryIssues[$Component->StockID]->Units . '</td> + <td class="number">' . number_format($InventoryIssues[$Component->StockID]->TotalCost/$InventoryIssues[$Component->StockID]->Quantity,2) . '</td> + <td>' . number_format(-$InventoryIssues[$Component->StockID]->TotalCost,2) . '</td></tr>'; + } else { + echo '<td colspan="6"></td></tr>'; + } +} + +foreach ($InventoryIssues as $Component) { //actual inventory components used + $ContractBOMActual -=$Component->TotalCost; + if ($Component->Matched == 0) { //then its a component that wasn't budget for + echo '<tr><td colspan="6"></td> + <td>' . $Component->StockID . '</td> + <td>' . $Component->Description . '</td> + <td class="number">' . -$Component->Quantity . '</td> + <td>' . $Component->Units . '</td> + <td class="number">' . number_format($Component->TotalCost/$Component->Quantity,2) . '</td> + <td class="number">' . number_format(-$Component->TotalCost,2) . '</td></tr>'; + } //end if its a component not originally budget for +} + +echo '<tr><td class="number" colspan="5">' . _('Total Inventory Budgeted Cost') . ':</td> + <td class="number">' . number_format($ContractBOMBudget,2) . '</td> + <td class="number" colspan="5">' . _('Total Inventory Actual Cost') . ':</td> + <td class="number">' . number_format($ContractBOMActual,2) . '</td></tr>'; + +echo '<tr><th colspan="12" align="center">' . _('Other Costs') . '</th></tr>'; + +$OtherReqtsBudget = 0; +//other requirements budget sub-table +echo '<tr><td colspan=6><table> + <tr><th>' . _('Requirement') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit Cost') . '</th> + <th>' . _('Total Cost') . '</th></tr>'; +foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $Requirement) { + echo '<tr><td>' . $Requirement->Requirement . '</td> + <td class="number">' . $Requirement->Quantity . '</td> + <td class="number">' . $Requirement->CostPerUnit . '</td> + <td class="number">' . number_format(($Requirement->CostPerUnit * $Requirement->Quantity),2) . '</td> + </tr>'; + $OtherReqtsBudget += ($Requirement->CostPerUnit * $Requirement->Quantity); +} +echo '<tr><th colspan="3" align="right"><b>' . _('Budgeted Other Costs') . '</b></th><th class="number"><b>' . number_format($OtherReqtsBudget,2) . '</b></th></tr> + </table></td>'; + +//Now other requirements actual in a sub table +echo '<td colspan="6"><table> + <tr><th>' . _('Supplier') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Requirement') . '</th> + <th>' . _('Total Cost') . '</th> + <th>' . _('Anticipated') . '</th> + </tr>'; + +/*Now read in the actual other items charged to the contract */ +$sql = "SELECT supptrans.supplierno, + supptrans.suppreference, + supptrans.trandate, + contractcharges.amount, + contractcharges.narrative, + contractcharges.anticipated + FROM supptrans INNER JOIN contractcharges + ON supptrans.type=contractcharges.transtype + AND supptrans.transno=contractcharges.transno + WHERE contractcharges.contractref='" . $ContractRef . "' + ORDER BY contractcharges.anticipated"; +$ErrMsg = _('Could not get the other charges to the contract because'); +$OtherChargesResult = DB_query($sql,$db,$ErrMsg); +$OtherReqtsActual =0; +while ($OtherChargesRow=DB_fetch_array($OtherChargesResult)) { + if ($OtherChargesRow['anticipated']==0){ + $Anticipated = _('No'); + } else { + $Anticipated = _('Yes'); + } + echo '<tr><td>' . $OtherChargesRow['supplierno'] . '</td> + <td>' . $OtherChargesRow['suppreference'] . '</td> + <td>' .ConvertSQLDate($OtherChargesRow['trandate']) . '</td> + <td>' . $OtherChargesRow['narrative'] . '</td> + <td class="number">' . number_format($OtherChargesRow['amount'],2) . '</td> + <td>' . $Anticipated . '</td> + </tr>'; + $OtherReqtsActual +=$OtherChargesRow['amount']; +} +echo '<tr><th colspan="4" align="right"><b>' . _('Actual Other Costs') . '</b></th><th class="number"><b>' . number_format($OtherReqtsActual,2) . '</b></th></tr> + </table></td></tr>'; +echo '<tr><td colspan="5"><b>' . _('Total Budget Contract Cost') . '</b></td> + <td class="number"><b>' . number_format($OtherReqtsBudget+$ContractBOMBudget,2) . '</b></td> + <td colspan="5"><b>' . _('Total Actual Contract Cost') . '</b></td> + <td class="number"><b>' . number_format($OtherReqtsActual+$ContractBOMActual,2) . '</b></td></tr>'; + +echo '</table>'; + +include('includes/footer.inc'); +?> Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/Contracts.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -152,103 +152,9 @@ $_SESSION['Contract'.$identifier] = new Contract; /*read in all the guff from the selected contract into the contract Class variable */ - - $ContractHeaderSQL = "SELECT contractdescription, - contracts.debtorno, - contracts.branchcode, - status, - categoryid, - orderno, - margin, - wo, - requireddate, - drawing, - exrate, - debtorsmaster.name, - custbranch.brname, - debtorsmaster.currcode - FROM contracts INNER JOIN debtorsmaster - ON contracts.debtorno=debtorsmaster.debtorno - INNER JOIN currencies - ON debtorsmaster.currcode=currencies.currabrev - INNER JOIN custbranch - ON debtorsmaster.debtorno=custbranch.debtorno - WHERE contractref= '" . $_GET['ModifyContractRef'] . "'"; - - $ErrMsg = _('The contract cannot be retrieved because'); - $DbgMsg = _('The SQL statement that was used and failed was'); - $ContractHdrResult = DB_query($ContractHeaderSQL,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($ContractHdrResult)==1 and !isset($_SESSION['Contract'.$identifier]->ContractRef )) { - - $myrow = DB_fetch_array($ContractHdrResult); - $_SESSION['Contract'.$identifier]->ContractRef = $_GET['ModifyContractRef']; - $_SESSION['Contract'.$identifier]->ContractDescription = $myrow['contractdescription']; - $_SESSION['Contract'.$identifier]->DebtorNo = $myrow['debtorno']; - $_SESSION['Contract'.$identifier]->BranchCode = $myrow['branchcode']; - $_SESSION['Contract'.$identifier]->Status = $myrow['status']; - $_SESSION['Contract'.$identifier]->CategoryID = $myrow['categoryid']; - $_SESSION['Contract'.$identifier]->OrderNo = $myrow['orderno']; - $_SESSION['Contract'.$identifier]->Margin = $myrow['margin']; - $_SESSION['Contract'.$identifier]->WO = $myrow['wo']; - $_SESSION['Contract'.$identifier]->RequiredDate = ConvertSQLDate($myrow['requireddate']); - $_SESSION['Contract'.$identifier]->Drawing = $myrow['drawing']; - $_SESSION['Contract'.$identifier]->ExRate = $myrow['exrate']; - $_SESSION['Contract'.$identifier]->BranchName = $myrow['brname']; - $_SESSION['RequireCustomerSelection'] = 0; - $_SESSION['Contract'.$identifier]->CustomerName = $myrow['name']; - $_SESSION['Contract'.$identifier]->CurrCode = $myrow['currcode']; + $ContractRef = $_GET['ModifyContractRef']; + include('includes/Contract_Readin.php'); - -/*now populate the contract BOM array with the items required for the contract */ - - $ContractBOMsql = "SELECT contractbom.stockid, - stockmaster.description, - contractbom.workcentreadded, - contractbom.quantity, - stockmaster.units, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost - FROM contractbom INNER JOIN stockmaster - ON contractbom.stockid=stockmaster.stockid - WHERE contractref ='" . $_GET['ModifyContractRef'] . "'"; - - $ErrMsg = _('The bill of material cannot be retrieved because'); - $DbgMsg = _('The SQL statement that was used to retrieve the contract bill of material was'); - $ContractBOMResult = db_query($ContractBOMsql,$db,$ErrMsg,$DbgMsg); - - if (db_num_rows($ContractBOMResult) > 0) { - while ($myrow=db_fetch_array($ContractBOMResult)) { - $_SESSION['Contract'.$identifier]->Add_To_ContractBOM($myrow['stockid'], - $myrow['description'], - $myrow['workcentreadded'], - $myrow['quantity'], - $myrow['cost'], - $myrow['units']); - } /* add contract bill of materials BOM lines*/ - } //end is there was a contract BOM to add - //Now add the contract requirments - $ContractReqtsSQL = "SELECT requirement, - quantity, - costperunit, - contractreqid - FROM contractreqts - WHERE contractref ='" . $_GET['ModifyContractRef'] . "' - ORDER BY contractreqid"; - - $ErrMsg = _('The other contract requirementscannot be retrieved because'); - $DbgMsg = _('The SQL statement that was used to retrieve the other contract requirments was'); - $ContractReqtsResult = db_query($ContractReqtsSQL,$db,$ErrMsg,$DbgMsg); - - if (db_num_rows($ContractReqtsResult) > 0) { - while ($myrow=db_fetch_array($ContractReqtsResult)) { - $_SESSION['Contract'.$identifier]->Add_To_ContractRequirements($myrow['requirement'], - $myrow['quantity'], - $myrow['costperunit'], - $myrow['contractreqid']); - } /* add other contract requirments lines*/ - } //end is there are contract other contract requirments to add - } // end if there was a header for the contract - }// its an existing contract to readin if (isset($_POST['CancelContract'])) { Modified: trunk/SelectContract.php =================================================================== --- trunk/SelectContract.php 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/SelectContract.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -15,17 +15,25 @@ echo '<p><div class="centre">'; -if (isset($_REQUEST['ContractRef']) AND $_REQUEST['ContractRef']!='') { - $_REQUEST['ContractRef'] = trim($_REQUEST['ContractRef']); - echo _('Contract Reference') . ' - ' . $_REQUEST['ContractRef']; +if (isset($_GET['ContractRef'])){ + $_POST['ContractRef']=$_GET['ContractRef']; +} +if (isset($_GET['SelectedCustomer'])){ + $_POST['SelectedCustomer']=$_GET['SelectedCustomer']; +} + + +if (isset($_POST['ContractRef']) AND $_POST['ContractRef']!='') { + $_POST['ContractRef'] = trim($_POST['ContractRef']); + echo _('Contract Reference') . ' - ' . $_POST['ContractRef']; } else { - if (isset($_REQUEST['SelectedCustomer'])) { - echo _('For customer') . ': ' . $_REQUEST['SelectedCustomer'] . ' ' . _('and') . ' '; - echo '<input type="hidden" name="SelectedCustomer" value="' . $_REQUEST['SelectedCustomer'] . '">'; + if (isset($_POST['SelectedCustomer'])) { + echo _('For customer') . ': ' . $_POST['SelectedCustomer'] . ' ' . _('and') . ' '; + echo '<input type="hidden" name="SelectedCustomer" value="' . $_POST['SelectedCustomer'] . '">'; } } -if (!isset($_REQUEST['ContractRef']) or $_REQUEST['ContractRef']==''){ +if (!isset($_POST['ContractRef']) or $_POST['ContractRef']==''){ echo _('Contract Reference') . ': <input type="text" name="ContractRef" maxlength=20 size=20>  '; echo '<select name="Status">'; @@ -75,7 +83,7 @@ //figure out the SQL required from the inputs available -if (isset($_REQUEST['ContractRef']) AND $_REQUEST['ContractRef'] !='') { +if (isset($_POST['ContractRef']) AND $_POST['ContractRef'] !='') { $SQL = "SELECT contractref, contractdescription, categoryid, @@ -89,10 +97,10 @@ requireddate FROM contracts INNER JOIN debtorsmaster ON contracts.debtorno = debtorsmaster.debtorno - WHERE contractref='". $_REQUEST['ContractRef'] ."'"; + WHERE contractref " . LIKE . " '%" . $_POST['ContractRef'] ."%'"; } else { //contractref not selected - if (isset($_REQUEST['SelectedCustomer'])) { + if (isset($_POST['SelectedCustomer'])) { $SQL = "SELECT contractref, contractdescription, @@ -107,7 +115,7 @@ requireddate FROM contracts INNER JOIN debtorsmaster ON contracts.debtorno = debtorsmaster.debtorno - WHERE debtorno='". $_REQUEST['SelectedCustomer'] ."'"; + WHERE debtorno='". $_POST['SelectedCustomer'] ."'"; if ($_POST['Status']!=4){ $SQL .= " AND status='" . $_POST['Status'] . "'"; } @@ -142,6 +150,7 @@ <th>' . _('Modify') . '</th> <th>' . _('Order') . '</th> <th>' . _('Issue To WO') . '</th> + <th>' . _('Costing') . '</th> <th>' . _('Contract Ref') . '</th> <th>' . _('Description') . '</th> <th>' . _('Customer') . '</th> @@ -163,7 +172,8 @@ $ModifyPage = $rootpath . '/Contracts.php?' . SID . '&ModifyContractRef=' . $myrow['contractref']; $OrderModifyPage = $rootpath . '/SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; - $IssueToWOPage = $rootpath . '/WOIssue.php?' . SID . '&WO=' . $myrow['wo']; + $IssueToWOPage = $rootpath . '/WorkOrderIssue.php?' . SID . '&WO=' . $myrow['wo'] . '&StockID=' . $myrow['contractref']; + $CostingPage = $rootpath . '/ContractCosting.php?' . SID . '&SelectedContract=' . $myrow['contractref']; $FormatedRequiredDate = ConvertSQLDate($myrow['requireddate']); if ($myrow['status']==0 OR $myrow['status']==1){ //still setting up the contract @@ -177,9 +187,11 @@ echo '<td>' . _('n/a') . '</td>'; } if ($myrow['status']==2){ //the customer has accepted the quote but not completed contract yet - echo '<td><a href="' . $IssueToWOPage . '">' . $myrow['wo'] . '</a></td>'; + echo '<td><a href="' . $IssueToWOPage . '">' . $myrow['wo'] . '</a></td> + <td><a href="' . $CostingPage . '">' . _('View') . '<a></td>'; } else { - echo '<td>' . _('n/a') . '</td>'; + echo '<td>' . _('n/a') . '</td> + <td>' . _('n/a') . '</td>'; } echo '<td>' . $myrow['contractref'] . '</td> <td>' . $myrow['contractdescription'] . '</td> Modified: trunk/WWW_Users.php =================================================================== --- trunk/WWW_Users.php 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/WWW_Users.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -17,7 +17,6 @@ _('Purchasing'), _('Inventory'), _('Manufacturing'), - _('Contracts'), _('General Ledger'), _('Asset Manager'), _('Petty Cash'), Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/WorkOrderIssue.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -8,23 +8,29 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (isset($_GET['WO'])){ + $_POST['WO']=$_GET['WO']; +} +if (isset($_GET['StockID'])){ + $_POST['StockID']=$_GET['StockID']; +} + echo '<a href="'. $rootpath . '/SelectWorkOrder.php?' . SID . '">' . _('Back to Work Orders'). '</a><br>'; -echo '<a href="'. $rootpath . '/WorkOrderCosting.php?' . SID . '&WO=' . $_REQUEST['WO'] . '">' . _('Back to Costing'). '</a><br>'; +echo '<a href="'. $rootpath . '/WorkOrderCosting.php?' . SID . '&WO=' . $_POST['WO'] . '">' . _('Back to Costing'). '</a><br>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; -if (!isset($_REQUEST['WO']) OR !isset($_REQUEST['StockID'])) { - /* This page can only be called with a purchase order number for invoicing*/ + +if (!isset($_POST['WO']) OR !isset($_POST['StockID'])) { + /* This page can only be called with a work order number for issuing stock to*/ echo '<div class="centre"><a href="' . $rootpath . '/SelectWorkOrder.php?' . SID . '">'. _('Select a work order to issue materials to').'</a></div>'; prnMsg(_('This page can only be opened if a work order has been selected. Please select a work order to issue materials to first'),'info'); include ('includes/footer.inc'); exit; } else { - echo '<input type="hidden" name="WO" value=' .$_REQUEST['WO'] . '>'; - $_POST['WO']=$_REQUEST['WO']; - echo '<input type="hidden" name="StockID" value=' .$_REQUEST['StockID'] . '>'; - $_POST['StockID']=$_REQUEST['StockID']; + echo '<input type="hidden" name="WO" value=' .$_POST['WO'] . '>'; + echo '<input type="hidden" name="StockID" value=' .$_POST['StockID'] . '>'; } if (isset($_GET['IssueItem'])){ $_POST['IssueItem']=$_GET['IssueItem']; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/doc/Change.log.html 2010-08-15 09:22:08 UTC (rev 3692) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>15/08/10 Phil: Decided to have contracts as part of orders module since not really enough links to warrant a new module changes to index.php WWW_Users.php and sql upgrade. +<p>15/08/10 Phil: New script for ContractCosting.php comparison of contract costs budgeted vs incurred. Lot of work on contracts <p>13/08/10 Phil: DefineSuppTransClass.php SupplierInvoice.php and SupplierCredit.php now allow entry of contract charges. New script for SuppContractChgs.php <p>13/08/10 Phil: Fixes to show creditors transactions correctly in GLTransInquiry.php signs mixed up and period not shown previously <p>10/08/10 Russell (Regal Prods): Fix SelectOrderItems.php width of narrative box was making screen unusable!! Added: trunk/includes/Contract_Readin.php =================================================================== --- trunk/includes/Contract_Readin.php (rev 0) +++ trunk/includes/Contract_Readin.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -0,0 +1,100 @@ +<?php +/* $Id: $ */ +/*Contract_Readin.php is used by the modify existing Contract in Contracts.php and also by ContractCosting.php */ + +$ContractHeaderSQL = "SELECT contractdescription, + contracts.debtorno, + contracts.branchcode, + status, + categoryid, + orderno, + margin, + wo, + requireddate, + drawing, + exrate, + debtorsmaster.name, + custbranch.brname, + debtorsmaster.currcode + FROM contracts INNER JOIN debtorsmaster + ON contracts.debtorno=debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + INNER JOIN custbranch + ON debtorsmaster.debtorno=custbranch.debtorno + WHERE contractref= '" . $ContractRef . "'"; + +$ErrMsg = _('The contract cannot be retrieved because'); +$DbgMsg = _('The SQL statement that was used and failed was'); +$ContractHdrResult = DB_query($ContractHeaderSQL,$db,$ErrMsg,$DbgMsg); + +if (DB_num_rows($ContractHdrResult)==1 and !isset($_SESSION['Contract'.$identifier]->ContractRef )) { + + $myrow = DB_fetch_array($ContractHdrResult); + $_SESSION['Contract'.$identifier]->ContractRef = $ContractRef; + $_SESSION['Contract'.$identifier]->ContractDescription = $myrow['contractdescription']; + $_SESSION['Contract'.$identifier]->DebtorNo = $myrow['debtorno']; + $_SESSION['Contract'.$identifier]->BranchCode = $myrow['branchcode']; + $_SESSION['Contract'.$identifier]->Status = $myrow['status']; + $_SESSION['Contract'.$identifier]->CategoryID = $myrow['categoryid']; + $_SESSION['Contract'.$identifier]->OrderNo = $myrow['orderno']; + $_SESSION['Contract'.$identifier]->Margin = $myrow['margin']; + $_SESSION['Contract'.$identifier]->WO = $myrow['wo']; + $_SESSION['Contract'.$identifier]->RequiredDate = ConvertSQLDate($myrow['requireddate']); + $_SESSION['Contract'.$identifier]->Drawing = $myrow['drawing']; + $_SESSION['Contract'.$identifier]->ExRate = $myrow['exrate']; + $_SESSION['Contract'.$identifier]->BranchName = $myrow['brname']; + $_SESSION['RequireCustomerSelection'] = 0; + $_SESSION['Contract'.$identifier]->CustomerName = $myrow['name']; + $_SESSION['Contract'.$identifier]->CurrCode = $myrow['currcode']; + + +/*now populate the contract BOM array with the items required for the contract */ + + $ContractBOMsql = "SELECT contractbom.stockid, + stockmaster.description, + contractbom.workcentreadded, + contractbom.quantity, + stockmaster.units, + stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS cost + FROM contractbom INNER JOIN stockmaster + ON contractbom.stockid=stockmaster.stockid + WHERE contractref ='" . $ContractRef . "'"; + + $ErrMsg = _('The bill of material cannot be retrieved because'); + $DbgMsg = _('The SQL statement that was used to retrieve the contract bill of material was'); + $ContractBOMResult = db_query($ContractBOMsql,$db,$ErrMsg,$DbgMsg); + + if (DB_num_rows($ContractBOMResult) > 0) { + while ($myrow=db_fetch_array($ContractBOMResult)) { + $_SESSION['Contract'.$identifier]->Add_To_ContractBOM($myrow['stockid'], + $myrow['description'], + $myrow['workcentreadded'], + $myrow['quantity'], + $myrow['cost'], + $myrow['units']); + } /* add contract bill of materials BOM lines*/ + } //end is there was a contract BOM to add + //Now add the contract requirments + $ContractReqtsSQL = "SELECT requirement, + quantity, + costperunit, + contractreqid + FROM contractreqts + WHERE contractref ='" . $ContractRef . "' + ORDER BY contractreqid"; + + $ErrMsg = _('The other contract requirementscannot be retrieved because'); + $DbgMsg = _('The SQL statement that was used to retrieve the other contract requirments was'); + $ContractReqtsResult = db_query($ContractReqtsSQL,$db,$ErrMsg,$DbgMsg); + + if (DB_num_rows($ContractReqtsResult) > 0) { + while ($myrow=db_fetch_array($ContractReqtsResult)) { + $_SESSION['Contract'.$identifier]->Add_To_ContractRequirements($myrow['requirement'], + $myrow['quantity'], + $myrow['costperunit'], + $myrow['contractreqid']); + } /* add other contract requirments lines*/ + } //end is there are contract other contract requirments to add +} // end if there was a header for the contract +?> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2010-08-14 10:03:42 UTC (rev 3691) +++ trunk/index.php 2010-08-15 09:22:08 UTC (rev 3692) @@ -10,7 +10,7 @@ $title=_('Main Menu'); /*The module link codes are hard coded in a switch statement below to determine the options to show for each tab */ -$ModuleLink = array('orders', 'AR', 'AP', 'PO', 'stock', 'manuf', 'Contracts', 'GL', 'FA', 'PC', 'system'); +$ModuleLink = array('orders', 'AR', 'AP', 'PO', 'stock', 'manuf', 'GL', 'FA', 'PC', 'system'); /*The headings showing on the tabs accross the main index used also in WWW_Users for defining what should be visible to the user */ $ModuleList = array(_('Sales'), _('Receivables'), @@ -18,7 +18,6 @@ _('Purchases'), _('Inventory'), _('Manufacturing'), - _('Contracts'), _('General Ledger'), _('Asset Manager'), _('Petty Cash'), @@ -42,17 +41,17 @@ <table class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustomerInquiry.php?' . sid . '&CustomerID=' . $_SESSION['CustomerID'] . '">' . _('Account Status') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/CustomerInquiry.php?' . SID . '&CustomerID=' . $_SESSION['CustomerID'] . '">' . _('Account Status') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectOrderItems.php?' . sid . '&NewOrder=Yes">' . _('Place An Order') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectOrderItems.php?' . SID . '&NewOrder=Yes">' . _('Place An Order') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectCompletedOrder.php?' . sid . '&SelectedCustomer=' . $_SESSION['CustomerID'] . '">' . _('Order Status') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '&SelectedCustomer=' . $_SESSION['CustomerID'] . '">' . _('Order Status') . '</a></p>'; ?> </td> </tr> </table> @@ -68,7 +67,7 @@ <table class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SupplierTenders.php?' . sid . '">' . _('Supplier Tenders') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SupplierTenders.php?' . SID . '">' . _('Supplier Tenders') . '</a></p>'; ?> </td> </tr> </table> @@ -96,9 +95,9 @@ $_SESSION['Module']=$ModuleLink[$i]; } if ($ModuleLink[$i] == $_SESSION['Module']){ - echo '<tr><td class="main_menu_selected"><a href="' . $_SERVER['PHP_SELF'] . '?' . sid . '&Application='. $ModuleLink[$i] . '">' . $ModuleList[$i] . '</a></td></tr>'; + echo '<tr><td class="main_menu_selected"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Application='. $ModuleLink[$i] . '">' . $ModuleList[$i] . '</a></td></tr>'; } else { - echo '<tr><td class="main_menu_unselected"><a href="' . $_SERVER['PHP_SELF'] . '?' . sid . '&Application='. $ModuleLink[$i] . '">' . $ModuleList[$i] . '</a></td></tr>'; + echo '<tr><td class="main_menu_unselected"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Application='. $ModuleLink[$i] . '">' . $ModuleList[$i] . '</a></td></tr>'; } } $i++; @@ -144,7 +143,7 @@ </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectSalesOrder.php?' . sid . '">' . _('Outstanding Sales Orders/Quotations') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">' . _('Outstanding Sales Orders/Quotations') . '</a></p>'; ?> </td> </tr> <tr> @@ -168,52 +167,52 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectCompletedOrder.php?' . sid . '">' . _('Order Inquiry') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '">' . _('Order Inquiry') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFPriceList.php?' . sid . '">' . _('Print Price Lists') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFPriceList.php?' . SID . '">' . _('Print Price Lists') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFOrderStatus.php?' . sid . '">' . _('Order Status Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFOrderStatus.php?' . SID . '">' . _('Order Status Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFOrdersInvoiced.php?' . sid . '">' . _('Orders Invoiced Reports') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFOrdersInvoiced.php?' . SID . '">' . _('Orders Invoiced Reports') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/DailySalesInquiry.php?' . sid . '">' . _('Daily Sales Inquiry') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/DailySalesInquiry.php?' . SID . '">' . _('Daily Sales Inquiry') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFDeliveryDifferences.php?' . sid . '">' . _('Order Delivery Differences Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFDeliveryDifferences.php?' . SID . '">' . _('Order Delivery Differences Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFDIFOT.php?' . sid . '">' . _('Delivery In Full On Time (DIFOT) Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFDIFOT.php?' . SID . '">' . _('Delivery In Full On Time (DIFOT) Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SalesInquiry.php?' . sid . '">' . _('Sales Order Detail Or Summary Inquiries') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SalesInquiry.php?' . SID . '">' . _('Sales Order Detail Or Summary Inquiries') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/TopItems.php?' . sid . '">' . _('Top Sales Items Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/TopItems.php?' . SID . '">' . _('Top Sales Items Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFLowGP.php?' . sid . '">' . _('Sales With Low Gross Profit Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFLowGP.php?' . SID . '">' . _('Sales With Low Gross Profit Report') . '</a></p>'; ?> </td> </tr> <tr> @@ -227,10 +226,18 @@ <td class="menu_group_items"> <!-- Orders Maintenance options --> <table width="100%"> <tr> - <td> - - </td> + <td class="menu_group_items"> + <table width="100%" class="table_index"> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SelectContract.php?' . SID . '">' . _('Select Contract') . '</a></p>'; ?> + </td> </tr> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/Contracts.php?' . SID . '">' . _('Create Contract') . '</a></p>'; ?> + </td> + </tr> </table> </td> </tr> @@ -261,7 +268,7 @@ <table width="100%"class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectSalesOrder.php?' . sid . '">' . _('Select Order to Invoice') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">' . _('Select Order to Invoice') . '</a></p>'; ?> </td> </tr> <tr> @@ -271,13 +278,13 @@ </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustomerReceipt.php?' . sid . '&NewReceipt=Yes">' . _('Enter Receipts') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/CustomerReceipt.php?' . SID . '&NewReceipt=Yes">' . _('Enter Receipts') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustomerAllocations.php?' . sid . '">' . _('Allocate Receipts or Credit Notes') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/CustomerAllocations.php?' . SID . '">' . _('Allocate Receipts or Credit Notes') . '</a></p>'; ?> </td> </tr> </table> @@ -286,68 +293,68 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectCustomer.php?' . sid . '">' . _('Customer Transaction Inquiries') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Customer Transaction Inquiries') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustWhereAlloc.php?' . sid . '">' . _('Where Allocated Inquiry') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/CustWhereAlloc.php?' . SID . '">' . _('Where Allocated Inquiry') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> <?php if ($_SESSION['InvoicePortraitFormat']==0){ - echo '<p>• <a href="' . $rootpath . '/PrintCustTrans.php?' . sid . '">' . _('Print Invoices or Credit Notes') . '</a></p>'; + echo '<p>• <a href="' . $rootpath . '/PrintCustTrans.php?' . SID . '">' . _('Print Invoices or Credit Notes') . '</a></p>'; } else { - echo '<p>• <a href="' . $rootpath . '/PrintCustTransPortrait.php?' . sid . '">' . _('Print Invoices or Credit Notes') . '</a></p>'; + echo '<p>• <a href="' . $rootpath . '/PrintCustTransPortrait.php?' . SID . '">' . _('Print Invoices or Credit Notes') . '</a></p>'; } ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PrintCustStatements.php?' . sid . '">' . _('Print Statements') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PrintCustStatements.php?' . SID . '">' . _('Print Statements') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SalesAnalRepts.php?' . sid . '">' . _('Sales Analysis Reports') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SalesAnalRepts.php?' . SID . '">' . _('Sales Analysis Reports') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/AgedDebtors.php?' . sid . '">' . _('Aged Customer Balances/Overdues Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/AgedDebtors.php?' . SID . '">' . _('Aged Customer Balances/Overdues Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustomerTransInquiry.php?' . sid . '">' . _('Transaction Inquiries') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/CustomerTransInquiry.php?' . SID . '">' . _('Transaction Inquiries') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFBankingSummary.php?' . sid . '">' . _('Re-Print A Deposit Listing') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFBankingSummary.php?' . SID . '">' . _('Re-Print A Deposit Listing') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/DebtorsAtPeriodEnd.php?' . sid . '">' . _('Debtor Balances At A Prior Month End') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/DebtorsAtPeriodEnd.php?' . SID . '">' . _('Debtor Balances At A Prior Month End') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFCustomerList.php?' . sid . '">' . _('Customer Listing By Area/Salesperson') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFCustomerList.php?' . SID . '">' . _('Customer Listing By Area/Salesperson') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SalesGraph.php?' . sid . '">' . _('Sales Graphs') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SalesGraph.php?' . SID . '">' . _('Sales Graphs') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFCustTransListing.php?' . sid . '">' . _('List Daily Transactions') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFCustTransListing.php?' . SID . '">' . _('List Daily Transactions') . '</a></p>'; ?> </td> </tr> <tr> @@ -361,12 +368,12 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/Customers.php?' . sid . '">' . _('Add Customer') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/Customers.php?' . SID . '">' . _('Add Customer') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectCustomer.php?' . sid . '">' . _('Customers') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Customers') . '</a></p>'; ?> </td> </tr> </table> @@ -396,12 +403,12 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectSupplier.php?' . sid . '">' . _('Select Supplier') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectSupplier.php?' . SID . '">' . _('Select Supplier') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . "/SupplierAllocations.php?" . sid . '">' . _('Supplier Allocations') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . "/SupplierAllocations.php?" . SID . '">' . _('Supplier Allocations') . '</a></p>'; ?> </td> </tr> </table> @@ -410,32 +417,32 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/AgedSuppliers.php?' . sid . '">' . _('Aged Supplier Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/AgedSuppliers.php?' . SID . '">' . _('Aged Supplier Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SuppPaymentRun.php?' . sid . '">' . _('Payment Run Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SuppPaymentRun.php?' . SID . '">' . _('Payment Run Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFRemittanceAdvice.php?' . sid . '">' . _('Remittance Advices') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFRemittanceAdvice.php?' . SID . '">' . _('Remittance Advices') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/OutstandingGRNs.php?' . sid . '">' . _('Outstanding GRNs Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/OutstandingGRNs.php?' . SID . '">' . _('Outstanding GRNs Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SupplierBalsAtPeriodEnd.php?' . sid . '">' . _('Supplier Balances At A Prior Month End') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SupplierBalsAtPeriodEnd.php?' . SID . '">' . _('Supplier Balances At A Prior Month End') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFSuppTransListing.php?' . sid . '">' . _('List Daily Transactions') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFSuppTransListing.php?' . SID . '">' . _('List Daily Transactions') . '</a></p>'; ?> </td> </tr> <tr> @@ -449,12 +456,12 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/Suppliers.php?' . sid . '">' . _('Add Supplier') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/Suppliers.php?' . SID . '">' . _('Add Supplier') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/Factors.php?' . sid . '">' . _('Maintain Factor Companies') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/Factors.php?' . SID . '">' . _('Maintain Factor Companies') . '</a></p>'; ?> </td> </tr> </table> @@ -482,32 +489,32 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?' . sid . '">' . _('Purchase Orders') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . '">' . _('Purchase Orders') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PO_Header.php?&NewOrder=Yes' . sid . '">' . _('Add Purchase Order') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PO_Header.php?&NewOrder=Yes' . SID . '">' . _('Add Purchase Order') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/OffersReceived.php?' . sid . '">' . _('Process Tenders and Offers') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/OffersReceived.php?' . SID . '">' . _('Process Tenders and Offers') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PO_AuthoriseMyOrders.php?' . sid . '">' . _('Orders to Authorise') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PO_AuthoriseMyOrders.php?' . SID . '">' . _('Orders to Authorise') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectSupplier.php?' . sid . '">' . _('Shipment Entry') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectSupplier.php?' . SID . '">' . _('Shipment Entry') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/Shipt_Select.php?' . sid . '">' . _('Select A Shipment') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/Shipt_Select.php?' . SID . '">' . _('Select A Shipment') . '</a></p>'; ?> </td> </tr> </table> @@ -516,12 +523,12 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectPurchOrder.php?' . sid . '">' . _('Purchase Order Inquiry') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectPurchOrder.php?' . SID . '">' . _('Purchase Order Inquiry') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/POReport.php?' . sid . '">' . _('Purchase Order Detail Or Summary Inquiries') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/POReport.php?' . SID . '">' . _('Purchase Order Detail Or Summary Inquiries') . '</a></p>'; ?> </td> </tr> <tr> @@ -561,37 +568,37 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?' . sid . '">' . _('Receive Purchase Orders') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . '">' . _('Receive Purchase Orders') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockLocTransfer.php' . sid . '">' . _('Bulk Inventory Transfer') . ' - ' . _('Dispatch') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockLocTransfer.php' . SID . '">' . _('Bulk Inventory Transfer') . ' - ' . _('Dispatch') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockLocTransferReceive.php?' . sid . '">' . _('Bulk Inventory Transfer') . ' - ' . _('Receive') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockLocTransferReceive.php?' . SID . '">' . _('Bulk Inventory Transfer') . ' - ' . _('Receive') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockTransfers.php?' . sid . '">' . _('Inventory Location Transfers') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockTransfers.php?' . SID . '">' . _('Inventory Location Transfers') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockAdjustments.php?NewAdjustment=Yes' . sid . '">' . _('Inventory Adjustments') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockAdjustments.php?NewAdjustment=Yes' . SID . '">' . _('Inventory Adjustments') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/ReverseGRN.php?' . sid . '">' . _('Reverse Goods Received') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/ReverseGRN.php?' . SID . '">' . _('Reverse Goods Received') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockCounts.php?' . sid . '">' . _('Enter Stock Counts') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockCounts.php?' . SID . '">' . _('Enter Stock Counts') . '</a></p>'; ?> </td> </tr> </table> @@ -600,87 +607,87 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . "/StockSerialItemResearch.php?" . sid . '">' . _('Serial Item Research Tool') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . "/StockSerialItemResearch.php?" . SID . '">' . _('Serial Item Research Tool') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . "/StockMovements.php?" . sid . '">' . _('Inventory Item Movements') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . "/StockMovements.php?" . SID . '">' . _('Inventory Item Movements') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockStatus.php?' . sid . '">' . _('Inventory Item Status') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockStatus.php?' . SID . '">' . _('Inventory Item Status') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockUsage.php?' . sid . '">' . _('Inventory Item Usage') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockUsage.php?' . SID . '">' . _('Inventory Item Usage') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/InventoryQuantities.php?' . sid . '">' . _('Inventory Quantities') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/InventoryQuantities.php?' . SID . '">' . _('Inventory Quantities') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/ReorderLevel.php?' . sid . '">' . _('Reorder Level') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/ReorderLevel.php?' . SID . '">' . _('Reorder Level') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockDispatch.php?' . sid . '">' . _('Stock Dispatch') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockDispatch.php?' . SID . '">' . _('Stock Dispatch') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/InventoryValuation.php?' . sid . '">' . _('Inventory Valuation Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/InventoryValuation.php?' . SID . '">' . _('Inventory Valuation Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/InventoryPlanning.php?' . sid . '">' . _('Inventory Planning Report') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/InventoryPlanning.php?' . SID . '">' . _('Inventory Planning Report') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/InventoryPlanningPrefSupplier.php?' . sid . '">' . _('Inventory Planning Based On Preferred Supplier Data') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/InventoryPlanningPrefSupplier.php?' . SID . '">' . _('Inventory Planning Based On Preferred Supplier Data') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockCheck.php?' . sid . '">' . _('Inventory Stock Check Sheets') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockCheck.php?' . SID . '">' . _('Inventory Stock Check Sheets') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockQties_csv.php?' . sid . '">' . _('Make Inventory Quantities CSV') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockQties_csv.php?' . SID . '">' . _('Make Inventory Quantities CSV') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFStockCheckComparison.php?' . sid . '">' . _('Compare Counts Vs Stock Check Data') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFStockCheckComparison.php?' . SID . '">' . _('Compare Counts Vs Stock Check Data') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockLocMovements.php?' . sid . '">' . _('All Inventory Movements By Location/Date') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockLocMovements.php?' . SID . '">' . _('All Inventory Movements By Location/Date') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockLocStatus.php?' . sid . '">' . _('List Inventory Status By Location/Category') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockLocStatus.php?' . SID . '">' . _('List Inventory Status By Location/Category') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/StockQuantityByDate.php?' . sid . '">' . _('Historical Stock Quantity By Location/Category') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/StockQuantityByDate.php?' . SID . '">' . _('Historical Stock Quantity By Location/Category') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFStockNegatives.php?' . sid . '">' . _('List Negative Stocks') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFStockNegatives.php?' . SID . '">' . _('List Negative Stocks') . '</a></p>'; ?> </td> </tr> <tr> @@ -694,32 +701,32 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/Stocks.php?' . sid . '">' . _('Add A New Item') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/Stocks.php?' . SID . '">' . _('Add A New Item') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectProduct.php?' . sid . '">' . _('Select An Item') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Select An Item') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SalesCategories.php?' . sid . '">' . _('Sales Category Maintenance') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/SalesCategories.php?' . SID . '">' . _('Sales Category Maintenance') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PricesBasedOnMarkUp.php?' . sid . '">' . _('Add or Update Prices Based On Costs') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PricesBasedOnMarkUp.php?' . SID . '">' . _('Add or Update Prices Based On Costs') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PricesByCost.php?' . sid . '">' . _('View or Update Prices Based On Costs') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PricesByCost.php?' . SID . '">' . _('View or Update Prices Based On Costs') . '</a></p>'; ?> </td> </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/ReorderLevelLocation.php?' . sid . '">' . _('Reorder Level By Category/Location') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/ReorderLevelLocation.php?' . SID . '">' . _('Reorder Level By Category/Location') . '</a></p>'; ?> </td> ... [truncated message content] |
From: <dai...@us...> - 2010-08-15 09:26:09
|
Revision: 3693 http://web-erp.svn.sourceforge.net/web-erp/?rev=3693&view=rev Author: daintree Date: 2010-08-15 09:26:03 +0000 (Sun, 15 Aug 2010) Log Message: ----------- to be doubly sure Modified Paths: -------------- trunk/ContractCosting.php trunk/Contracts.php trunk/SelectContract.php trunk/includes/Contract_Readin.php Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2010-08-15 09:22:08 UTC (rev 3692) +++ trunk/ContractCosting.php 2010-08-15 09:26:03 UTC (rev 3693) @@ -1,6 +1,6 @@ <?php -/* $Id: $*/ +/* $Id: ContractCosting.php 3692 2010-08-15 09:22:08Z daintree $*/ $PageSecurity = 6; include('includes/DefineContractClass.php'); Modified: trunk/Contracts.php =================================================================== --- trunk/Contracts.php 2010-08-15 09:22:08 UTC (rev 3692) +++ trunk/Contracts.php 2010-08-15 09:26:03 UTC (rev 3693) @@ -1,6 +1,6 @@ <?php -/* $Id: $ */ +/* $Id: Contracts.php 3692 2010-08-15 09:22:08Z daintree $ */ $PageSecurity = 6; include('includes/DefineContractClass.php'); Modified: trunk/SelectContract.php =================================================================== --- trunk/SelectContract.php 2010-08-15 09:22:08 UTC (rev 3692) +++ trunk/SelectContract.php 2010-08-15 09:26:03 UTC (rev 3693) @@ -1,6 +1,6 @@ <?php -/* $Id: $*/ +/* $Id: SelectContract.php 3692 2010-08-15 09:22:08Z daintree $*/ $PageSecurity = 6; Modified: trunk/includes/Contract_Readin.php =================================================================== --- trunk/includes/Contract_Readin.php 2010-08-15 09:22:08 UTC (rev 3692) +++ trunk/includes/Contract_Readin.php 2010-08-15 09:26:03 UTC (rev 3693) @@ -1,5 +1,5 @@ <?php -/* $Id: $ */ +/* $Id: Contract_Readin.php 3692 2010-08-15 09:22:08Z daintree $ */ /*Contract_Readin.php is used by the modify existing Contract in Contracts.php and also by ContractCosting.php */ $ContractHeaderSQL = "SELECT contractdescription, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-18 17:27:24
|
Revision: 3694 http://web-erp.svn.sourceforge.net/web-erp/?rev=3694&view=rev Author: tim_schofield Date: 2010-08-18 17:27:18 +0000 (Wed, 18 Aug 2010) Log Message: ----------- Paul Thursby: PO_Items.php - Eliminate query; Moves the ONE field into a query above this point. Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log.html Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-08-15 09:26:03 UTC (rev 3693) +++ trunk/PO_Items.php 2010-08-18 17:27:18 UTC (rev 3694) @@ -267,7 +267,8 @@ supptel='" . $_SESSION['PO'.$identifier]->supptel . "', contact='" . $_SESSION['PO'.$identifier]->contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->paymentterms . "', - allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "' + allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', + status = '" . PurchOrder::STATUS_PENDING . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); @@ -276,9 +277,6 @@ /*Now Update the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { - $sql="UPDATE purchorders - SET status = '" . PurchOrder::STATUS_PENDING . "' - WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo . "'"; $result=DB_query($sql,$db,'','',true); if ($POLine->Deleted==true) { if ($POLine->PODetailRec!='') { Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-15 09:26:03 UTC (rev 3693) +++ trunk/doc/Change.log.html 2010-08-18 17:27:18 UTC (rev 3694) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>18/08/10 Paul Thursby: PO_Items.php - Eliminate query; Moves the ONE field into a query above this point.</p> <p>15/08/10 Phil: Decided to have contracts as part of orders module since not really enough links to warrant a new module changes to index.php WWW_Users.php and sql upgrade. <p>15/08/10 Phil: New script for ContractCosting.php comparison of contract costs budgeted vs incurred. Lot of work on contracts <p>13/08/10 Phil: DefineSuppTransClass.php SupplierInvoice.php and SupplierCredit.php now allow entry of contract charges. New script for SuppContractChgs.php This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-08-18 19:26:35
|
Revision: 3695 http://web-erp.svn.sourceforge.net/web-erp/?rev=3695&view=rev Author: tim_schofield Date: 2010-08-18 19:26:27 +0000 (Wed, 18 Aug 2010) Log Message: ----------- Pak Ricard: Revised report writer with the ability for more fields Modified Paths: -------------- trunk/doc/Change.log.html trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php trunk/reportwriter/WriteForm.inc trunk/reportwriter/WriteReport.inc trunk/reportwriter/admin/RCFunctions.inc trunk/reportwriter/admin/ReportCreator.php trunk/reportwriter/admin/defaults.php trunk/reportwriter/admin/forms/ReportsFieldSetup.html trunk/reportwriter/admin/forms/ReportsID.html trunk/reportwriter/admin/forms/ReportsPageSetup.html trunk/reportwriter/install/ReportListForm.php trunk/reportwriter/install/ReportListLinks.php trunk/reportwriter/languages/en_US/reports.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/doc/Change.log.html 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>18/08/10 Pak Ricard: Revised report writer with the ability for more fields</p> <p>18/08/10 Paul Thursby: PO_Items.php - Eliminate query; Moves the ONE field into a query above this point.</p> <p>15/08/10 Phil: Decided to have contracts as part of orders module since not really enough links to warrant a new module changes to index.php WWW_Users.php and sql upgrade. <p>15/08/10 Phil: New script for ContractCosting.php comparison of contract costs budgeted vs incurred. Lot of work on contracts Modified: trunk/reportwriter/FormMaker.php =================================================================== --- trunk/reportwriter/FormMaker.php 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/FormMaker.php 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,18 +1,16 @@ <?php +/* $Revision: 1.3 $ */ -/* $Id$ */ - $DirectoryLevelsDeep = 1; $PathPrefix = '../'; $PageSecurity = 1; // set security level for webERP require($PathPrefix . 'includes/session.inc'); // TBD The followiung line needs to be replace when more translations are available -$ReportLanguage = 'en_US'; // default language file -define('DBReports','reports'); // name of the databse holding the main report information (ReportID) +$ReportLanguage = 'en_US'; // default language file +define('DBReports','reports'); // name of the databse holding the main report information (ReportID) define('DBRptFields','reportfields'); // name of the database holding the report fields -// Javier -// define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory +define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory define('DefRptPath',$PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/reportwriter/'); // path to default reports // Fetch necessary include files - Host application specific (webERP) require_once($PathPrefix . 'includes/DateFunctions.inc'); @@ -100,9 +98,7 @@ } } // else use default settings, i.e. no overrides // All done with setup, build the form -// Javier -// require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports - require($PathPrefix . 'includes/class.pdf.php'); // Cpdf TCPDF class to generate reports + require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports require('WriteForm.inc'); // build the pdf pages (this function exits the script if successful; otherwise returns with error) $success = BuildPDF($ReportID, $Prefs); // build and output form, should not return from this function @@ -237,4 +233,4 @@ return $CriteriaString; } -?> +?> \ No newline at end of file Modified: trunk/reportwriter/ReportMaker.php =================================================================== --- trunk/reportwriter/ReportMaker.php 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/ReportMaker.php 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,7 +1,5 @@ <?php - -/* $Id$ */ - +/* $Revision: 1.7 $ */ $DirectoryLevelsDeep =1; $PathPrefix = '../'; $PageSecurity = 1; // set security level for webERP @@ -11,8 +9,7 @@ define('DBReports','reports'); // name of the databse holding the main report information (ReportID) define('DBRptFields','reportfields'); // name of the database holding the report fields -// Javier -// define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory +define('FPDF_FONTPATH','../fonts/'); // FPDF path to fonts directory // Fetch necessary include files - Host application specific (webERP) require($PathPrefix . 'includes/session.inc'); @@ -134,9 +131,7 @@ case RPT_BTN_EXPPDF: $Prefs = ReadPostData($ReportID, $Prefs); // include the necessary files to build report -// Javier -// require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports - require($PathPrefix . 'includes/class.pdf.php'); // Cpdf TCPDF class to generate reports + require($PathPrefix . 'includes/fpdf.php'); // FPDF class to generate reports require('WriteReport.inc'); $ReportData = ''; $success = BuildSQL($Prefs); @@ -257,7 +252,10 @@ return $FieldListings; } -function ChangeSequence($ReportID, $SeqNum, $EntryType, $UpDown) { +function ChangeSequence($ReportID, + $SeqNum, + $EntryType, + $UpDown) { global $db; // find the id of the row to move $sql = "SELECT id FROM ".DBRptFields." @@ -476,7 +474,19 @@ col5width = ".$_POST['Col5Width'].", col6width = ".$_POST['Col6Width'].", col7width = ".$_POST['Col7Width'].", - col8width = ".$_POST['Col8Width']." + col8width = ".$_POST['Col8Width'].", + col9width = ".$_POST['Col9Width'].", + col10width = ".$_POST['Col10Width'].", + col11width = ".$_POST['Col11Width'].", + col12width = ".$_POST['Col12Width'].", + col13width = ".$_POST['Col13Width'].", + col14width = ".$_POST['Col14Width'].", + col15width = ".$_POST['Col15Width'].", + col16width = ".$_POST['Col16Width'].", + col17width = ".$_POST['Col17Width'].", + col18width = ".$_POST['Col18Width'].", + col19width = ".$_POST['Col19Width'].", + col20width = ".$_POST['Col20Width'].", WHERE id =".$ReportID.";"; $Result=DB_query($sql,$db,'','',false,true); return true; @@ -553,4 +563,4 @@ $Rtn['result'] = 'success'; return $Rtn; } -?> +?> \ No newline at end of file Modified: trunk/reportwriter/WriteForm.inc =================================================================== --- trunk/reportwriter/WriteForm.inc 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/WriteForm.inc 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,8 +1,16 @@ <?php +// for compatability with extended char sets +if ($_SESSION['Language']=='zh_CN'){ + include($PathPrefix . 'includes/FPDF_Chinese.php'); +} elseif ($_SESSION['Language']=='ja_JP'){ + include($PathPrefix . 'includes/FPDF_Japanese.php'); +} elseif ($_SESSION['Language']=='ko_KR'){ + include($PathPrefix . 'includes/FPDF_Korean.php'); +} else { + class PDF_Language extends FPDF { } +} -/* $Id$ */ - -class PDF extends Cpdf { +class PDF extends PDF_Language { var $y0; // current y position var $x0; // current x position var $pageY; // y value of bottom of page less bottom margin @@ -12,10 +20,7 @@ global $Prefs; define('RowSpace',2); // define separation between the heading rows $PaperSize = explode(':',$Prefs['papersize']); -// $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]); This was the calling used -// __construct($DocOrientation='P', $DocUnits='mm', $DocPaper='A4'); This is the actual contructor - parent::__construct($Prefs['paperorientation'], 'mm', $PaperSize[0]); - + $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]); if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height $this->pageY = $PaperSize[2]-$Prefs['marginbottom']; } else { // Landscape @@ -23,12 +28,19 @@ } $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']); $this->SetAutoPageBreak(0, $Prefs['marginbottom']); + $this->SetFont('Helvetica'); $this->SetDrawColor(128,0,0); $this->SetLineWidth(.35); // 1 point -// Javier $this->SetFont('Helvetica'); + + if ($_SESSION['Language']=='zh_CN'){ + $this->AddBig5Font(); + } elseif ($_SESSION['Language']=='ja_JP'){ + $this->AddSJISFont(); + } elseif ($_SESSION['Language']=='ko_KR'){ + $this->AddUHCFont(); + } } - function Header() { // prints all static information on the page global $FieldListings, $FieldValues; $i=0; // set sequence to pull data fields should be sorted by seqnum @@ -79,10 +91,7 @@ $Params['BoxHeight'] = '20'; } $this->SetXY($Params['LineXStrt'],$Params['LineYStrt']); - -// Javier $this->SetFont('Helvetica', '', '10'); - $this->SetFont('', '', '10'); - + $this->SetFont('Helvetica','','10'); $this->SetTextColor(255,0,0); $this->SetDrawColor(255,0,0); $this->SetLineWidth(0.35); @@ -140,11 +149,7 @@ function FormText($Params) { if (!isset($Params['LineXStrt'])) return; // don't do anything if data array has not been set $this->SetXY($Params['LineXStrt'],$Params['LineYStrt']); - -// Javier: CJK don't have the choice to select a font -// $this->SetFont($Params['Font'],'',$Params['FontSize']); - $this->SetFont('', '', $Params['FontSize']); - + $this->SetFont($Params['Font'],'',$Params['FontSize']); if ($Params['Color']=='2') $RGB=$Params['FontRed'].':'.$Params['FontGreen'].':'.$Params['FontBlue']; else $RGB=$Params['FontColor']; $FC = explode(':',$RGB); @@ -221,11 +226,7 @@ if ($Params['Seq'][$Col]['TblShow']) { $this->SetLeftMargin($NextXPos); $this->SetXY($NextXPos, $this->y0); - -// Javier: CJK don't have the choice to select a font -// $this->SetFont($Params['Seq'][$Col]['Font'], '', $Params['Seq'][$Col]['FontSize']); - $this->SetFont('', '', $Params['Seq'][$Col]['FontSize']); - + $this->SetFont($Params['Seq'][$Col]['Font'],'',$Params['Seq'][$Col]['FontSize']); $TC = explode(':',$Params['Seq'][$Col]['FontColor']); $this->SetTextColor($TC[0],$TC[1],$TC[2]); $CellHeight = ($Params['Seq'][$Col]['FontSize']+RowSpace)*0.35; @@ -597,11 +598,9 @@ } } // Add additional headers needed for MSIE and send page - -// Javier: TCPDF sends its own http header -/* header('Pragma: cache'); + header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); -*/ $pdf->Output($Prefs['reportname'].'.pdf','D'); + $pdf->Output($Prefs['reportname'].'.pdf','D'); exit(); // needs to be here to properly render the pdf file. } @@ -617,4 +616,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/reportwriter/WriteReport.inc =================================================================== --- trunk/reportwriter/WriteReport.inc 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/WriteReport.inc 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,283 +1,277 @@ -<?php +<?PHP +// for compatability with extended char sets +if ($_SESSION['Language']=='zh_CN'){ + include($PathPrefix . 'includes/FPDF_Chinese.php'); +} elseif ($_SESSION['Language']=='ja_JP'){ + include($PathPrefix . 'includes/FPDF_Japanese.php'); +} elseif ($_SESSION['Language']=='ko_KR'){ + include($PathPrefix . 'includes/FPDF_Korean.php'); +} else { + class PDF_Language extends FPDF { } +} -/* $Id$ */ +class PDF extends PDF_Language { -class PDF extends Cpdf { +var $y0; // current y position +var $x0; // current x position +var $pageY; // y value of bottom of page less bottom margin - var $y0; // current y position - var $x0; // current x position - var $pageY; // y value of bottom of page less bottom margin +function PDF() { + global $Prefs; + $PaperSize = explode(':',$Prefs['papersize']); + $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]); + if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height + $this->pageY = $PaperSize[2]-$Prefs['marginbottom']; + } else { // Landscape + $this->pageY = $PaperSize[1]-$Prefs['marginbottom']; + } + $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']); + $this->SetAutoPageBreak(0, $Prefs['marginbottom']); + $this->SetFont($Prefs['coynamefont']); + $this->SetDrawColor(128,0,0); + $this->SetLineWidth(.35); // 1 point + $this->AliasNbPages(); + $this->AddPage(); - function PDF() { - global $Prefs; - $PaperSize = explode(':',$Prefs['papersize']); -// $this->PDF_Language($Prefs['paperorientation'], 'mm', $PaperSize[0]); -// __construct($DocOrientation='P', $DocUnits='mm', $DocPaper='A4'); - parent::__construct($Prefs['paperorientation'], 'mm', $PaperSize[0]); - - if ($Prefs['paperorientation']=='P') { // Portrait - calculate max page height - $this->pageY = $PaperSize[2]-$Prefs['marginbottom']; - } else { // Landscape - $this->pageY = $PaperSize[1]-$Prefs['marginbottom']; - } - $this->SetMargins($Prefs['marginleft'], $Prefs['margintop'], $Prefs['marginright']); - $this->SetAutoPageBreak(0, $Prefs['marginbottom']); - $this->SetDrawColor(128,0,0); - $this->SetLineWidth(.35); // 1 point - $this->AliasNbPages(); - $this->AddPage(); -// Javier $this->SetFont($Prefs['coynamefont']); + if ($_SESSION['Language']=='zh_CN'){ + $this->AddBig5Font(); + } elseif ($_SESSION['Language']=='zh_HK'){ + $this->AddCIDFont(); + } elseif ($_SESSION['Language']=='ja_JP'){ + $this->AddSJISFont(); + } elseif ($_SESSION['Language']=='ko_KR'){ + $this->AddUHCFont(); } +} - - function Header() { - global $Prefs, $Heading, $Seq; - define(RowSpace,2); // define separation between the heading rows - - if ($Prefs['coynameshow']) { // Show the company name - -// Javier: $this->SetFont($Prefs['coynamefont'], 'B', $Prefs['coynamefontsize']); - $this->SetFont('', 'B', $Prefs['coynamefontsize']); - - $Colors = explode(':',$Prefs['coynamefontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']); - } - if ($Prefs['title1show']) { // Set title 1 heading - -// Javier $this->SetFont($Prefs['title1font'], '', $Prefs['title1fontsize']); - $this->SetFont('', '', $Prefs['title1fontsize']); - $Colors = explode(':',$Prefs['title1fontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']); - } - - if ($Prefs['title2show']) { // Set Title 2 heading -// Javier $this->SetFont($Prefs['title2font'], '', $Prefs['title2fontsize']); - $this->SetFont('', '', $Prefs['title2fontsize']); - $Colors = explode(':',$Prefs['title2fontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35; - $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']); - } - // Set the filter heading - -// Javier $this->SetFont($Prefs['filterfont'], '', $Prefs['filterfontsize']); - $this->SetFont('', '', $Prefs['filterfontsize']); - - $Colors = explode(':',$Prefs['filterfontcolor']); +function Header() { + global $Prefs, $Heading, $Seq; + define(RowSpace,2); // define separation between the heading rows + if ($Prefs['coynameshow']) { // Show the company name + $this->SetFont($Prefs['coynamefont'],'B',$Prefs['coynamefontsize']); + $Colors = explode(':',$Prefs['coynamefontcolor']); $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm - $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']); - $this->y0=$this->GetY(); // set y position after report headings before column titles - // Set the table header - -// Javier $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']); - $this->SetFont('','',$Prefs['datafontsize']); - - $Colors = explode(':',$Prefs['datafontcolor']); + $CellHeight = ($Prefs['coynamefontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$_SESSION['CompanyRecord']['coyname'],0,1,$Prefs['coynamealign']); + } + if ($Prefs['title1show']) { // Set title 1 heading + $this->SetFont($Prefs['title1font'],'',$Prefs['title1fontsize']); + $Colors = explode(':',$Prefs['title1fontcolor']); $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $this->SetDrawColor(128,0,0); - $this->SetLineWidth(.35); // 1 point - $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; - // fetch the column widths and put into array to match the columns of data - $CellXPos[0] = $Prefs['marginleft']; - for ($x=1; $x<=8; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; - // Fetch the column break array - foreach ($Seq as $Temp) if ($Temp['break']) $ColBreak[] = true; else $ColBreak[] = false; - // See if we need to truncate the data - if ($Prefs['TruncListings']['params']=='1') $trunc=true; else $trunc=false; - // Ready to draw the column titles in the header - $maxY = $this->y0; // set to track the tallest column - $col = 1; - $LastY = $this->y0; - foreach ($Heading as $key=>$value) { - $this->SetLeftMargin($CellXPos[$col-1]); - $this->SetX($CellXPos[$col-1]); - $this->SetY($LastY); - // truncate data if selected - if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); - $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value); - if ($ColBreak[$key]) { - $col++; - $LastY = $this->y0; - } else $LastY = $this->GetY(); - if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height - } - // Draw a bottom line for the end of the heading - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->Cell(0,$maxY-$this->y0,' ','B'); - $this->y0=$maxY+0.35; + $CellHeight = ($Prefs['title1fontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title1desc']),0,1,$Prefs['title1fontalign']); } - - function SubTitle($Title) { - global $Prefs; - // substitutes a command string with current information - $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title); - $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title); - return $Title; + if ($Prefs['title2show']) { // Set Title 2 heading + $this->SetFont($Prefs['title2font'],'',$Prefs['title2fontsize']); + $Colors = explode(':',$Prefs['title2fontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['title2fontsize']+RowSpace)*0.35; + $this->Cell(0,$CellHeight,$this->SubTitle($Prefs['title2desc']),0,1,$Prefs['title2fontalign']); } - - function Footer() { - //Position at 1.5 cm from bottom - $this->SetY(-15); - //Arial italic 8 - -// Javier $this->SetFont('Helvetica', '', 8); - $this->SetFont('','', 8); - - $this->SetTextColor(0); - //Page number - $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); + // Set the filter heading + $this->SetFont($Prefs['filterfont'],'',$Prefs['filterfontsize']); + $Colors = explode(':',$Prefs['filterfontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['filterfontsize']+RowSpace)*0.35; // convert points to mm + $this->MultiCell(0,$CellHeight,$Prefs['filterdesc'],'B',1,$Prefs['filterfontalign']); + $this->y0=$this->GetY(); // set y position after report headings before column titles + // Set the table header + $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']); + $Colors = explode(':',$Prefs['datafontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $this->SetDrawColor(128,0,0); + $this->SetLineWidth(.35); // 1 point + $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; + // fetch the column widths and put into array to match the columns of data + $CellXPos[0] = $Prefs['marginleft']; + for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; + // Fetch the column break array + foreach ($Seq as $Temp) if ($Temp['break']) $ColBreak[] = true; else $ColBreak[] = false; + // See if we need to truncate the data + if ($Prefs['TruncListings']['params']=='1') $trunc=true; else $trunc=false; + // Ready to draw the column titles in the header + $maxY = $this->y0; // set to track the tallest column + $col = 1; + $LastY = $this->y0; + foreach ($Heading as $key=>$value) { + $this->SetLeftMargin($CellXPos[$col-1]); + $this->SetX($CellXPos[$col-1]); + $this->SetY($LastY); + // truncate data if selected + if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); + $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value); + if ($ColBreak[$key]) { + $col++; + $LastY = $this->y0; + } else $LastY = $this->GetY(); + if ($this->GetY()>$maxY) $maxY = $this->GetY(); // check for new col max height } + // Draw a bottom line for the end of the heading + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->Cell(0,$maxY-$this->y0,' ','B'); + $this->y0=$maxY+0.35; +} - function ReportTable($Data) { - global $Prefs, $Seq; +function SubTitle($Title) { + global $Prefs; + // substitutes a command string with current information + $Title=preg_replace('/%date%/', date('Y-m-d',time()), $Title); + $Title=preg_replace('/%reportname%/', $Prefs['reportname'], $Title); + return $Title; +} - $FillColor = array(224, 235, 255); +function Footer() { + //Position at 1.5 cm from bottom + $this->SetY(-15); + //Arial italic 8 + $this->SetFont('Helvetica','',8); + $this->SetTextColor(0); + //Page number + $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); +} -// Javier $this->SetFont($Prefs['datafont'], '', $Prefs['datafontsize']); - $this->SetFont('','', $Prefs['datafontsize']); +function ReportTable($Data) { + global $Prefs, $Seq; - $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); - $Colors = explode(':',$Prefs['datafontcolor']); - $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); - $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; - // Fetch the column widths and put into array to match the columns of data - $CellXPos[0] = $Prefs['marginleft']; - for ($x=1; $x<=8; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; - // Fetch the column break array - foreach ($Seq as $Temp) { - if ($Temp['break']){ - $ColBreak[] = true; - } else { - $ColBreak[] = false; - } - } - // See if we need to truncate the data - if ($Prefs['TruncListings']['params']=='1') { - $trunc=true; + $FillColor = array(224, 235, 255); + $this->SetFont($Prefs['datafont'],'',$Prefs['datafontsize']); + $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); + $Colors = explode(':',$Prefs['datafontcolor']); + $this->SetTextColor($Colors[0], $Colors[1], $Colors[2]); + $CellHeight = ($Prefs['datafontsize']+RowSpace)*0.35; + // Fetch the column widths and put into array to match the columns of data + $CellXPos[0] = $Prefs['marginleft']; + for ($x=1; $x<=20; $x++) $CellXPos[$x] = $CellXPos[$x-1] + $Prefs['col'.$x.'width']; + // Fetch the column break array + foreach ($Seq as $Temp) { + if ($Temp['break']){ + $ColBreak[] = true; } else { - $trunc=false; + $ColBreak[] = false; } - // Ready to draw the column data - $fill=false; - $NeedTop='No'; - $MaxRowHt = 0; //track the tallest row to estimate page breaks - foreach($Data as $myrow) { - $Action = array_shift($myrow); - $todo = explode(':',$Action); // contains a letter of the date type and title/groupname - switch ($todo[0]) { - case "r": // Report Total - case "g": // Group Total - // Draw a fill box - if ($this->y0+(2*$MaxRowHt)>$this->pageY) { - // Fill the end of the report with white space - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); - $this->AddPage(); - $MaxRowHt=0; - } + } + // See if we need to truncate the data + if ($Prefs['TruncListings']['params']=='1') { + $trunc=true; + } else { + $trunc=false; + } + // Ready to draw the column data + $fill=false; + $NeedTop='No'; + $MaxRowHt = 0; //track the tallest row to estimate page breaks + foreach($Data as $myrow) { + $Action = array_shift($myrow); + $todo = explode(':',$Action); // contains a letter of the date type and title/groupname + switch ($todo[0]) { + case "r": // Report Total + case "g": // Group Total + // Draw a fill box + if ($this->y0+(2*$MaxRowHt)>$this->pageY) { + // Fill the end of the report with white space $this->SetLeftMargin($CellXPos[0]); $this->SetX($CellXPos[0]); $this->SetY($this->y0); - $this->SetFillColor(240); - $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); - // Add total heading + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); + $this->AddPage(); + $MaxRowHt=0; + } + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->SetFillColor(240); + $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); + // Add total heading + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report'; + $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C'); + $this->y0=$this->GetY()+0.35; + $NeedTop = 'Next'; + $fill=false; // set so totals data will not be filled + // now fall into the 'd' case to show the data + case "d": // data element + default: + // figure out if a border needs to be drawn for total separation + // and fill color (draws an empty box over the row just written with the fill color) + $brdr = 0; + if ($NeedTop=='Yes') { + $brdr='T'; + $fill=false; // set so first data after total will not be filled + $NeedTop='No'; + } elseif ($NeedTop=='Next') { + $brdr='LR'; + $NeedTop='Yes'; + } + // Draw a fill box + if (($this->y0+$MaxRowHt)>$this->pageY) { + // Fill the end of the report with white space $this->SetLeftMargin($CellXPos[0]); $this->SetX($CellXPos[0]); $this->SetY($this->y0); - if ($todo[0]=='g') $Desc = 'Group'; else $Desc = 'Report'; - $this->Cell(0,$CellHeight,$Desc.' Total For: '.$todo[1],1,1,'C'); - $this->y0=$this->GetY()+0.35; - $NeedTop = 'Next'; - $fill=false; // set so totals data will not be filled - // now fall into the 'd' case to show the data - case "d": // data element - default: - // figure out if a border needs to be drawn for total separation - // and fill color (draws an empty box over the row just written with the fill color) - $brdr = 0; - if ($NeedTop=='Yes') { - $brdr='T'; - $fill=false; // set so first data after total will not be filled - $NeedTop='No'; - } elseif ($NeedTop=='Next') { - $brdr='LR'; - $NeedTop='Yes'; - } - // Draw a fill box - if (($this->y0+$MaxRowHt)>$this->pageY) { - // Fill the end of the report with white space - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); - $this->AddPage(); - $MaxRowHt=0; - } - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); - // fill in the data - $maxY = $this->y0; // set to current top of row - $col = 1; - $LastY = $this->y0; - foreach ($myrow as $key=>$value) { - $this->SetLeftMargin($CellXPos[$col-1]); - $this->SetX($CellXPos[$col-1]); - $this->SetY($LastY); - // truncate data if necessary - if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); - $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0); - if ($ColBreak[$key]) { - $col++; - $LastY = $this->y0; - } else $LastY = $this->GetY(); - if ($this->GetY()>$maxY) $maxY = $this->GetY(); - } - $this->SetLeftMargin($CellXPos[0]); // restore left margin - break; - } - $ThisRowHt=$maxY-$this->y0; // seee how tall this row was - if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination - $this->y0=$maxY; // set y position to largest value for next row - $fill=!$fill; + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','',0,'L',1); + $this->AddPage(); + $MaxRowHt=0; + } + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + if ($fill) $this->SetFillColor($FillColor[0],$FillColor[1],$FillColor[2]); else $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'',$brdr,0,'L',1); + // fill in the data + $maxY = $this->y0; // set to current top of row + $col = 1; + $LastY = $this->y0; + foreach ($myrow as $key=>$value) { + $this->SetLeftMargin($CellXPos[$col-1]); + $this->SetX($CellXPos[$col-1]); + $this->SetY($LastY); + // truncate data if necessary + if ($trunc) $value=$this->TruncData($value, $Prefs['col'.$col.'width']); + $this->MultiCell($CellXPos[$col]-$CellXPos[$col-1],$CellHeight,$value,0); + if ($ColBreak[$key]) { + $col++; + $LastY = $this->y0; + } else $LastY = $this->GetY(); + if ($this->GetY()>$maxY) $maxY = $this->GetY(); + } + $this->SetLeftMargin($CellXPos[0]); // restore left margin + break; } - // Fill the end of the report with white space - $this->SetLeftMargin($CellXPos[0]); - $this->SetX($CellXPos[0]); - $this->SetY($this->y0); - $this->SetFillColor(255); - $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1); - } + $ThisRowHt=$maxY-$this->y0; // seee how tall this row was + if ($ThisRowHt>$MaxRowHt) $MaxRowHt = $ThisRowHt; // keep that largest row so far to track pagination + $this->y0=$maxY; // set y position to largest value for next row + $fill=!$fill; + } + // Fill the end of the report with white space + $this->SetLeftMargin($CellXPos[0]); + $this->SetX($CellXPos[0]); + $this->SetY($this->y0); + $this->SetFillColor(255); + $this->Cell(0,$this->pageY-$this->y0,'','T',0,'L',1); +} - function TruncData($strData, $ColWidth) { - $percent=0.90; //percent to truncate from max to account for proportional spacing - $CurWidth = $this->GetStringWidth($strData); - if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated - // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance - // A better aproach would be an recursive call to this function until the string just fits. - $NumChars = strlen($strData); - // Reduce the string by 1-$percent and retest - $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth); - } - return $strData; +function TruncData($strData, $ColWidth) { + $percent=0.90; //percent to truncate from max to account for proportional spacing + $CurWidth = $this->GetStringWidth($strData); + if ($CurWidth>($ColWidth*.90)) { // then it needs to be truncated + // for now we'll do an approximation based on averages and scale to 90% of the width to allow for variance + // A better aproach would be an recursive call to this function until the string just fits. + $NumChars = strlen($strData); + // Reduce the string by 1-$percent and retest + $strData = $this->TruncData(substr($strData, 0, ($ColWidth/$CurWidth)*$NumChars*$percent), $ColWidth); } + return $strData; +} - function Stream($FileName) { - $this->Output($FileName,'D'); - } +function Stream($FileName) { + $this->Output($FileName,'D'); +} } // end class @@ -600,22 +594,18 @@ function GeneratePDFFile($Data, $Prefs) { $pdf=new PDF(); $pdf->ReportTable($Data); -// Javier: TCPDF flush buffers so this actually would produce the pdf creation -/* $pdfcode = $pdf->output(); + $pdfcode = $pdf->output(); $len = strlen($pdfcode); -*/ $ReportName = ReplaceNonAllowedCharacters($Prefs['reportname']) .'.pdf'; + $ReportName = ReplaceNonAllowedCharacters($Prefs['reportname']) .'.pdf'; -// Javier: TCPDF sends its own http header -/* header('Content-type: application/pdf'); + header('Content-type: application/pdf'); header('Content-Length: ' . $len); header('Content-Disposition: inline; filename="' . $ReportName . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); -*/ -// $pdf->Stream($ReportName); - $pdf->OutputD($ReportName); - $pdf->__destruct(); + + $pdf->Stream($ReportName); exit(); // needs to be here to properly render the pdf file. } @@ -623,7 +613,7 @@ function ReplaceNonAllowedCharacters ($String) { $DodgyCharactersArray = array('"',' ', '&',"'"); $ContainsDodgyCharacters = true; - while ($ContainsDodgyCharacters == true) { + while ($ContainsDodgyCharacters == true){ $ContainsDodgyCharacters = false; //assume all dodgy characters are replaced on the last pass @@ -637,4 +627,4 @@ } return $String; } -?> +?> \ No newline at end of file Modified: trunk/reportwriter/admin/RCFunctions.inc =================================================================== --- trunk/reportwriter/admin/RCFunctions.inc 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/admin/RCFunctions.inc 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,5 +1,5 @@ <?php -/* $Id$*/ +/* $Revision: 1.9 $ */ // Include functions needed for ReportCreator.php function PrepStep($StepNum) { @@ -7,44 +7,44 @@ switch ($StepNum) { case '1': // home form with form listings default: - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP1; - $FormParams['heading'] = RPT_ADMIN; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP1; + $FormParams['heading'] = RPT_ADMIN; $FormParams['IncludePage'] = 'forms/ReportsHome.html'; break; case '2': // id, copy, new report name form - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP2; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP2; $FormParams['heading'] = RPT_RPTID; $FormParams['IncludePage'] = 'forms/ReportsID.html'; break; case '3': // page setup form - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP3; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP3; $FormParams['heading'] = RPT_RPTFRM; $FormParams['IncludePage'] = 'forms/ReportsPageSetup.html'; break; case '4': // db setup form - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP4; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP4; $FormParams['heading'] = RPT_RPTFRM; $FormParams['IncludePage'] = 'forms/ReportsDBSetup.html'; break; case '5': // field setup form - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP5; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP5; $FormParams['heading'] = RPT_RPTFRM; $FormParams['IncludePage'] = 'forms/ReportsFieldSetup.html'; break; case 'prop': // Form field properties form global $Params; // we need the form type from the Params variable to load the correct form - $FormParams['title'] = RPT_RPRBLDR.RPT_BTN_PROP; + $FormParams['title'] = RPT_RPRBLDR.RPT_BTN_PROP; $FormParams['heading'] = RPT_RPTFRM; $FormParams['IncludePage'] = 'forms/TplFrm'.$Params['index'].'.html'; break; case '6': // criteria setup form - $FormParams['title'] = RPT_RPRBLDR.RPT_STEP6; + $FormParams['title'] = RPT_RPRBLDR.RPT_STEP6; $FormParams['heading'] = RPT_RPTFRM; $FormParams['IncludePage'] = 'forms/ReportsCritSetup.html'; break; case 'imp': // import form - $FormParams['title'] = RPT_RPRBLDR.RPT_RPTIMPORT; - $FormParams['heading'] = RPT_RPTIMPORT; + $FormParams['title'] = RPT_RPRBLDR.RPT_RPTIMPORT; + $FormParams['heading'] = RPT_RPTIMPORT; $FormParams['IncludePage'] = 'forms/ReportsImport.html'; break; } // end switch $StepNum @@ -53,26 +53,26 @@ function RetrieveReports() { global $db, $ReportGroups, $FormGroups; - + $OutputString = ''; foreach ($ReportGroups as $key=>$GName) { $OutputString .= '<tr bgcolor="#CCCCCC"><td colspan="2" align="center">'.$GName.'</td></tr>'; $OutputString .= '<tr><td align="center">'.RPT_REPORTS.'</td><td align="center">'.RPT_FORMS.'</td></tr>'; $OutputString .= '<tr><td width="250" valign="top">'; - $sql= "SELECT id, reportname FROM ".DBReports." - WHERE defaultreport='1' AND reporttype='rpt' AND groupname='".$key."' + $sql= "SELECT id, reportname FROM ".DBReports." + WHERE defaultreport='1' AND reporttype='rpt' AND groupname='".$key."' ORDER BY reportname"; $Result=DB_query($sql,$db,'','',false,true); while ($Temp = DB_fetch_array($Result)) $OutputString .= '<input type="radio" name="ReportID" value="'.$Temp['id'].'">'.$Temp['reportname'].'<br>'; - $sql= "SELECT id, reportname FROM ".DBReports." - WHERE defaultreport='0' AND reporttype='rpt' AND groupname='".$key."' + $sql= "SELECT id, reportname FROM ".DBReports." + WHERE defaultreport='0' AND reporttype='rpt' AND groupname='".$key."' ORDER BY reportname"; $Result=DB_query($sql,$db,'','',false,true); if (DB_num_rows($Result)>0) $OutputString .= '<u>'.RPT_CUSTRPT.'</u><br>'; while ($Temp = DB_fetch_array($Result)) $OutputString .= '<input type="radio" name="ReportID" value="'.$Temp['id'].'">'.$Temp['reportname'].'<br>'; $OutputString .= '</td>'.chr(10).'<td width="250" valign="top">'; - $sql= "SELECT id, groupname, reportname FROM ".DBReports." - WHERE defaultreport='1' AND reporttype='frm' + $sql= "SELECT id, groupname, reportname FROM ".DBReports." + WHERE defaultreport='1' AND reporttype='frm' ORDER BY groupname, reportname"; $Result=DB_query($sql,$db,'','',false,true); $FormList = ''; @@ -97,13 +97,13 @@ function RetrieveFields($EntryType) { global $db, $ReportID; $FieldListings['fields'] = ''; - $sql= "SELECT * FROM ".DBRptFields." + $sql= "SELECT * FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' ORDER BY seqnum"; $Result=DB_query($sql,$db,'','',false,true); if (DB_num_rows($Result)>0) { - while ($FieldValues = DB_fetch_array($Result)) { - $FieldListings['lists'][] = $FieldValues; + while ($FieldValues = DB_fetch_array($Result)) { + $FieldListings['lists'][] = $FieldValues; } } // set the form field defaults @@ -120,7 +120,7 @@ function UpdatePageFields($ReportID) { global $db, $Type; // For both reports and forms start sql string - $sql = "UPDATE ".DBReports." SET + $sql = "UPDATE ".DBReports." SET papersize = '".$_POST['PaperSize']."', paperorientation = '".$_POST['PaperOrientation']."', margintop = ".$_POST['MarginTop'].", @@ -168,7 +168,19 @@ col5width = ".$_POST['Col5Width'].", col6width = ".$_POST['Col6Width'].", col7width = ".$_POST['Col7Width'].", - col8width = ".$_POST['Col8Width']; + col8width = ".$_POST['Col8Width'].", + col9width = ".$_POST['Col9Width'].", + col10width = ".$_POST['Col10Width'].", + col11width = ".$_POST['Col11Width'].", + col12width = ".$_POST['Col12Width'].", + col13width = ".$_POST['Col13Width'].", + col14width = ".$_POST['Col14Width'].", + col15width = ".$_POST['Col15Width'].", + col16width = ".$_POST['Col16Width'].", + col17width = ".$_POST['Col17Width'].", + col18width = ".$_POST['Col18Width'].", + col19width = ".$_POST['Col19Width'].", + col20width = ".$_POST['Col20Width']; } $sql .=" WHERE id =".$ReportID.";"; $Result=DB_query($sql,$db,'','',false,true); @@ -177,7 +189,7 @@ function UpdateCritFields($ReportID, $DateString) { global $db, $Type; - $sql = "UPDATE ".DBRptFields." SET + $sql = "UPDATE ".DBRptFields." SET reportid = '".$ReportID."', entrytype = 'dateselect', fieldname = '".DB_escape_string($_POST['DateField'])."', @@ -187,7 +199,7 @@ $Result=DB_query($sql,$db,'','',false,true); if ($Type<>'frm') { // then write specifics for a report // write the truncate long descriptions choice - $sql = "UPDATE ".DBRptFields." SET + $sql = "UPDATE ".DBRptFields." SET reportid = '".$ReportID."', entrytype = 'trunclong', params = '".$_POST['TruncLongDesc']."', @@ -196,7 +208,7 @@ $Result=DB_query($sql,$db,'','',false,true); } else { // it's a form update the page break info // write the form page break fieldname - $sql = "UPDATE ".DBRptFields." SET + $sql = "UPDATE ".DBRptFields." SET reportid = '".$ReportID."', entrytype = 'grouplist', seqnum = 1, @@ -220,15 +232,15 @@ if ($_POST['Table6']) $strTable .= ' INNER JOIN '.DB_escape_string($_POST['Table6']).' ON '.DB_escape_string($_POST['Table6Criteria']); // $sql = "SELECT * FROM ".$strTable." LIMIT 1"; - for ($i=0;$i<6;$i++) { - if ($_POST['Table'.$i]) { + for ($i=0;$i<6;$i++) { + if (isset($_POST['Table'.$i]) and $_POST['Table'.$i]) { $sql = "SHOW TABLES WHERE Tables_in_".$_SESSION['DatabaseName']."='".$_POST['Table'.$i]."'"; $Result=DB_query($sql,$db,'','',false,false); if (DB_num_rows($Result)==0) return false; } // if we have a row, sql was valid } - $sql = "UPDATE ".DBReports." SET + $sql = "UPDATE ".DBReports." SET table1 = '".DB_escape_string($_POST['Table1'])."', table2 = '".DB_escape_string($_POST['Table2'])."', table2criteria = '".DB_escape_string($_POST['Table2Criteria'])."', @@ -250,7 +262,7 @@ if (!isset($_POST['Visible'])) $_POST['Visible'] = '0'; if (!isset($_POST['ColumnBreak'])) $_POST['ColumnBreak'] = '0'; if (!isset($_POST['Params'])) $Params = '0'; else $Params = $_POST['Params']; - $sql = "UPDATE ".DBRptFields." SET + $sql = "UPDATE ".DBRptFields." SET fieldname = '".DB_escape_string($_POST['FieldName'])."', displaydesc = '".DB_escape_string($_POST['DisplayDesc'])."', visible = '".$_POST['Visible']."', @@ -265,14 +277,14 @@ function ChangeSequence($SeqNum, $EntryType, $UpDown) { global $db, $ReportID; // find the id of the row to move - $sql = "SELECT id FROM ".DBRptFields." + $sql = "SELECT id FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$SeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_row($Result); $OrigID = $myrow[0]; if ($UpDown=='up') $NewSeqNum = $SeqNum-1; else $NewSeqNum = $SeqNum+1; // first move affected sequence to seqnum, then seqnum to new position - $sql = "UPDATE ".DBRptFields." SET seqnum='".$SeqNum."' + $sql = "UPDATE ".DBRptFields." SET seqnum='".$SeqNum."' WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$NewSeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); $sql = "UPDATE ".DBRptFields." SET seqnum='".$NewSeqNum."' WHERE id = ".$OrigID.";"; @@ -285,8 +297,8 @@ global $db, $ReportID, $Type; if (!$SeqNum) $SeqNum = 999; // set sequence to max if not entered // read the sequence numbers for the given EntryType - $sql = "SELECT id FROM ".DBRptFields." - WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' + $sql = "SELECT id FROM ".DBRptFields." + WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' ORDER BY seqnum;"; $Result=DB_query($sql,$db,'','',false,true); while ($FieldID = DB_fetch_array($Result)) { $IDList[] = $FieldID['id']; } @@ -301,7 +313,7 @@ if (!isset($_POST['Visible'])) $Visible = '0'; else $Visible = $_POST['Visible']; if (!isset($_POST['ColumnBreak'])) $ColumnBreak = '0'; else $ColumnBreak = $_POST['ColumnBreak']; if (!isset($_POST['Params'])) { - $Params = '0'; + $Params = '0'; } elseif ($Type=='frm' AND $EntryType=='fieldlist') { $EntryIndex['index'] = $_POST['Params']; $Params = serialize($EntryIndex); @@ -320,12 +332,12 @@ // This function removes a sequence field and fills the sequence hole left behind global $db, $ReportID; // delete the sequence number from the list - $sql = "DELETE FROM ".DBRptFields." + $sql = "DELETE FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' AND seqnum = ".$SeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); // read in the remaining sequences and re-number - $sql = "SELECT id FROM ".DBRptFields." - WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' + $sql = "SELECT id FROM ".DBRptFields." + WHERE reportid = ".$ReportID." AND entrytype = '".$EntryType."' ORDER BY seqnum;"; $Result=DB_query($sql,$db,'','',false,true); while ($FieldID = DB_fetch_array($Result)) { $IDList[] = $FieldID['id']; } @@ -342,7 +354,7 @@ // This function creates a hole in the sequencing to allow inserting new form table field data $SeqNum = $_POST['TblSeqNum']; if (!$SeqNum) $SeqNum = count($Params['Seq'])+1; // set sequence to last entry if not entered - if (isset($Params['Seq'][$SeqNum-1]) AND $Insert=='insert') { + if (isset($Params['Seq'][$SeqNum-1]) AND $Insert=='insert') { // then the sequence number exists make a hole for this insert for ($j=count($Params['Seq']); $j>=$SeqNum; $j--) { $Params['Seq'][$j] = $Params['Seq'][$j-1]; // move the array element down one @@ -359,7 +371,7 @@ $Params['Seq'][$SeqNum-1]['FontAlign'] = $_POST['FontAlign']; $Params['Seq'][$SeqNum-1]['FontColor'] = $_POST['FontColor']; $Params['Seq'][$SeqNum-1]['TblColWidth'] = $_POST['TblColWidth']; - if (!isset($_POST['TblShow'])) $Params['Seq'][$SeqNum-1]['TblShow'] = '0'; + if (!isset($_POST['TblShow'])) $Params['Seq'][$SeqNum-1]['TblShow'] = '0'; else $Params['Seq'][$SeqNum-1]['TblShow'] = '1'; return true; } @@ -396,7 +408,7 @@ $Params['FontAlign'] = $Params['Seq'][$i-1]['FontAlign']; $Params['FontColor'] = $Params['Seq'][$i-1]['FontColor']; $Params['TblColWidth'] = $Params['Seq'][$i-1]['TblColWidth']; - $Params['TblShow'] = $Params['Seq'][$i-1]['TblShow']; + $Params['TblShow'] = $Params['Seq'][$i-1]['TblShow']; return 'edit'; } if (isset($_POST['rm'.$i.'_x'])) { // sequence rm[i] was pressed, delete the entry @@ -419,9 +431,9 @@ if (strlen($Description)<1) return false; else return true; } // fetch the table values to build sql - $sql = "SELECT table1, - table2, table2criteria, - table3, table3criteria, + $sql = "SELECT table1, + table2, table2criteria, + table3, table3criteria, table4, table4criteria, table5, table5criteria, table6, table6criteria @@ -492,7 +504,7 @@ while ($DefRpt = readdir($dh)) { $pinfo = pathinfo(DefRptPath.$DefRpt); $Ext = strtoupper($pinfo['extension']); - if ($Ext=='JPG' OR $Ext=='JPEG' OR $Ext=='PNG') { + if ($Ext=='JPG' OR $Ext=='JPEG' OR $Ext=='PNG') { if ($Default==$pinfo['basename']) $checked=' selected'; else $checked = ''; $OptionList .= '<option value="'.$pinfo['basename'].'"'.$checked.'> '.$pinfo['basename'].'</option>'; } @@ -521,7 +533,7 @@ } elseif (!is_uploaded_file($_FILES['imagefile']['tmp_name'])) { // file uploaded $Rtn['message'] = RPT_IMP_ERMSG10; } elseif (strpos($_FILES['imagefile']['type'],'image')===false) { // not an imsge file extension - $Rtn['message'] = RPT_IMP_ERMSG6; + $Rtn['message'] = RPT_IMP_ERMSG6; } elseif ($_FILES['imagefile']['size']==0) { // report contains no data, error $Rtn['message'] = RPT_IMP_ERMSG7; } else { // passed all error checking, save the image @@ -588,7 +600,7 @@ for ($i=0; $i<count($FieldData); $i++) $CSVOutput .= $FieldData[$i].$crlf; $CSVOutput .= $crlf; $CSVOutput .= '/* End of Export File */'.$crlf; - // export the file + // export the file $FileSize = strlen($CSVOutput); header("Content-type: application/txt"); header("Content-disposition: attachment; filename=".preg_replace('/ /','',$ReportName).".rpt.txt; size=".$FileSize); @@ -596,7 +608,7 @@ header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); print $CSVOutput; - exit(); + exit(); } function ImportReport($RptName) { @@ -625,7 +637,7 @@ } if ($Rtn['result']=='error') return $Rtn; } - + $Title1Desc = ''; // Initialize to null, not used for forms $Title2Desc = ''; foreach ($arrSQL as $sql) { // find the report translated reportname and title information @@ -637,7 +649,7 @@ if ($RptName=='') $RptName = $ReportName; // then no report was entered use reportname from file $sql= "SELECT id FROM ".DBReports." WHERE reportname='".DB_escape_string($RptName)."';"; $Result=DB_query($sql,$db,'','',false,true); - if (DB_num_rows($Result)>0) { // the report name already exists, error + if (DB_num_rows($Result)>0) { // the report name already exists, error $Rtn['result'] = 'error'; $Rtn['message'] = RPT_REPDUP; return $Rtn; @@ -656,13 +668,13 @@ $Rtn['message'] = RPT_IMP_ERMSG8; return $Rtn; } - // fetch the id of the row inserted + // fetch the id of the row inserted $ReportID = DB_Last_Insert_ID($db,DBReports,'id'); // update the translated report name and title fields into the newly imported report - $sql = "UPDATE ".DBReports." SET - reportname = '".$RptName."', - title1desc = '".$Title1Desc."', - title2desc = '".$Title2Desc."' + $sql = "UPDATE ".DBReports." SET + reportname = '".$RptName."', + title1desc = '".$Title1Desc."', + title2desc = '".$Title2Desc."' WHERE id = ".$ReportID.";"; $Result=DB_query($sql,$db,'','',false,true); foreach ($arrSQL as $sql) { // fetch the translations for the field descriptions @@ -682,7 +694,7 @@ if ($FieldID<>0) { // A field was successfully written update the report id if (isset($Language[$FldIndex])) $DispSQL = "displaydesc='".$Language[$FldIndex]."', "; else $DispSQL = ''; - $tsql = "UPDATE ".DBRptFields." SET ".$DispSQL." reportid='".$ReportID."' + $tsql = "UPDATE ".DBRptFields." SET ".$DispSQL." reportid='".$ReportID."' WHERE id=".$FieldID.";"; $Result=DB_query($tsql,$db,'','',false,true); } @@ -698,9 +710,9 @@ $sql = "SELECT table".$Table." FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_row($Result); - + $TableList = ''; - + $Result=DB_show_tables($db); while ($mytable=DB_fetch_row($Result)) { @@ -717,7 +729,7 @@ FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_row($Result); - $LinkList = ''; $j = 0; + $LinkList = ''; $j = 0; /* Get list of link tables from foreign keys */ for ($i = 0; $i < $Table; $i++) { @@ -749,11 +761,11 @@ function CreateLinkEqList($ReportID,$Table) { global $db; - $sql = "SELECT table1, - table2, table2criteria, - table3, table3criteria, - table4, table4criteria, - table5, table5criteria, + $sql = "SELECT table1, + table2, table2criteria, + table3, table3criteria, + table4, table4criteria, + table5, table5criteria, table6, table6criteria FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); Modified: trunk/reportwriter/admin/ReportCreator.php =================================================================== --- trunk/reportwriter/admin/ReportCreator.php 2010-08-18 17:27:18 UTC (rev 3694) +++ trunk/reportwriter/admin/ReportCreator.php 2010-08-18 19:26:27 UTC (rev 3695) @@ -1,13 +1,13 @@ <?php -/* $Id$*/ +/* $Revision: 1.6 $ */ /* -This script has the responsibility to gather basic information necessary to retrieve data for reports. -It is comprised of several steps designed to gather display preferences, database information, field +This script has the responsibility to gather basic information necessary to retrieve data for reports. +It is comprised of several steps designed to gather display preferences, database information, field information and filter/criteria information. The Report builder process is as follows: Step 1: (or script entry): displays the current listing of reports. Uses form ReportsHome.html as a UI. -Step 2: (action=step2): After the user has selected an option, this step is followed to enter a report +Step 2: (action=step2): After the user has selected an option, this step is followed to enter a report name and the type of report it is for grouping purposes. Step 3: Handles the page setup information. Step 4: Handles the database setup and link information. @@ -18,15 +18,13 @@ */ $DirectoryLevelsDeep = 2; -// Javier $PathPrefix = '../../'; se va un directorio mas arriba, si no funciona el cambio hay que hacerlo constante. $PathPrefix = '../../'; - $PageSecurity = 2; // set security level for webERP // Fetch necessary include files for webERP require ($PathPrefix . 'includes/session.inc'); // Initialize some constants -$ReportLanguage = 'en_US'; // default language file +$ReportLanguage = 'en_US'; // default language file define('DBReports','reports'); // name of the databse holding the main report information (ReportID) define('DBRptFields','reportfields'); // name of the database holding the report fields define ('DefRptPath',$PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/reportwriter/'); // path to default reports @@ -41,8 +39,8 @@ $usrMsg = ''; // initialize array for return messages // a valid report id needs to be passed as a post field to do anything, except create new report if (!isset($_POST['ReportID'])) { // entered for the first time or created new report - $ReportID = ''; -} else { + $ReportID = ''; +} else { $ReportID = $_POST['ReportID']; if (isset($_POST['Type'])) { // then the type was passed from the previous form $Type=$_POST['Type']; @@ -81,7 +79,7 @@ $myrow = DB_fetch_array($Result); $_POST['ReportName'] = $myrow['reportname']; // continue like copy was pushed - case RPT_BTN_COPY: // Copy a report was selected + case RPT_BTN_COPY: // Copy a report was selected $FormParams = PrepStep('2'); break; case RPT_BTN_DEL: // after confirmation, delete the report and go to the main report admin menu @@ -103,7 +101,7 @@ break; } break; // End Step 2 - + case "step3": // entered from id setup page switch ($_POST['todo']) { case RPT_BTN_REPLACE: // Erase the default report and copy a new one with the same name @@ -175,8 +173,8 @@ $sql = "UPDATE ".DBReports." SET id=".$OrigID." WHERE id=0;"; $Result=DB_query($sql,$db,'','',false,true); // Set the report name and group name per the form - $sql = "UPDATE ".DBReports." SET - reportname = '" . DB_escape_string($_POST['ReportName']) . "' + $sql = "UPDATE ".DBReports." SET + reportname = '" . DB_escape_string($_POST['ReportName']) . "' WHERE id =".$ReportID.";"; $Result=DB_query($sql,$db,'','',false,true); // fetch the fields and duplicate @@ -184,7 +182,7 @@ $Result=DB_query($sql,$db,'','',false,true); while ($temp = DB_fetch_array($Result)) $field[] = $temp; foreach ($field as $row) { - $sql = "INSERT INTO ".DBRptFields." (reportid, entrytype, seqnum, fieldname, + $sql = "INSERT INTO ".DBRptFields." (reportid, entrytype, seqnum, fieldname, displaydesc, visible, columnbreak, params) VALUES (".$ReportID.", '".$row['entrytype']."', ".$row['seqnum'].", '".$row['fieldname']."', '".$row['displaydesc']."', '".$row['visible']."', @@ -198,7 +196,7 @@ $myrow = DB_fetch_array($Result); $FormParams = PrepStep('3'); break; - + case RPT_BTN_RENAME: // Rename a report was selected, fetch the report name and update // input error check reportname, blank duplicate, bad characters, etc. if ($_POST['ReportName']=='') { // no report name was entered, error and reload form @@ -227,7 +225,7 @@ $FormParams = PrepStep('1'); } break; - + case "step4": // entered from page setup page switch ($_POST['todo']) { case RPT_BTN_UPDATE: @@ -241,7 +239,7 @@ case RPT_BTN_CONT: // fetch the report information and go to the page setup screen $success = UpdatePageFields($ReportID); // read in the data for the next form - $sql = "SELECT table1, + $sql = "SELECT table1, table2, table2criteria, table3, table3criteria, table4, table4criteria, @@ -260,7 +258,7 @@ $FormParams = PrepStep('1'); } break; - + case "step5": // entered from dbsetup page switch ($_POST['todo']) { case RPT_BTN_BACK: @@ -284,16 +282,16 @@ } } $success = UpdateDBFields($ReportID); - if (!$success OR $_POST['todo']==RPT_BTN_UPDATE) { + if (!$success OR $_POST['todo']==RPT_BTN_UPDATE) { // update fields and stay on this form if (!$success) $usrMsg[] = array('message'=>RPT_DUPDB, 'level'=>'error'); // read back in new data for next screen (will set defaults as defined in the db) - $sql = "SELECT table1, - table2, table2criteria, - table3, table3criteria, - table4, table4criteria, - table5, table5criteria, - table6, table6criteria, + $sql = "SELECT table1, + table2, table2criteria, + table3, table3criteria, + table4, table4criteria, + table5, table5criteria, + table6, table6criteria, reportname FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); @@ -311,7 +309,7 @@ $FormParams = PrepStep('1'); } break; - + case "step6": // entered from field setup page if (!isset($_POST['todo'])) { // then a sequence image button was pushed $SeqNum = $_POST['SeqNum']; //fetch the sequence number @@ -324,9 +322,9 @@ if ($SeqNum<DB_num_rows($Result)) $success = ChangeSequence($SeqNum, 'fieldlist', 'down'); $FieldListings = RetrieveFields('fieldlist'); } elseif (isset($_POST['ed_x'])) { // the sequence edit button was pushed - // pre fill form with the field to edit and change button name + // pre fill form with the field to edit and change button name $FieldListings = RetrieveFields('fieldlist'); - $sql = "SELECT * FROM ".DBRptFields." + $sql = "SELECT * FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype = 'fieldlist' AND seqnum=".$SeqNum.";"; $Result=DB_query($sql,$db,'','',false,true); $FieldListings['defaults'] = DB_fetch_array($Result); @@ -340,12 +338,12 @@ } else { switch ($_POST['todo']) { case RPT_BTN_BACK: - $sql = "SELECT table1, - table2, table2criteria, - table3, table3criteria, - table4, table4criteria, - table5, table5criteria, - table6, table6criteria, + $sql = "SELECT table1, + table2, table2criteria, + table3, table3criteria, + table4, table4criteria, + table5, table5criteria, + table6, table6criteria, reportname FROM ".DBReports." WHERE id='".$ReportID."'"; $Result=DB_query($sql,$db,'','',false,true); @@ -374,7 +372,7 @@ $reportname = $_POST['ReportName']; $FormParams = PrepStep('5'); break; - } + } if ($_POST['todo']==RPT_BTN_ADDNEW) { // add new so insert $_POST['SeqNum'] = InsertSequence($_POST['SeqNum'], 'fieldlist'); } else { // exists, so update it. @@ -390,7 +388,7 @@ case RPT_BTN_PROP: // Enter the properties of a given field // see what form needs to be loaded and load based on index stored in params variable $SeqNum = $_POST['SeqNum']; - $sql = "SELECT id, displaydesc, params FROM ".DBRptFields." + $sql = "SELECT id, displaydesc, params FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype='fieldlist' AND seqnum = ".$SeqNum.";"; $Result = DB_query($sql,$db,'','',false,true); $myrow = DB_fetch_assoc($Result); @@ -419,13 +417,13 @@ } } break; - + case "step6a": // entered from properties page for fields $ButtonValue = RPT_BTN_ADDNEW; // default the field button to Add New unless overidden by the edit image pressed $reportname = $_POST['ReportName']; $SeqNum = $_POST['SeqNum']; // first fetch the original Params - $sql = "SELECT id, params FROM ".DBRptFields." + $sql = "SELECT id, params FROM ".DBRptFields." WHERE reportid = ".$ReportID." AND entrytype='fieldlist' AND seqnum = ".$SeqNum.";"; $Result = DB_query($sql,$db,'','',false... [truncated message content] |