From: <dai...@us...> - 2011-04-10 02:05:05
|
Revision: 4544 http://web-erp.svn.sourceforge.net/web-erp/?rev=4544&view=rev Author: daintree Date: 2011-04-10 02:04:57 +0000 (Sun, 10 Apr 2011) Log Message: ----------- Tim changes Modified Paths: -------------- trunk/PaymentMethods.php trunk/Payments.php trunk/Stocks.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc trunk/index.php trunk/sql/mysql/upgrade3.11.1-4.00.sql Added Paths: ----------- trunk/PDFPeriodStockTransListing.php trunk/includes/PDFPeriodStockTransListingPageHeader.inc Removed Paths: ------------- trunk/PDFStockTransListing.php trunk/includes/PDFStockTransListingPageHeader.inc Added: trunk/PDFPeriodStockTransListing.php =================================================================== --- trunk/PDFPeriodStockTransListing.php (rev 0) +++ trunk/PDFPeriodStockTransListing.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -0,0 +1,203 @@ +<?php +/* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ + + +include('includes/SQL_CommonFunctions.inc'); +include ('includes/session.inc'); + +$InputError=0; +if (isset($_POST['FromDate']) AND !Is_Date($_POST['FromDate'])){ + $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; + $InputError=1; + unset($_POST['FromDate']); +} + +if (!isset($_POST['FromDate'])){ + + $title = _('Stock Transaction Listing'); + include ('includes/header.inc'); + + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . _('Stock Transaction Listing').'</img></p></div>'; + + if ($InputError==1){ + prnMsg($msg,'error'); + } + + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<table class=selection>'; + echo '<tr> + <td>' . _('Enter the date from which the transactions are to be listed') . ':</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 the transactions 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>' . _('Transaction type') . '</td><td>'; + + echo '<select name="TransType">'; + + echo '<option value=10>' . _('Sales Invoice').'</option> + <option value=11>' . _('Sales Credit Note').'</option> + <option value=16>' . _('Location Transfer').'</option> + <option value=17>' . _('Stock Adjustment').'</option> + <option value=25>' . _('Purchase Order Delivery').'</option> + <option value=26>' . _('Work Order Receipt').'</option> + <option value=28>' . _('Work Order Issue').'</option>'; + + echo '</select></td></tr>'; + + $sql = "SELECT loccode, locationname FROM locations"; + $resultStkLocs = DB_query($sql, $db); + + echo '<tr><td>' . _('For Stock Location') . ':</td> + <td><select name="StockLocation">'; + echo '<option VALUE="All">' . _('All') . '</option>'; + while ($myrow=DB_fetch_array($resultStkLocs)){ + if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ + if ($myrow['loccode'] == $_POST['StockLocation']){ + echo '<option selected VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } else { + echo '<option VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ + echo '<option selected VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + $_POST['StockLocation']=$myrow['loccode']; + } else { + echo '<option VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } + echo '</select></td></tr>'; + + echo '</table><br><div class="centre"><input type=submit name="Go" value="' . _('Create PDF') . '"></div>'; + + include('includes/footer.inc'); + exit; +} else { + + include('includes/ConnectDB.inc'); +} + + +if ($_POST['StockLocation']=='All') { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; +} else { + $sql= "SELECT stockmoves.type, + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' + AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; +} +$result=DB_query($sql,$db,'','',false,false); + +if (DB_error_no($db)!=0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + prnMsg(_('An error occurred getting the transactions'),'error'); + include('includes/footer.inc'); + exit; +} elseif (DB_num_rows($result) == 0){ + $title = _('Transaction Listing'); + include('includes/header.inc'); + echo '<br>'; + prnMsg (_('There were no transactions found in the database between the dates') . ' ' . $_POST['FromDate'] . ' ' . _('and') . ' '. $_POST['ToDate'] .'<br />' ._('Please try again selecting a different date'), 'info'); + include('includes/footer.inc'); + exit; +} + +include('includes/PDFStarter.php'); + +/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ + +$pdf->addInfo('Title',_('Stock Transaction Listing')); +$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['FromDate'] . ' ' . $_POST['ToDate']); +$line_height=12; +$PageNumber = 1; + + +switch ($_POST['TransType']) { + case 10: + $TransType=_('Customer Invoices'); + break; + case 11: + $TransType=_('Customer Credit Notes'); + break; + case 16: + $TransType=_('Location Transfers'); + break; + case 17: + $TransType=_('Stock Adjustments'); + break; + case 25: + $TransType=_('Purchase Order Deliveries'); + break; + case 26: + $TransType=_('Work Order Receipts'); + break; + case 28: + $TransType=_('Work Order Issues'); + break; +} + +include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + +while ($myrow=DB_fetch_array($result)){ + + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); + + $YPos -= ($line_height); + + if ($YPos - (2 *$line_height) < $Bottom_Margin){ + /*Then set up a new page */ + $PageNumber++; + include ('includes/PDFPeriodStockTransListingPageHeader.inc'); + } /*end of new page header */ +} /* end of while there are customer receipts in the batch to print */ + + +$YPos-=$line_height; + +$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); + +?> \ No newline at end of file Deleted: trunk/PDFStockTransListing.php =================================================================== --- trunk/PDFStockTransListing.php 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/PDFStockTransListing.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -1,145 +0,0 @@ -<?php - -/* $Id$*/ - -/* $Revision: 1.13 $ */ - -//$PageSecurity = 3; -include('includes/SQL_CommonFunctions.inc'); -include ('includes/session.inc'); - -$InputError=0; -if (isset($_POST['Date']) AND !Is_Date($_POST['Date'])){ - $msg = _('The date must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat']; - $InputError=1; - unset($_POST['Date']); -} - -if (!isset($_POST['Date'])){ - - $title = _('Stock Transaction Listing'); - include ('includes/header.inc'); - - echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' - . _('Stock Transaction Listing').'</p></div>'; - - if ($InputError==1){ - prnMsg($msg,'error'); - } - - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> - <tr> - <td>' . _('Enter the date 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> - </tr>"; - - echo '<tr><td>' . _('Transaction type') . '</td><td>'; - - echo "<select name='TransType'>"; - - echo '<option value=10>' . _('Sales Invoice').'</option>'; - echo '<option value=11>' . _('Sales Credit Note').'</option>'; - echo '<option value=16>' . _('Location Transfer').'</option>'; - echo '<option value=17>' . _('Stock Adjustment').'</option>'; - echo '<option value=25>' . _('Purchase Order Delivery').'</option>'; - echo '<option value=26>' . _('Work Order Receipt').'</option>'; - echo '<option value=28>' . _('Work Order Issue').'</option>'; - - echo '</select></td></tr>'; - - echo "</select></td></tr></table><br><div class='centre'><input type=submit name='Go' value='" . _('Create PDF') . "'></div>"; - - - include('includes/footer.inc'); - exit; -} else { - - include('includes/ConnectDB.inc'); -} - -$sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; - -$result=DB_query($sql,$db,'','',false,false); - -if (DB_error_no($db)!=0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - prnMsg(_('An error occurred getting the transactions'),'error'); - include('includes/footer.inc'); - exit; -} elseif (DB_num_rows($result) == 0){ - $title = _('Transaction Listing'); - include('includes/header.inc'); - echo '<br>'; - prnMsg (_('There were no transactions found in the database for the date') . ' ' . $_POST['Date'] .'. '._('Please try again selecting a different date'), 'info'); - include('includes/footer.inc'); - exit; -} - -include('includes/PDFStarter.php'); - -/*PDFStarter.php has all the variables for page size and width set up depending on the users default preferences for paper size */ - -$pdf->addInfo('Title',_('Stock Transaction Listing')); -$pdf->addInfo('Subject',_('Stock transaction listing from') . ' ' . $_POST['Date'] ); -$line_height=12; -$PageNumber = 1; - -include ('includes/PDFStockTransListingPageHeader.inc'); - -while ($myrow=DB_fetch_array($result)){ - - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,number_format($myrow['qty'],$myrow['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,$myrow['locationname'], 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,$myrow['reference'], 'right'); - - $YPos -= ($line_height); - - if ($YPos - (2 *$line_height) < $Bottom_Margin){ - /*Then set up a new page */ - $PageNumber++; - include ('includes/PDFStockTransListingPageHeader.inc'); - } /*end of new page header */ -} /* end of while there are customer receipts in the batch to print */ - - -$YPos-=$line_height; - -/* UldisN -$pdfcode = $pdf->output(); -$len = strlen($pdfcode); -header('Content-type: application/pdf'); -header('Content-Length: ' . $len); -header('Content-Disposition: inline; filename=ChequeListing.pdf'); -header('Expires: 0'); -header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); -header('Pragma: public'); - -$pdf->stream(); -*/ -$ReportFileName = $_SESSION['DatabaseName'] . '_StockTransListing_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName);//UldisN -$pdf->__destruct(); //UldisN - -?> \ No newline at end of file Modified: trunk/PaymentMethods.php =================================================================== --- trunk/PaymentMethods.php 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/PaymentMethods.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.9 $ */ + /* $Id$*/ -//$PageSecurity = 15; - include('includes/session.inc'); $title = _('Payment Methods'); @@ -72,8 +70,9 @@ $sql = "UPDATE paymentmethods SET paymentname='" . $_POST['MethodName'] . "', paymenttype = '" . $_POST['ForPayment'] . "', - receipttype = '" . $_POST['ForReceipt'] . "' - WHERE paymentname LIKE '".$OldName."'"; + receipttype = '" . $_POST['ForReceipt'] . "', + usepreprintedstationery = '" . $_POST['UsePrePrintedStationery']. "' + WHERE paymentname " . LIKE . " '".$OldName."'"; /* lets leave well alone existing entries if ($_POST['MethodName'] != $OldMeasureName ) { @@ -103,11 +102,13 @@ $sql = "INSERT INTO paymentmethods ( paymentname, paymenttype, - receipttype) + receipttype, + usepreprintedstationery) VALUES ( '" . $_POST['MethodName'] ."', '" . $_POST['ForPayment'] ."', '" . $_POST['ForReceipt'] ."' + '" . $_POST['UsePrePrintedStationery'] ."' )"; } $msg = _('Record inserted'); @@ -124,6 +125,7 @@ unset ($_POST['MethodName']); unset ($_POST['ForPayment']); unset ($_POST['ForReceipt']); + unset ($_POST['UsePrePrintedStationery']); } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button @@ -143,12 +145,12 @@ $myrow = DB_fetch_row($result); if ($myrow[0]>0) { prnMsg( _('Cannot delete this payment method because bank transactions have been created using this payment method'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this payment method') . '</font>'; + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('bank transactions that refer to this payment method') . '</font>'; } else { - $sql="DELETE FROM paymentmethods WHERE paymentname LIKE '" . $OldMeasureName . "'"; + $sql="DELETE FROM paymentmethods WHERE paymentname " . LIKE . " '" . $OldMeasureName . "'"; $result = DB_query($sql,$db); prnMsg( $OldMeasureName . ' ' . _('payment method has been deleted') . '!','success'); - echo '<br>'; + echo '<br />'; } //end if not used } //end if payment method exist unset ($SelectedPaymentID); @@ -174,19 +176,21 @@ $sql = "SELECT paymentid, paymentname, paymenttype, - receipttype + receipttype, + usepreprintedstationery FROM paymentmethods ORDER BY paymentid"; $ErrMsg = _('Could not get payment methods because'); $result = DB_query($sql,$db,$ErrMsg); - echo "<table class=selection> + echo '<table class=selection> <tr> - <th>" . _('Payment Method') . "</th> - <th>" . _('For Payments') . "</th> - <th>" . _('For Receipts') . "</th> - </tr>"; + <th>' . _('Payment Method') . '</th> + <th>' . _('For Payments') . '</th> + <th>' . _('For Receipts') . '</th> + <th>' . _('Use Pre-printed') .'<br />' . _('Stationery') . '</th> + </tr>'; $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { @@ -202,8 +206,9 @@ echo '<td>' . $myrow['paymentname'] . '</td>'; echo '<td>' . ($myrow['paymenttype'] ? _('Yes') : _('No')) . '</td>'; echo '<td>' . ($myrow['receipttype'] ? _('Yes') : _('No')) . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedPaymentID=' . $myrow['paymentid'] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedPaymentID=' . $myrow['paymentid'] . '&delete=1">' . _('Delete') .'</a></td>'; + echo '<td>' . ($myrow['usepreprintedstationery'] ? _('Yes') : _('No')) . '</td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedPaymentID=' . $myrow['paymentid'] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedPaymentID=' . $myrow['paymentid'] . '&delete=1">' . _('Delete') .'</a></td>'; echo '</tr>'; } //END WHILE LIST LOOP @@ -219,7 +224,7 @@ if (! isset($_GET['delete'])) { - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; if (isset($SelectedPaymentID)) { @@ -228,7 +233,8 @@ $sql = "SELECT paymentid, paymentname, paymenttype, - receipttype + receipttype, + usepreprintedstationery FROM paymentmethods WHERE paymentid='" . $SelectedPaymentID . "'"; @@ -243,37 +249,45 @@ $_POST['MethodName'] = $myrow['paymentname']; $_POST['ForPayment'] = $myrow['paymenttype']; $_POST['ForReceipt'] = $myrow['receipttype']; + $_POST['UsePrePrintedStationery'] = $myrow['usepreprintedstationery']; - echo "<input type=hidden name='SelectedPaymentID' VALUE='" . $_POST['MethodID'] . "'>"; - echo "<table class=selection>"; + echo '<input type="hidden" name="SelectedPaymentID" value="' . $_POST['MethodID'] . '">'; + echo '<table class="selection">'; } } else { $_POST['MethodName']=''; $_POST['ForPayment'] = 1; // Default is use for payment $_POST['ForReceipt'] = 1; // Default is use for receipts - echo "<table class=selection>"; + $_POST['UsePrePrintedStationery'] = 0; // Default is use for receipts + echo '<table class=selection>'; } - echo "<tr> - <td>" . _('Payment Method') . ':' . "</td> - <td><input type='Text' ". (in_array('MethodName',$Errors) ? 'class="inputerror"' : '' ) ." name='MethodName' size=30 maxlength=30 value='" . $_POST['MethodName'] . "'></td> - </tr>"; - echo "<tr> - <td>" . _('Use For Payments') . ':' . "</td> - <td><select name='ForPayment'>"; - echo "<option".($_POST['ForPayment'] ? ' selected' : '') ." VALUE='1'>" . _('Yes'); - echo "<option".($_POST['ForPayment'] ? '' : ' selected') ." VALUE='0'>" . _('No'); - echo "</select></td></tr>"; - echo "<tr> - <td>" . _('Use For Receipts') . ':' . "</td> - <td><select name='ForReceipt'>"; - echo "<option".($_POST['ForReceipt'] ? ' selected' : '') ." VALUE='1'>" . _('Yes'); - echo "<option".($_POST['ForReceipt'] ? '' : ' selected') ." VALUE='0'>" . _('No'); - echo "</select></td></tr>"; + echo '<tr> + <td>' . _('Payment Method') . ':' . '</td> + <td><input type="Text" '. (in_array('MethodName',$Errors) ? 'class="inputerror"' : '' ) .' name="MethodName" size="30" maxlength="30" value="' . $_POST['MethodName'] . '"></td> + </tr>'; + echo '<tr> + <td>' . _('Use For Payments') . ':' . '</td> + <td><select name="ForPayment"> + <option' . ($_POST['ForPayment'] ? ' selected' : '') .' value="1">' . _('Yes') . '</option> + <option' . ($_POST['ForPayment'] ? '' : ' selected') .' value="0">' . _('No') . '</select></td> + </tr>'; + echo '<tr> + <td>' . _('Use For Receipts') . ':' . '</td> + <td><select name="ForReceipt"> + <option' . ($_POST['ForReceipt'] ? ' selected' : '') .' value="1">' . _('Yes') . '</option> + <option' . ($_POST['ForReceipt'] ? '' : ' selected') .' value="0">' . _('No') . '</option> + </select></td></tr>'; + echo '<tr> + <td>' . _('Use Pre-printed Stationery') . ':' . '</td> + <td><select name="UsePrePrintedStationery"> + <option' . ($_POST['UsePrePrintedStationery'] ? ' selected': '' ) .' value="1">' . _('Yes') . '</option> + <option' . ($_POST['UsePrePrintedStationery']==1 ? '' : ' selected' ) .' value="0">' . _('No') . '</option> + </select></td></tr>'; echo '</table>'; - echo '<br><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; + echo '<br /><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div>'; echo '</form>'; Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/Payments.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -246,11 +246,16 @@ $PeriodNo = GetPeriod($_SESSION['PaymentDetail']->DatePaid,$db); + $sql="SELECT usepreprintedstationery + FROM paymentmethods + WHERE paymentname='" . $_SESSION['PaymentDetail']->Paymenttype ."'"; + $result=DB_query($sql, $db); + $myrow=DB_fetch_row($result); // first time through commit if supplier cheque then print it first if ((!isset($_POST['ChequePrinted'])) AND (!isset($_POST['PaymentCancelled'])) - AND ($_SESSION['PaymentDetail']->Paymenttype == 'Cheque')) { + AND ($myrow[0] == 1)) { // it is a supplier payment by cheque and haven't printed yet so print cheque echo '<br /><a href="' . $rootpath . '/PrintCheque.php?' . SID . '&ChequeNum=' . $_POST['ChequeNum'] . '">' . _('Print Cheque using pre-printed stationery') . '</a><br /><br />'; @@ -607,14 +612,14 @@ $_SESSION['PaymentDetail']->Remove_GLItem($_GET['Delete']); } elseif (isset($_POST['Process']) and !$BankAccountEmpty){ //user hit submit a new GL Analysis line into the payment - $ChequeNoSQL='select account from gltrans where chequeno="'.$_POST['cheque'].'"'; + $ChequeNoSQL="SELECT account FROM gltrans WHERE chequeno='" . $_POST['cheque'] ."'"; $ChequeNoResult=DB_query($ChequeNoSQL, $db); if (is_numeric($_POST['GLManualCode'])){ - $SQL = "select accountname - FROM chartmaster - WHERE accountcode='" . $_POST['GLManualCode'] . "'"; + $SQL = "SELECT accountname + FROM chartmaster + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/Stocks.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -22,12 +22,15 @@ $myrow = DB_fetch_row($result); if ($myrow[0]==0) { $New=1; + } else { + $New=0; } } -?> +if (isset($_POST['New'])) { + $New=$_POST['New']; +} -<?php echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>' . "\n"; echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' @@ -62,7 +65,6 @@ $result = move_uploaded_file($_FILES['ItemPicture']['tmp_name'], $filename); $message = ($result)?_('File url') ."<a href='". $filename ."'>" . $filename . '</a>' : _('Something is wrong with uploading a file'); } - /* EOR Add Image upload for New Item - by Ori */ } if (isset($Errors)) { @@ -202,7 +204,7 @@ if ($_POST['Serialised']==1){ /*Not appropriate to have several dp on serial items */ $_POST['DecimalPlaces']=0; } - if (!isset($_POST['New']) and !isset($New)) { /*so its an existing one */ + if ($New==0) { /*so its an existing one */ /*first check on the changes being made we must disallow: - changes from manufactured or purchased to Service, Assembly or Kitset if there is stock - changes from manufactured, kitset or assembly where a BOM exists @@ -447,6 +449,7 @@ }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO }//END CHECK FOR ALREADY EXISTING ITEM OF THE SAME CODE } + $New=1; } else { echo '<br>'. "\n"; @@ -563,7 +566,7 @@ unset($StockID); //echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/SelectProduct.php?' . SID ."'>"; - + $New=1; } //end if Delete Part } @@ -572,17 +575,20 @@ <tr><td>'. "\n"; // Nested table echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<input type="hidden" name="New" value="'.$New.'">'. "\n"; + if (!isset($StockID) or $StockID=='' or isset($_POST['UpdateCategories'])) { /*If the page was called without $StockID passed to page then assume a new stock item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden StockID field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/ - - $New = true; - echo '<input type="hidden" name="New" value="1">'. "\n"; if (!isset($StockID)) { - echo '<tr><td>'. _('Item Code'). ':</td><td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="StockID" size=21 maxlength=20 /></td></tr>'. "\n"; + $StockID=''; + } + if ($New==1) { + echo '<tr><td>'. _('Item Code'). ':</td><td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" + value="'.$StockID.'" name="StockID" size=21 maxlength=20 /></td></tr>'. "\n"; } else { - echo '<tr><td>'. _('Item Code'). ':</td><td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="StockID" size=21 maxlength=20 - value="'.$StockID.'" /></td></tr>'. "\n"; + echo '<tr><td>'. _('Item Code'). ':</td><td>'.$StockID.'</td></tr>'. "\n"; + echo '<input type="hidden" name ="StockID" value="'.$StockID.'" />'; } } elseif (!isset($_POST['UpdateCategories']) and $InputError!=1) { // Must be modifying an existing item and no changes made yet @@ -1016,7 +1022,7 @@ echo '</table><br>'; echo '<input type="hidden" name="PropertyCounter" value=' . $PropertyCounter . '>'; -if (isset($New)) { +if ($New==1) { echo '<input type="Submit" name="submit" value="' . _('Insert New Item') . '">'; echo '<input type="submit" name="UpdateCategories" style="visibility:hidden;width:1px" value="' . _('Categories') . '">'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/doc/Change.log.html 2011-04-10 02:04:57 UTC (rev 4544) @@ -1,5 +1,10 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p /> +<p> +<p>10/4/11 Tim: PDFPeriodStockTransListing - new report to print off stock transactions of a specified type for a selected period>/p> +<p>10/4/11 Tim: PDFStockTransListing.php option to print off transactions by inventory location</p> +<p>10/4/11 Tim: Stocks.php - more logical use of $New and $_POST['New']</p> +<p>10/4/11 Tim: Payments.php PaymentMethods.php Add new field userpreprintedstationery to payment methods to determine whether to print cheques</p> <p>5/4/11 Tim: includes/LanguageSetup.php - discovered solution to Turkish character set problem!!</p> <p>5/4/11 Phil: couple of is_date functions left over from experiment to see if changing fixed Turkish - now removed from SupplierInvoice.php and PDFOrdersInvoiced.php</p> <p>5/4/11 Phil: SuppCreditGRNs was not showing old GRNs and no way to input an older date</p> Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/includes/ConnectDB.inc 2011-04-10 02:04:57 UTC (rev 4544) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='4.03.6'; //must update manually every time there is a DB change +$Version='4.03.7'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Added: trunk/includes/PDFPeriodStockTransListingPageHeader.inc =================================================================== --- trunk/includes/PDFPeriodStockTransListingPageHeader.inc (rev 0) +++ trunk/includes/PDFPeriodStockTransListingPageHeader.inc 2011-04-10 02:04:57 UTC (rev 4544) @@ -0,0 +1,59 @@ +<?php +/* $Id: PDFPeriodStockTransListingPageHeader.inc 4307 2010-12-22 16:06:03Z tim_schofield $*/ + +if ($PageNumber>1){ + $pdf->newPage(); +} + +$YPos = $Page_Height - $Top_Margin - 50; + +$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin,$YPos,0,50); + +$FontSize=15; + + +$XPos = $Page_Width/2; +$YPos += 30; +$pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']); +$FontSize=12; +$YPos -=30; +$pdf->addText($XPos, $YPos,$FontSize, $TransType . ' ' ._('dated from') . ' ' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate']); + + +$XPos = $Page_Width-$Right_Margin-50; +$YPos -=30; +$pdf->addText($XPos, $YPos+10,$FontSize, _('Page') . ': ' . $PageNumber); + +/*Now print out the company name and address */ +$XPos = $Left_Margin; +$YPos -= $line_height; + +/*draw a square grid for entering line items */ +$pdf->line($XPos, $YPos,$Page_Width-$Right_Margin, $YPos); +$pdf->line($Page_Width-$Right_Margin, $YPos,$Page_Width-$Right_Margin, $Bottom_Margin); +$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin,$XPos, $Bottom_Margin); +$pdf->line($XPos, $Bottom_Margin,$XPos, $YPos); + +$pdf->line($Left_Margin+160, $YPos,$Left_Margin+160, $Bottom_Margin); +$pdf->line($Left_Margin+240, $YPos,$Left_Margin+240, $Bottom_Margin); +$pdf->line($Left_Margin+310, $YPos,$Left_Margin+310, $Bottom_Margin); +$pdf->line($Left_Margin+384, $YPos,$Left_Margin+384, $Bottom_Margin); +$pdf->line($Left_Margin+454, $YPos,$Left_Margin+454, $Bottom_Margin); + +$YPos -= $line_height; +/*Set up headings */ +$FontSize=8; + +$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,_('Stock Item'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,_('Reference'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,_('Trans Date'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,_('Quantity'), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,_('Location'), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,_('Reference'), 'right'); +$YPos-=$line_height; + +/*draw a line */ +$pdf->line($XPos, $YPos,$Page_Width-$Right_Margin, $YPos); + +$YPos -= ($line_height); +?> \ No newline at end of file Deleted: trunk/includes/PDFStockTransListingPageHeader.inc =================================================================== --- trunk/includes/PDFStockTransListingPageHeader.inc 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/includes/PDFStockTransListingPageHeader.inc 2011-04-10 02:04:57 UTC (rev 4544) @@ -1,79 +0,0 @@ -<?php -/* $Id$*/ -if ($PageNumber>1){ - $pdf->newPage(); -} - -$YPos = $Page_Height - $Top_Margin - 50; - -$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin,$YPos,0,50); - -$FontSize=15; - -Switch ($_POST['TransType']) { - case 10: - $TransType=_('Customer Invoices'); - break; - case 11: - $TransType=_('Customer Credit Notes'); - break; - case 16: - $TransType=_('Location Transfers'); - break; - case 17: - $TransType=_('Stock Adjustments'); - break; - case 25: - $TransType=_('Purchase Order Deliveries'); - break; - case 26: - $TransType=_('Work Order Receipts'); - break; - case 28: - $TransType=_('Work Order Issues'); - break; -} - -$XPos = $Page_Width/2; -$YPos += 30; -$pdf->addText($XPos, $YPos,$FontSize, $_SESSION['CompanyRecord']['coyname']); -$FontSize=12; -$pdf->addText($XPos, $YPos-20,$FontSize, $TransType . ' ' ._('dated') . ' ' . $_POST['Date']); - -$XPos = $Page_Width-$Right_Margin-50; -$YPos -=30; -$pdf->addText($XPos, $YPos+10,$FontSize, _('Page') . ': ' . $PageNumber); - -/*Now print out the company name and address */ -$XPos = $Left_Margin; -$YPos -= $line_height; - -/*draw a square grid for entering line items */ -$pdf->line($XPos, $YPos,$Page_Width-$Right_Margin, $YPos); -$pdf->line($Page_Width-$Right_Margin, $YPos,$Page_Width-$Right_Margin, $Bottom_Margin); -$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin,$XPos, $Bottom_Margin); -$pdf->line($XPos, $Bottom_Margin,$XPos, $YPos); - -$pdf->line($Left_Margin+160, $YPos,$Left_Margin+160, $Bottom_Margin); -$pdf->line($Left_Margin+240, $YPos,$Left_Margin+240, $Bottom_Margin); -$pdf->line($Left_Margin+310, $YPos,$Left_Margin+310, $Bottom_Margin); -$pdf->line($Left_Margin+384, $YPos,$Left_Margin+384, $Bottom_Margin); -$pdf->line($Left_Margin+454, $YPos,$Left_Margin+454, $Bottom_Margin); - -$YPos -= $line_height; -/*Set up headings */ -$FontSize=8; - -$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,_('Stock Item'), 'left'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,_('Reference'), 'left'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,_('Trans Date'), 'left'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,_('Quantity'), 'right'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,_('Location'), 'right'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,_('Reference'), 'right'); -$YPos-=$line_height; - -/*draw a line */ -$pdf->line($XPos, $YPos,$Page_Width-$Right_Margin, $YPos); - -$YPos -= ($line_height); -?> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/index.php 2011-04-10 02:04:57 UTC (rev 4544) @@ -695,7 +695,7 @@ </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/PDFStockTransListing.php">' . _('Daily Stock Transaction Listing') . '</a></p>'; ?> + <?php echo '<p>• <a href="' . $rootpath . '/PDFPeriodStockTransListing.php?">' . _('Period Stock Transaction Listing') . '</a></p>'; ?> </td> </tr> <tr> Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-04-09 06:12:05 UTC (rev 4543) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-04-10 02:04:57 UTC (rev 4544) @@ -838,3 +838,7 @@ UPDATE config SET confvalue='4.03.5' WHERE confname='VersionNumber'; INSERT INTO `scripts` (`script` ,`pagesecurity` ,`description`) VALUES ( 'ReprintGRN.php', '11', 'Allows selection of a goods received batch for reprinting the goods received note given a purchase order number'); UPDATE config SET confvalue='4.03.6' WHERE confname='VersionNumber'; +ALTER TABLE `paymentmethods` ADD `usepreprintedstationery` TINYINT NOT NULL DEFAULT '0'; +DELETE FROM scripts WHERE script='PDFStockTransListing.php'; +INSERT INTO scripts (`script` ,`pagesecurity` ,`description`) VALUES('PDFPeriodStockTransListing.php','3','Allows stock transactions of a specific transaction type to be listed over a single day or period range'); +IUPDATE config SET confvalue='4.03.7' WHERE confname='VersionNumber'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |