From: <tim...@us...> - 2010-07-06 21:59:28
|
Revision: 3576 http://web-erp.svn.sourceforge.net/web-erp/?rev=3576&view=rev Author: tim_schofield Date: 2010-07-06 21:59:22 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Report design changes, screen layout changes, and sql corrections Modified Paths: -------------- trunk/DebtorsAtPeriodEnd.php trunk/doc/Change.log.html trunk/includes/PDFDebtorBalsPageHeader.inc Modified: trunk/DebtorsAtPeriodEnd.php =================================================================== --- trunk/DebtorsAtPeriodEnd.php 2010-07-06 21:59:02 UTC (rev 3575) +++ trunk/DebtorsAtPeriodEnd.php 2010-07-06 21:59:22 UTC (rev 3576) @@ -6,7 +6,7 @@ /* $Revision: 1.16 $ */ include('includes/session.inc'); -If (isset($_POST['PrintPDF']) +if (isset($_POST['PrintPDF']) AND isset($_POST['FromCriteria']) AND strlen($_POST['FromCriteria'])>=1 AND isset($_POST['ToCriteria']) @@ -15,30 +15,30 @@ include('includes/PDFStarter.php'); $pdf->addInfo('Title',_('Customer Balance Listing')); $pdf->addInfo('Subject',_('Customer Balances')); - $FontSize=12; + $FontSize=12; $PageNumber=0; $line_height=12; /*Get the date of the last day in the period selected */ - $SQL = 'SELECT lastdate_in_period FROM periods WHERE periodno = ' . $_POST['PeriodEnd']; + $SQL = "SELECT lastdate_in_period FROM periods WHERE periodno = '" . $_POST['PeriodEnd']."'"; $PeriodEndResult = DB_query($SQL,$db,_('Could not get the date of the last day in the period selected')); $PeriodRow = DB_fetch_row($PeriodEndResult); $PeriodEndDate = ConvertSQLDate($PeriodRow[0]); - /*Now figure out the aged analysis for the customer range under review */ + /*Now figure out the aged analysis for the customer range under review */ - $SQL = 'SELECT debtorsmaster.debtorno, + $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name, currencies.currency, SUM((debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc)/debtortrans.rate) AS balance, SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) AS fxbalance, - SUM(CASE WHEN debtortrans.prd > ' . $_POST['PeriodEnd'] . ' THEN + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN (debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount)/debtortrans.rate ELSE 0 END) AS afterdatetrans, - SUM(CASE WHEN debtortrans.prd > ' . $_POST['PeriodEnd'] . ' + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' AND (debtortrans.type=11 OR debtortrans.type=12) THEN debtortrans.diffonexch ELSE 0 END) AS afterdatediffonexch, - SUM(CASE WHEN debtortrans.prd > ' . $_POST['PeriodEnd'] . " THEN + SUM(CASE WHEN debtortrans.prd > '" . $_POST['PeriodEnd'] . "' THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount ELSE 0 END ) AS fxafterdatetrans FROM debtorsmaster, @@ -70,7 +70,7 @@ $title = _('Customer Balances') . ' - ' . _('Problem Report'); include('includes/header.inc'); prnMsg(_('The customer details listing has no clients to report on'),'warn'); - echo "<br><a href='$rootpath/index.php?" . SID . "'>" . _('Back to the menu') . '</a>'; + echo "<br><a href='".$rootpath."'/index.php?.'" . SID . "'>" . _('Back to the menu') . "</a>"; include('includes/footer.inc'); exit; } @@ -79,19 +79,20 @@ $TotBal=0; - While ($DebtorBalances = DB_fetch_array($CustomerResult,$db)){ + while ($DebtorBalances = DB_fetch_array($CustomerResult,$db)){ $Balance = $DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'] + $DebtorBalances['afterdatediffonexch'] ; $FXBalance = $DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans']; - if (ABS($Balance)>0.009 OR ABS($FXBalance)>0.009) { + if (abs($Balance)>0.009 OR ABS($FXBalance)>0.009) { $DisplayBalance = number_format($DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'],2); $DisplayFXBalance = number_format($DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans'],2); $TotBal += $Balance; - $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,220-$Left_Margin,$FontSize,$DebtorBalances['debtorno'] . ' - ' . $DebtorBalances['name'],'left'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,220-$Left_Margin,$FontSize,$DebtorBalances['debtorno'] . + ' - ' . html_entity_decode($DebtorBalances['name']),'left'); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayBalance,'right'); $LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,$DisplayFXBalance,'right'); $LeftOvers = $pdf->addTextWrap(350,$YPos,100,$FontSize,$DebtorBalances['currency'],'left'); @@ -99,7 +100,7 @@ $YPos -=$line_height; if ($YPos < $Bottom_Margin + $line_height){ - include('includes/PDFDebtorBalsPageHeader.inc'); + include('includes/PDFDebtorBalsPageHeader.inc'); } } } /*end customer aged analysis while loop */ @@ -112,8 +113,9 @@ $DisplayTotBalance = number_format($TotBal,2); + $LeftOvers = $pdf->addTextWrap(50,$YPos,160,$FontSize,_('Total balances'),'left'); $LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,$DisplayTotBalance,'right'); - /* UldisN + /* UldisN $buf = $pdf->output(); $len = strlen($buf); @@ -125,20 +127,22 @@ header('Pragma: public'); $pdf->stream(); - */ - $pdf->OutputD($_SESSION['DatabaseName'] . '_DebtorBals_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN + */ + $pdf->OutputD($_SESSION['DatabaseName'] . '_DebtorBals_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN } else { /*The option to print PDF was not hit */ $title=_('Debtor Balances'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . + '" alt="">' . ' ' . $title.'<br>'; if (!isset($_POST['FromCriteria']) || !isset($_POST['ToCriteria'])) { /*if $FromCriteria is not set then show a form to allow input */ - echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table>"; + echo '<form action=' . $_SERVER['PHP_SELF'] . " method='POST'><table class=selection>"; echo '<tr><td>' . _('From Customer Code') .":</font></td><td><input tabindex=1 Type=text maxlength=6 size=7 name=FromCriteria value='1'></td></tr>"; echo '<tr><td>' . _('To Customer Code') . ":</td><td><input tabindex=2 Type=text maxlength=6 size=7 name=ToCriteria value='zzzzzz'></td></tr>"; @@ -158,9 +162,9 @@ echo '</select></td></tr>'; - echo "</table><div class='centre'><input tabindex=5 type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; + echo "</table><br><div class='centre'><input tabindex=5 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-06 21:59:02 UTC (rev 3575) +++ trunk/doc/Change.log.html 2010-07-06 21:59:22 UTC (rev 3576) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: DebtorsAtPeriodEnd.php - Report design changes, screen layout changes, and sql corrections</p> <p>05/07/10 Tim: CustWhereAlloc.php - Layout changes and correction to sql statement</p> <p>05/07/10 Tim: CustomerTypes.php - Misc minor bug fixes, layout changes and correction to sql statement</p> <p>05/07/10 Tim: Customers.php - Layout changes and correction to sql statement</p> Modified: trunk/includes/PDFDebtorBalsPageHeader.inc =================================================================== --- trunk/includes/PDFDebtorBalsPageHeader.inc 2010-07-06 21:59:02 UTC (rev 3575) +++ trunk/includes/PDFDebtorBalsPageHeader.inc 2010-07-06 21:59:22 UTC (rev 3576) @@ -22,19 +22,22 @@ $YPos -=(3*$line_height); /*Draw a rectangle to put the headings in */ -$pdf->line($Page_Width-$Right_Margin, $YPos-5,$Left_Margin, $YPos-5); -$pdf->line($Page_Width-$Right_Margin, $YPos+$line_height,$Left_Margin, $YPos+$line_height); -$pdf->line($Page_Width-$Right_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos-5); -$pdf->line($Left_Margin, $YPos+$line_height,$Left_Margin, $YPos-5); +$pdf->rectangle($Left_Margin, $YPos+$line_height, $Page_Width-$Right_Margin-$Left_Margin,$line_height+5 ); /*set up the headings */ -$Xpos = $Left_Margin+1; +$Xpos = $Left_Margin+3; -$LeftOvers = $pdf->addTextWrap($Xpos,$YPos,220 - $Left_Margin,$FontSize,_('Customer'),'centre'); -$LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,_('Balance'),'centre'); -$LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,_('FX'),'centre'); -$LeftOvers = $pdf->addTextWrap(340,$YPos,60,$FontSize,_('Currency'),'centre'); +$LeftOvers = $pdf->addTextWrap($Xpos,$YPos,220 - $Left_Margin,$FontSize,_('Customer'),'left'); +$LeftOvers = $pdf->addTextWrap(220,$YPos,60,$FontSize,_('Balance'),'right'); +$LeftOvers = $pdf->addTextWrap(280,$YPos,60,$FontSize,_('FX'),'right'); +$LeftOvers = $pdf->addTextWrap(350,$YPos,60,$FontSize,_('Currency'),'left'); +$pdf->rectangle($Left_Margin, $YPos+$line_height, $Page_Width-$Right_Margin-$Left_Margin,$Page_Height-($line_height*5)-$Bottom_Margin-5 ); + +$pdf->line(218, $YPos+$line_height, 218, $Bottom_Margin); +$pdf->line(282, $YPos+$line_height, 282, $Bottom_Margin); +$pdf->line(342, $YPos+$line_height, 342, $Bottom_Margin); + $YPos =$YPos - (2*$line_height); ?> \ 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-06 21:59:47
|
Revision: 3577 http://web-erp.svn.sourceforge.net/web-erp/?rev=3577&view=rev Author: tim_schofield Date: 2010-07-06 21:59:41 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Sql corrections Modified Paths: -------------- trunk/DeliveryDetails.php trunk/doc/Change.log.html Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2010-07-06 21:59:22 UTC (rev 3576) +++ trunk/DeliveryDetails.php 2010-07-06 21:59:41 UTC (rev 3577) @@ -127,7 +127,7 @@ prnMsg(_($_POST['FreightCost']),'warn'); } } - $sql = 'SELECT custbranch.brname, + $sql = "SELECT custbranch.brname, custbranch.braddress1, custbranch.braddress2, custbranch.braddress3, @@ -142,8 +142,8 @@ custbranch.specialinstructions, custbranch.estdeliverydays FROM custbranch - WHERE custbranch.branchcode='."'" . $_SESSION['Items'.$identifier]->Branch . "'". - ' AND custbranch.debtorno = '."'" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' + AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->CustomerName . ' ' . _('cannot be retrieved because'); $DbgMsg = _('SQL used to retrieve the branch details was') . ':'; @@ -221,9 +221,9 @@ - if shippers defined but the default shipper is bogus then use the first shipper defined */ if ((isset($BestShipper) and $BestShipper=='') AND ($_POST['ShipVia']=='' || !isset($_POST['ShipVia']))){ - $sql = 'SELECT shipper_id + $sql = "SELECT shipper_id FROM shippers - WHERE shipper_id=' . $_SESSION['Default_Shipper']; + WHERE shipper_id='" . $_SESSION['Default_Shipper']."'"; $ErrMsg = _('There was a problem testing for the default shipper'); $DbgMsg = _('SQL used to test for the default shipper') . ':'; $TestShipperExists = DB_query($sql,$db,$ErrMsg,$DbgMsg); @@ -234,8 +234,8 @@ } else { - $sql = 'SELECT shipper_id - FROM shippers'; + $sql = "SELECT shipper_id + FROM shippers"; $TestShipperExists = DB_query($sql,$db,$ErrMsg,$DbgMsg); if (DB_num_rows($TestShipperExists)>=1){ @@ -284,12 +284,12 @@ } else { /*check the customer's payment terms */ - $sql = 'SELECT daysbeforedue, + $sql = "SELECT daysbeforedue, dayinfollowingmonth FROM debtorsmaster, paymentterms WHERE debtorsmaster.paymentterms=paymentterms.termsindicator - AND debtorsmaster.debtorno = '."'" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; + AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; $ErrMsg = _('The customer terms cannot be determined') . '. ' . _('This order cannot be processed because'); $DbgMsg = _('SQL used to find the customer terms') . ':'; @@ -325,7 +325,7 @@ $OrderNo = GetNextTransNo(30, $db); - $HeaderSQL = 'INSERT INTO salesorders ( + $HeaderSQL = "INSERT INTO salesorders ( orderno, debtorno, branchcode, @@ -351,37 +351,37 @@ quotation, deliverblind) VALUES ( - '. $OrderNo . ', - '."'" . $_SESSION['Items'.$identifier]->DebtorNo . "'".', - '."'" . $_SESSION['Items'.$identifier]->Branch . "'".', - '."'". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."'".', - '."'". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."'".', - '."'" . Date("Y-m-d H:i") . "'".', - '."'" . $_SESSION['Items'.$identifier]->DefaultSalesType . "'".', - ' . $_POST['ShipVia'] .', - '."'". DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "'".', - '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "'".', - '."'" . $_SESSION['Items'.$identifier]->PhoneNo . "'".', - '."'" . $_SESSION['Items'.$identifier]->Email . "'".', - ' . $_SESSION['Items'.$identifier]->FreightCost .', - '."'" . $_SESSION['Items'.$identifier]->Location ."'".', - '."'" . $DelDate . "'".', - '."'" . $QuotDate . "'".', - '."'" . $ConfDate . "'".', - ' . $_SESSION['Items'.$identifier]->Quotation . ', - ' . $_SESSION['Items'.$identifier]->DeliverBlind .' - )'; + '". $OrderNo . "', + '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + '" . $_SESSION['Items'.$identifier]->Branch . "', + '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', + '" . Date("Y-m-d H:i") . "', + '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', + '" . $_POST['ShipVia'] ."', + '". DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', + '" . $_SESSION['Items'.$identifier]->PhoneNo . "', + '" . $_SESSION['Items'.$identifier]->Email . "', + '" . $_SESSION['Items'.$identifier]->FreightCost ."', + '" . $_SESSION['Items'.$identifier]->Location ."', + '" . $DelDate . "', + '" . $QuotDate . "', + '" . $ConfDate . "', + '" . $_SESSION['Items'.$identifier]->Quotation . "', + '" . $_SESSION['Items'.$identifier]->DeliverBlind ."' + )"; $ErrMsg = _('The order cannot be added because'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg); - $StartOf_LineItemsSQL = 'INSERT INTO salesorderdetails ( + $StartOf_LineItemsSQL = "INSERT INTO salesorderdetails ( orderlineno, orderno, stkcode, @@ -391,21 +391,21 @@ narrative, poline, itemdue) - VALUES ('; + VALUES ("; $DbgMsg = _('The SQL that failed was'); foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { - $LineItemsSQL = $StartOf_LineItemsSQL . - $StockItem->LineNumber . ', - ' . $OrderNo . ', - '."'" . $StockItem->StockID . "'".', - '. $StockItem->Price . ', - ' . $StockItem->Quantity . ', - ' . floatval($StockItem->DiscountPercent) . ', - '."'" . DB_escape_string($StockItem->Narrative) . "'".', - '."'" . $StockItem->POLine . "'".', - '."'" . FormatDateForSQL($StockItem->ItemDue) . "'".' - )'; + $LineItemsSQL = $StartOf_LineItemsSQL ." + '" . $StockItem->LineNumber . "', + '" . $OrderNo . "', + '" . $StockItem->StockID . "', + '" . $StockItem->Price . "', + '" . $StockItem->Quantity . "', + '" . floatval($StockItem->DiscountPercent) . "', + '" . DB_escape_string($StockItem->Narrative) . "', + '" . $StockItem->POLine . "', + '" . FormatDateForSQL($StockItem->ItemDue) . "' + )"; $ErrMsg = _('Unable to add the sales order line'); $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); @@ -483,7 +483,7 @@ loccode, requiredby, startdate) - VALUES (" . $WONo . ", + VALUES ('" . $WONo . "', '" . $_SESSION['DefaultFactoryLocation'] . "', '" . Date('Y-m-d') . "', '" . Date('Y-m-d'). "')", @@ -508,10 +508,10 @@ stockid, qtyreqd, stdcost) - VALUES ( " . $WONo . ", + VALUES ( '" . $WONo . "', '" . $StockItem->StockID . "', - " . $WOQuantity . ", - " . $Cost . ")"; + '" . $WOQuantity . "', + '" . $Cost . "')"; $ErrMsg = _('The work order item could not be added'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -535,12 +535,12 @@ $WOQuantity++; prnMsg(($StockItem->NextSerialNo + $i) . ': ' . _('This automatically generated serial number already exists - it cannot be added to the work order'),'error'); } else { - $sql = 'INSERT INTO woserialnos (wo, + $sql = "INSERT INTO woserialnos (wo, stockid, serialno) - VALUES (' . $WONo . ", + VALUES ('" . $WONo . "', '" . $StockItem->StockID . "', - " . ($StockItem->NextSerialNo + $i) . ')'; + '" . ($StockItem->NextSerialNo + $i) . "')"; $ErrMsg = _('The serial number for the work order item could not be added'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $FactoryManagerEmail .= "\n" . ($StockItem->NextSerialNo + $i); @@ -604,34 +604,34 @@ $Result = DB_Txn_Begin($db); - $HeaderSQL = 'UPDATE salesorders - SET debtorno = '."'" . $_SESSION['Items'.$identifier]->DebtorNo . "'".', - branchcode = '."'" . $_SESSION['Items'.$identifier]->Branch . "'".', - customerref = '."'". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."'".', - comments = '."'". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."'".', - ordertype = '."'" . $_SESSION['Items'.$identifier]->DefaultSalesType . "'".', - shipvia = ' . $_POST['ShipVia'] .', - deliverydate = '."'" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "'".', - quotedate = '."'" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "'".', - confirmeddate = '."'" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "'".', - deliverto = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "'".', - deladd1 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "'".', - deladd2 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "'".', - deladd3 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "'".', - deladd4 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "'".', - deladd5 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "'".', - deladd6 = '."'" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "'".', - contactphone = '."'" . $_SESSION['Items'.$identifier]->PhoneNo . "'".', - 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 . ' - WHERE salesorders.orderno=' . $_SESSION['ExistingOrder']; + $HeaderSQL = "UPDATE salesorders + SET debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "', + branchcode = '" . $_SESSION['Items'.$identifier]->Branch . "', + customerref = '". DB_escape_string($_SESSION['Items'.$identifier]->CustRef) ."', + comments = '". DB_escape_string($_SESSION['Items'.$identifier]->Comments) ."', + ordertype = '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', + shipvia = '" . $_POST['ShipVia'] . "', + deliverydate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->DeliveryDate)) . "', + quotedate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->QuoteDate)) . "', + confirmeddate = '" . FormatDateForSQL(DB_escape_string($_SESSION['Items'.$identifier]->ConfirmedDate)) . "', + deliverto = '" . DB_escape_string($_SESSION['Items'.$identifier]->DeliverTo) . "', + deladd1 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd1) . "', + deladd2 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd2) . "', + deladd3 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd3) . "', + deladd4 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd4) . "', + deladd5 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd5) . "', + deladd6 = '" . DB_escape_string($_SESSION['Items'.$identifier]->DelAdd6) . "', + contactphone = '" . $_SESSION['Items'.$identifier]->PhoneNo . "', + 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 . "' + WHERE salesorders.orderno='" . $_SESSION['ExistingOrder'] ."'"; $DbgMsg = _('The SQL that was used to update the order and failed was'); $ErrMsg = _('The order cannot be updated because'); @@ -648,14 +648,14 @@ $Completed = 0; } - $LineItemsSQL = 'UPDATE salesorderdetails SET unitprice=' . $StockItem->Price . ', - quantity=' . $StockItem->Quantity . ', - discountpercent=' . floatval($StockItem->DiscountPercent) . ', - completed=' . $Completed . ', - poline='."'" . $StockItem->POLine . "'".', - itemdue='."'" . FormatDateForSQL($StockItem->ItemDue) . "'".' - WHERE salesorderdetails.orderno=' . $_SESSION['ExistingOrder'] . ' - AND salesorderdetails.orderlineno='."'" . $StockItem->LineNumber . "'"; + $LineItemsSQL = "UPDATE salesorderdetails SET unitprice='" . $StockItem->Price . "', + quantity='" . $StockItem->Quantity . "', + discountpercent='" . floatval($StockItem->DiscountPercent) . "', + completed='" . $Completed . "', + poline='" . $StockItem->POLine . "', + itemdue='" . FormatDateForSQL($StockItem->ItemDue) . "' + WHERE salesorderdetails.orderno='" . $_SESSION['ExistingOrder'] . "' + AND salesorderdetails.orderlineno='" . $StockItem->LineNumber . "'"; $DbgMsg = _('The SQL that was used to modify the order line and failed was'); $ErrMsg = _('The updated order line cannot be modified because'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 21:59:22 UTC (rev 3576) +++ trunk/doc/Change.log.html 2010-07-06 21:59:41 UTC (rev 3577) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: DeliveryDetails.php - sql corrections</p> <p>05/07/10 Tim: DebtorsAtPeriodEnd.php - Report design changes, screen layout changes, and sql corrections</p> <p>05/07/10 Tim: CustWhereAlloc.php - Layout changes and correction to sql statement</p> <p>05/07/10 Tim: CustomerTypes.php - Misc minor bug fixes, layout changes and correction to 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-07-06 22:00:05
|
Revision: 3578 http://web-erp.svn.sourceforge.net/web-erp/?rev=3578&view=rev Author: tim_schofield Date: 2010-07-06 21:59:59 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Remove redundant file Modified Paths: -------------- trunk/doc/Change.log.html Removed Paths: ------------- trunk/DemandWorkOrders.php Deleted: trunk/DemandWorkOrders.php =================================================================== --- trunk/DemandWorkOrders.php 2010-07-06 21:59:41 UTC (rev 3577) +++ trunk/DemandWorkOrders.php 2010-07-06 21:59:59 UTC (rev 3578) @@ -1,176 +0,0 @@ -<?php -// create work orders for all finished products with sales orders that exceed on hand and on work order quantities -/* $Id$*/ - -$PageSecurity = 10; - -include('includes/session.inc'); - -$title = _('Demand Work Orders'); - -include('includes/header.inc'); -include('includes/SQL_CommonFunctions.inc'); - -$SQL = "SELECT stockmaster.stockid, - stockmaster.description, - SUM(locstock.quantity) AS qoh, - stockmaster.units, - stockmaster.eoq AS eoq - FROM stockmaster, - locstock - WHERE stockmaster.stockid=locstock.stockid - AND stockmaster.categoryid='F' - GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; -$StockItemsResult = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<table>'; -echo '<tr><td class="label">Stock ID</td>'; -echo '<td class="label">Work Order</td>'; -echo '<td class="label">Description</td>'; -echo '<td class="label">Quantity</td>'; -echo '<td class="label">Picture</td>'; -echo '<td class="label">Drawing</td></tr>'; -while ($myrow=DB_fetch_array($StockItemsResult)) { - $StockId = $myrow['stockid']; - $StockQOH = $myrow['qoh']; - $StockEOQ = $myrow['eoq']; - $StockDescription = $myrow['description']; - $StockQOWO = 0; - $sql3 = "SELECT SUM(woitems.qtyreqd-woitems.qtyrecd) AS qtywo - FROM woitems INNER JOIN workorders - ON woitems.wo=workorders.wo - WHERE workorders.closed=0 - AND woitems.stockid='" . $StockId . "'"; - $ErrMsg = _('The quantity on work orders for this product cannot be retrieved because'); - $QOOResult = DB_query($sql3,$db,$ErrMsg); - if (DB_num_rows($QOOResult)==1){ - $QOORow = DB_fetch_row($QOOResult); - $StockQOWO += $QOORow[0]; - } - $StockDemand =0; - $DemResult = DB_query("SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS demand, - salesorderdetails.itemdue, - salesorders.deliverydate - FROM salesorderdetails INNER JOIN salesorders - ON salesorders.orderno = salesorderdetails.orderno - WHERE salesorderdetails.completed=0 - AND salesorders.quotation=0 - AND salesorderdetails.stkcode='" . $StockId . "' - AND salesorderdetails.qtyinvoiced < salesorderdetails.quantity - GROUP BY salesorderdetails.stkcode", - $db); - - $DemRow = DB_fetch_row($DemResult); - $StockDemand = $DemRow[0]; - $DemandDate = $DemRow[1]; - If(strlen(trim($DemandDate)) == 0) - { - $DemandDate = $DemRow[2]; - } - If($StockQOH < 0) - { - $StockQOH = 0; - } - If($StockQOH + $StockQOWO - $StockDemand < 0) - { - $DemandQuantity = $StockDemand - ($StockQOH + $StockQOWO); - If($StockEOQ > 0) - { - If($StockEOQ > $DemandQuantity) - { - $DemandQuantity = $StockEOQ; - } - else - { - $EOQMultiple = Round(($DemandQuantity/$StockEOQ)+.49,0); - $DemandQuantity = $StockEOQ*$EOQMultiple; - } - } - $WO = GetNextTransNo(30,$db); - // echo $WO. "= WO<br>"; - $InsWOResult = DB_query("INSERT INTO workorders (wo, - loccode, - requiredby, - startdate) - VALUES (" . $WO . ", - '" . $_SESSION['UserStockLocation'] . "', - '" . $DemandDate . "', - '" . Date('Y-m-d'). "')", - $db); - - $sql = "INSERT INTO woitems (wo, - stockid, - qtyreqd, - stdcost) - VALUES ( " . $WO . ", - '" . $StockId . "', - " . $DemandQuantity . ", - 0)"; - $result = DB_query($sql,$db,$ErrMsg); - $sql2 = "INSERT INTO worequirements (wo, - parentstockid, - stockid, - qtypu, - stdcost, - autoissue) - SELECT " . $WO . ", - bom.parent, - bom.component, - bom.quantity, - (materialcost+labourcost+overheadcost)*bom.quantity, - autoissue - FROM bom INNER JOIN stockmaster - ON bom.component=stockmaster.stockid - WHERE parent='" . $StockId . "' - AND loccode ='" . $_POST['StockLocation'] . "'"; - - $result = DB_query($sql2,$db,$ErrMsg); - echo '<tr><td>' . $StockId . '</td>'; - echo '<td>' . $WO . '</td>'; - echo '<td>' .$StockDescription . '</td>'; - echo '<td class="label">' . $DemandQuantity .'</td>'; - $PictureToDisplay = '/srv/www/htdocs/batavg/webERP2/companies/' . $_SESSION['DatabaseName'] . '/part_pics/' . $StockId . '.jpg' ; - If(file_exists ( $PictureToDisplay)) - { - echo '<td class="label">OK</td>'; - } - else - { - echo '<td class="label">Need Picture</td>'; - } - $DrawingPath = "/srv/www/htdocs/batavg/" . $rootpath . "/companies/" . $_SESSION['DatabaseName'] . '/Drawings'; - - $FileToDisplay = ''; - If($handle = opendir($DrawingPath)) - { - While(false !== ($file = readdir($handle))) - { - If(strpos($file,$StockId)) - { - $FileToDisplay = Trim($file); - break; - } - If(strlen(trim($FileToDisplay)) > 0) - { - break; - } - } - } - If(file_exists ( $DrawingPath . "/" . $FileToDisplay) and strlen(trim($FileToDisplay)) > 0) - { - echo '<td class="label">OK</td>'; - } - else - { - echo '<td class="label">Need Drawing</td>'; - } - echo '</tr>'; - } -} -echo '</table>'; -echo '<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>'; -include('includes/footer.inc'); - -?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 21:59:41 UTC (rev 3577) +++ trunk/doc/Change.log.html 2010-07-06 21:59:59 UTC (rev 3578) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: DemandWorkOrders.php - Remove redundant file</p> <p>05/07/10 Tim: DeliveryDetails.php - sql corrections</p> <p>05/07/10 Tim: DebtorsAtPeriodEnd.php - Report design changes, screen layout changes, and sql corrections</p> <p>05/07/10 Tim: CustWhereAlloc.php - Layout changes and correction to 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-07-06 22:00:36
|
Revision: 3579 http://web-erp.svn.sourceforge.net/web-erp/?rev=3579&view=rev Author: tim_schofield Date: 2010-07-06 22:00:30 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Layout improvements Modified Paths: -------------- trunk/DiscountCategories.php trunk/doc/Change.log.html Modified: trunk/DiscountCategories.php =================================================================== --- trunk/DiscountCategories.php 2010-07-06 21:59:59 UTC (rev 3578) +++ trunk/DiscountCategories.php 2010-07-06 22:00:30 UTC (rev 3579) @@ -58,9 +58,10 @@ $sql="UPDATE stockmaster SET discountcategory='' WHERE stockid='" . trim(strtoupper($_GET['StockID'])) ."'"; $result = DB_query($sql,$db); prnMsg( _('The stock master record has been updated to no discount category'),'success'); + echo '<br>'; } elseif (isset($_POST['submitcategory'])) { - $sql="UPDATE stockmaster - SET discountcategory='".$_POST['DiscountCategory']."' + $sql="UPDATE stockmaster + SET discountcategory='".$_POST['DiscountCategory']."' WHERE categoryid='".$_POST['stockcategory']."'"; $result=DB_query($sql, $db); } @@ -71,7 +72,7 @@ $sql = "SELECT DISTINCT discountcategory FROM stockmaster WHERE discountcategory <>''"; $result = DB_query($sql, $db); if (DB_num_rows($result) > 0) { - echo '<table><tr><td>'. _('Discount Category Code') .': </td>'; + echo '<table class=selection><tr><td>'. _('Discount Category Code') .': </td>'; echo '<td><select name="DiscCat" onChange="ReloadForm(update.select)">'; @@ -91,16 +92,16 @@ echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; echo '<input type="hidden" name="chooseoption" value="'.$_POST['chooseoption'].'">'; echo '<input type="hidden" name="selectchoice" value="'.$_POST['selectchoice'].'">'; - + if (isset($_POST['chooseoption']) and $_POST['chooseoption']==1) { - echo '<table><tr><td>'. _('Discount Category Code') .':</td><td>'; - + echo '<table class=selection><tr><td>'. _('Discount Category Code') .':</td><td>'; + if (isset($_POST['DiscCat'])) { - echo "<input type='text' name='DiscountCategory' maxlength=2 size=2 value='" . $_POST['DiscCat'] . + echo "<input type='text' name='DiscountCategory' maxlength=2 size=2 value='" . $_POST['DiscCat'] . "'></td><td>"._('OR')."</td><td></td><td>"._('OR')."</td></tr>"; } else { echo "<input type='text' name='DiscountCategory' maxlength=2 size=2></td><td>". - _('OR')."</td><td></td><td>"._('OR')."</td></tr>"; + _('OR')."</td><td></td><td>"._('OR')."</td></tr>"; } if (!isset($_POST['StockID'])) { @@ -121,14 +122,14 @@ echo '</table>'; echo "<br><div class='centre'><input type='Submit' name='submit' value='". _('Update Item') ."'></div>"; - + if (isset($_POST['search'])) { if ($_POST['PartID']!='' and $_POST['PartDesc']=='') $sql='SELECT stockid, description FROM stockmaster WHERE stockid LIKE"%'.$_POST['PartID'].'%"'; if ($_POST['PartID']=='' and $_POST['PartDesc']!='') $sql='SELECT stockid, description FROM stockmaster WHERE description LIKE"%'.$_POST['PartDesc'].'%"'; if ($_POST['PartID']!='' and $_POST['PartDesc']!='') - $sql='SELECT stockid, description FROM stockmaster WHERE stockid LIKE"%'.$_POST['PartID'].'%" and + $sql='SELECT stockid, description FROM stockmaster WHERE stockid LIKE"%'.$_POST['PartID'].'%" and description LIKE"%'.$_POST['PartDesc'].'%"'; $result=DB_query($sql,$db); if (!isset($_POST['stockID'])) { @@ -139,11 +140,11 @@ } } } else { - echo '<table><tr><td>'._('Assign discount category').'</td>'; + echo '<table class=selection><tr><td>'._('Assign discount category').'</td>'; echo '<td><input type="text" name="DiscountCategory" maxlength=2 size=2></td>'; echo '<td>'._('to all items in stock category').'</td>'; - $sql = 'SELECT categoryid, - categorydescription + $sql = 'SELECT categoryid, + categorydescription FROM stockcategory'; $result = DB_query($sql, $db); echo '<td><select name="stockcategory">'; @@ -154,7 +155,7 @@ echo "<br><div class='centre'><input type='Submit' name='submitcategory' value='". _('Update Items') ."'></div>"; } echo '</form>'; - + if (! isset($_POST['DiscCat'])){ /*set DiscCat to something to show results for first cat defined */ $sql = "SELECT DISTINCT discountcategory FROM stockmaster WHERE discountcategory <>''"; @@ -179,7 +180,7 @@ $result = DB_query($sql,$db); - echo '<br><table border=1>'; + echo '<br><table class=selection>'; echo "<tr> <th>". _('Discount Category') ."</th> <th>". _('Item') .'</th></tr>'; @@ -218,7 +219,7 @@ if (!isset($_POST['selectchoice'])) { echo "<form method='post' name='choose' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo '<table>'; + echo '<table class=selection>'; echo '<tr><td>'._('Update discount category for').'</td>'; echo '<td><select name="chooseoption" onChange="ReloadForm(choose.selectchoice)">'; echo '<option value="1">'._('a single stock item').'</option>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 21:59:59 UTC (rev 3578) +++ trunk/doc/Change.log.html 2010-07-06 22:00:30 UTC (rev 3579) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: DiscountCategories.php - Layout improvements</p> <p>05/07/10 Tim: DemandWorkOrders.php - Remove redundant file</p> <p>05/07/10 Tim: DeliveryDetails.php - sql corrections</p> <p>05/07/10 Tim: DebtorsAtPeriodEnd.php - Report design changes, screen layout changes, and sql 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-06 22:00:55
|
Revision: 3580 http://web-erp.svn.sourceforge.net/web-erp/?rev=3580&view=rev Author: tim_schofield Date: 2010-07-06 22:00:49 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Layout improvements Modified Paths: -------------- trunk/DiscountMatrix.php trunk/doc/Change.log.html Modified: trunk/DiscountMatrix.php =================================================================== --- trunk/DiscountMatrix.php 2010-07-06 22:00:30 UTC (rev 3579) +++ trunk/DiscountMatrix.php 2010-07-06 22:00:49 UTC (rev 3580) @@ -59,11 +59,12 @@ discountrate) VALUES('" . $_POST['SalesType'] . "', '" . $_POST['DiscountCategory'] . "', - " . $_POST['QuantityBreak'] . ", - " . ($_POST['DiscountRate']/100) . ')'; + '" . $_POST['QuantityBreak'] . "', + '" . ($_POST['DiscountRate']/100) . "')"; $result = DB_query($sql,$db); prnMsg( _('The discount matrix record has been added'),'success'); + echo '<br>'; unset($_POST['DiscountCategory']); unset($_POST['SalesType']); unset($_POST['QuantityBreak']); @@ -75,16 +76,17 @@ $sql="DELETE FROM discountmatrix WHERE discountcategory='" .$_GET['DiscountCategory'] . "' AND salestype='" . $_GET['SalesType'] . "' - AND quantitybreak=" . $_GET['QuantityBreak']; + AND quantitybreak='" . $_GET['QuantityBreak']."'"; $result = DB_query($sql,$db); prnMsg( _('The discount matrix record has been deleted'),'success'); + echo '<br>'; } echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; -echo '<table>'; +echo '<table class=selection>'; $sql = 'SELECT typeabbrev, sales_type @@ -133,7 +135,7 @@ "type='text' name='DiscountRate' size=4 maxlength=4></td></tr>"; echo '</table><br>'; -echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='" . _('Enter Information') . "'></div><hr>"; +echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='" . _('Enter Information') . "'></div><br>"; $sql = 'SELECT sales_type, salestype, @@ -148,7 +150,7 @@ $result = DB_query($sql,$db); -echo '<table>'; +echo '<table class=selection>'; echo "<tr><th>" . _('Sales Type') . "</th> <th>" . _('Discount Category') . "</th> <th>" . _('Quantity Break') . "</th> @@ -185,4 +187,4 @@ echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 22:00:30 UTC (rev 3579) +++ trunk/doc/Change.log.html 2010-07-06 22:00:49 UTC (rev 3580) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: DiscountMatrix.php - Layout improvements</p> <p>05/07/10 Tim: DiscountCategories.php - Layout improvements</p> <p>05/07/10 Tim: DemandWorkOrders.php - Remove redundant file</p> <p>05/07/10 Tim: DeliveryDetails.php - sql 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-06 22:01:13
|
Revision: 3581 http://web-erp.svn.sourceforge.net/web-erp/?rev=3581&view=rev Author: tim_schofield Date: 2010-07-06 22:01:07 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Bug fixes with updating the format Modified Paths: -------------- trunk/EDIMessageFormat.php trunk/doc/Change.log.html Modified: trunk/EDIMessageFormat.php =================================================================== --- trunk/EDIMessageFormat.php 2010-07-06 22:00:49 UTC (rev 3580) +++ trunk/EDIMessageFormat.php 2010-07-06 22:01:07 UTC (rev 3581) @@ -33,7 +33,7 @@ sequenceno, section, linetext) - SELECT '$PartnerCode', + SELECT '".$PartnerCode."', 'INVOIC', sequenceno, section, @@ -46,75 +46,65 @@ $result = DB_query($sql,$db,$ErrMsg); } +$InputError = 0; +if ($InputError !=1 and isset($_POST['update'])) { -if (isset($_POST['submit'])) { - - //initialise no input errors assumed initially before we test - $InputError = 0; - - /* actions to take once the user has clicked the submit button - ie the page has called itself with some user input */ - - //first off validate inputs sensible - - /* - if (($_POST['PandL']!=1 AND $_POST['PandL']!=0 AND $_POST['PandL']!=-1)) { - $InputError = 1; - echo "The profit and loss account flag must be either 1 or 0. 1 indicates that the account is a profit and loss account"; + /*SelectedMessageLine could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ + if (!isset($SelectedMessageLine)) { + $SelectedMessageLine=''; } - */ + $sql = "UPDATE edimessageformat + SET partnercode='" . $PartnerCode . "', + messagetype='" . $MessageType . "', + section='" . $_POST['Section'] . "', + sequenceno='" . $_POST['SequenceNo'] . "', + linetext='" . $_POST['LineText'] . "' + WHERE id = '" . $SelectedMessageLine . "'"; + $result = DB_query($sql,$db); + $msg = _('Message line updated'); + unset ($SelectedMessageLine); - if ($InputError !=1) { +} elseif ($InputError !=1 and isset($_POST['submit'])) { - /*SelectedMessageLine could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/ - if (!isset($SelectedMessageLine)) {$SelectedMessageLine='';} - $sql = "UPDATE edimessageformat - SET - partnercode='" . $PartnerCode . "', - messagetype='" . $MessageType . "', - section='" . $_POST['Section'] . "', - sequenceno=" . $_POST['SequenceNo'] . ", - linetext='" . $_POST['LineText'] . "' - WHERE id = '" . $SelectedMessageLine . "'"; +/*Selected group is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new message line form */ - $msg = _('Message line updated'); - - } elseif ($InputError !=1) { - - /*Selected group is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new message line form */ - - $sql = "INSERT INTO edimessageformat ( - partnercode, - messagetype, - section, - sequenceno, - linetext) - VALUES ( - '" . $PartnerCode . "', - '" . $MessageType . "', - '" . $_POST['Section'] . "', - " . $_POST['SequenceNo'] . ", - '" . $_POST['LineText'] . "' - )"; + $sql = "INSERT INTO edimessageformat ( + partnercode, + messagetype, + section, + sequenceno, + linetext) + VALUES ( + '" . $PartnerCode . "', + '" . $MessageType . "', + '" . $_POST['Section'] . "', + '" . $_POST['SequenceNo'] . "', + '" . $_POST['LineText'] . "' + )"; $msg = _('Message line added'); - } //run the SQL from either of the above possibilites $result = DB_query($sql,$db); - prnMsg($msg,'success'); unset ($SelectedMessageLine); } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button - $sql='DELETE FROM edimessageformat WHERE id=' . $_GET['delete']; + $sql="DELETE FROM edimessageformat WHERE id='" . $_GET['delete']."'"; $result = DB_query($sql,$db); - prnMsg(_('The selected message line has been deleted'),'success'); + $msg='The selected message line has been deleted'; } +if (isset($msg)) { + prnMsg($msg,'success'); +} echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; +echo '<p><table border=0 width=100%> + <p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="">' . ' ' . $title.'</p>'; + if (!isset($SelectedMessageLine)) { /* A message line could be posted when one has been edited and is being updated or GOT when selected for modification SelectedMessageLine will exist because it was sent with the page in a GET . @@ -123,8 +113,6 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - echo '<font size=4>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode; - $sql = "SELECT id, section, sequenceno, @@ -136,7 +124,8 @@ $result = DB_query($sql,$db); - echo '<table>'; + echo '<table class=selection>'; + echo '<tr><th colspan=5><font size=3>' . _('Definition of') . ' ' . $MessageType . ' ' . _('for') . ' ' . $PartnerCode."</font></th></tr>"; $TableHeader = "<tr> <th>" . _('Section') . "</th> <th>" . _('Sequence') . "</th> @@ -173,7 +162,8 @@ } //END WHILE LIST LOOP echo '</table><p>'; if (DB_num_rows($result)==0){ - echo "<div class='centre'><input tabindex=1 type=submit name='NewEDIInvMsg' VALUE='" . _('Create New EDI Invoice Message From Default Template') . "'></div>"; + echo "<div class='centre'><input tabindex=1 type=submit name='NewEDIInvMsg' value='" . + _('Create New EDI Invoice Message From Default Template') . "'></div><br>"; } } //end of ifs SelectedLine is not set @@ -199,8 +189,6 @@ $_POST['SequenceNo'] = $myrow['sequenceno']; $_POST['LineText'] = $myrow['linetext']; - echo '<font size=4>' . _('Definition of') . ' ' . $myrow['messagetype'] . ' ' . _('for') . ' ' . $myrow['partnercode']; - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . 'MessageType=INVOIC&PartnerCode=' . $myrow['partnercode'] . "'>" . _('Review Message Lines') . '</a></div>'; echo "<input type=hidden name='SelectedMessageLine' VALUE='" . $SelectedMessageLine . "'>"; @@ -211,8 +199,12 @@ echo "<input type=hidden name='PartnerCode' VALUE='" . $PartnerCode . "'>"; } -echo '<table>'; +echo '<table class=selection>'; +if ($myrow['messagetype']!='') { + echo '<tr><th colspan=2><font size=3>' . _('Definition of') . ' ' . $myrow['messagetype'] . ' ' . _('for') . ' ' . $myrow['partnercode'].'</font></th></tr>'; +} + echo '<tr><td>Section:</td>'; echo '<td>'; echo '<select tabindex=2 name="Section">'; @@ -239,22 +231,24 @@ if (!isset($_POST['SequenceNo'])) {$_POST['SequenceNo']='';} if (!isset($_POST['LineText'])) {$_POST['LineText']='';} -?> -</td></tr> +echo '</td></tr>'; -<tr><td>Sequence Number:</td> -<td><input tabindex=3 type=TEXT name=SequenceNo size=3 maxlength=3 VALUE=<?php echo $_POST['SequenceNo'] ?>> -</td></tr> -<tr><td><?php echo _('Line Text') . ':'; ?></td> -<td> -<input tabindex=4 type="Text" name="LineText" size=50 maxlength=50 VALUE=<?php echo $_POST['LineText']; ?>> -</td></tr> -</table> -<div class="centre"><input TABINDEX=5 type="Submit" name="submit" value="<?php echo _('Enter Information'); ?>"></div> +echo '<tr><td>Sequence Number:</td>'; +echo "<td><input tabindex=3 type=text name=SequenceNo size=3 maxlength=3 value=".$_POST['SequenceNo'].">"; +echo "</td></tr>"; +echo "<tr><td>" . _('Line Text') . ':' ."</td>"; +echo "<td>"; +echo "<input tabindex=4 type='Text' name='LineText' size=50 maxlength=50 VALUE=".$_POST['LineText'] .">"; +echo "</td></tr>"; +echo "</table><br>"; +if (isset($_GET['SelectedMessageLine'])) { + echo "<div class='centre'><input tabindex=5 type='submit' name='update' value='". _('Update Information'). "'></div>"; +} else { + echo "<div class='centre'><input tabindex=5 type='submit' name='submit' value='". _('Enter Information'). "'></div>"; +} -</form> +echo "</form>"; -<?php include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 22:00:49 UTC (rev 3580) +++ trunk/doc/Change.log.html 2010-07-06 22:01:07 UTC (rev 3581) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: EDIMessageFormat.php - Bug fixes with updating the format</p> <p>05/07/10 Tim: DiscountMatrix.php - Layout improvements</p> <p>05/07/10 Tim: DiscountCategories.php - Layout improvements</p> <p>05/07/10 Tim: DemandWorkOrders.php - Remove redundant file</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:55:40
|
Revision: 3582 http://web-erp.svn.sourceforge.net/web-erp/?rev=3582&view=rev Author: tim_schofield Date: 2010-07-07 20:55:34 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Add Javascript, and layout improvements Modified Paths: -------------- trunk/ExchangeRateTrend.php trunk/doc/Change.log.html Modified: trunk/ExchangeRateTrend.php =================================================================== --- trunk/ExchangeRateTrend.php 2010-07-06 22:01:07 UTC (rev 3581) +++ trunk/ExchangeRateTrend.php 2010-07-07 20:55:34 UTC (rev 3582) @@ -14,7 +14,7 @@ $FunctionalCurrency = $_SESSION['CompanyRecord']['currencydefault']; if ( isset($_GET['CurrencyToShow']) ){ - $CurrencyToShow = $_GET['CurrencyToShow']; + $CurrencyToShow = $_GET['CurrencyToShow']; } elseif ( isset($_POST['CurrencyToShow']) ) { $CurrencyToShow = $_POST['CurrencyToShow']; } @@ -23,8 +23,9 @@ // SHOW OUR MAIN INPUT FORM // ************************ - echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo '<p><div class="centre"><font size=4 color=BLUE><b><U>' . _('View Currency Trend') . '</b></U></font></div>'; + echo "<form method='post' name=update action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . + _('View Currency Trend') . '" alt="">' . ' ' . _('View Currency Trend') . ''; echo '<table>'; // First column $SQL = 'SELECT * FROM currencies'; @@ -32,7 +33,7 @@ // CurrencyToShow Currency Picker - echo '<tr><td><select name="CurrencyToShow">'; + echo '<tr><td><select name="CurrencyToShow" onChange="ReloadForm(update.submit)">'; DB_data_seek($result,0); while ($myrow=DB_fetch_array($result)) { @@ -62,8 +63,8 @@ $graph = $CurrencyToShow. '/' . $FunctionalCurrency . $graph; $image = 'http://www.x-rates.com/d/' . $graph; - echo '<p><div class="centre"><font size=4 color=BLUE><b><U>' . $FunctionalCurrency . ' / ' . $CurrencyToShow . '</b></U></font>'; - echo '<p></div><table border=1>'; + echo '<p></div><table class=selection>'; + echo '<tr><th><div class="centre"><font size=4 color=BLUE><b><U>' . $FunctionalCurrency . ' / ' . $CurrencyToShow . '</b></U></font></th></tr>'; echo '<tr><td><img src=' . $image . ' alt="Trend Currently Unavailable"></td></tr>'; echo '</table>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-06 22:01:07 UTC (rev 3581) +++ trunk/doc/Change.log.html 2010-07-07 20:55:34 UTC (rev 3582) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> <p>05/07/10 Tim: EDIMessageFormat.php - Bug fixes with updating the format</p> <p>05/07/10 Tim: DiscountMatrix.php - Layout improvements</p> <p>05/07/10 Tim: DiscountCategories.php - Layout improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:56:02
|
Revision: 3583 http://web-erp.svn.sourceforge.net/web-erp/?rev=3583&view=rev Author: tim_schofield Date: 2010-07-07 20:55:55 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Redo much of script to conform more with webERP standards Modified Paths: -------------- trunk/Factors.php trunk/doc/Change.log.html Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2010-07-07 20:55:34 UTC (rev 3582) +++ trunk/Factors.php 2010-07-07 20:55:55 UTC (rev 3583) @@ -1,206 +1,295 @@ <?php -/* $Id$*/ + $PageSecurity = 5; -include ('includes/session.inc'); + +include('includes/session.inc'); + $title = _('Factor Company Maintenance'); -include ('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Factor Company Maintenance') . ''; -if (isset($_GET['FactorID'])) { - $FactorID = strtoupper($_GET['FactorID']); -} elseif (isset($_POST['FactorID'])) { - $FactorID = strtoupper($_POST['FactorID']); + +include('includes/header.inc'); + +if (isset($_GET['FactorID'])){ + $FactorID = strtoupper($_GET['FactorID']); + $_POST['amend']=True; +} elseif (isset($_POST['FactorID'])){ + $FactorID = strtoupper($_POST['FactorID']); } else { - unset($FactorID); + unset($FactorID); } + if (isset($_POST['Create'])) { - $FactorID = 0; - $_POST['New'] = "Yes"; + $FactorID = 0; + $_POST['New'] = "Yes"; }; -if (isset($_POST['submit'])) { - /* This section has been reached because the user has pressed either the insert/update buttons on the - form hopefully with input in the correct fields, which we check for firsrt. */ - //initialise no input errors assumed initially before we test - $InputError = 0; - if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { - $InputError = 1; - prnMsg(_('The factoring company name must be entered and be forty characters or less long'), 'error'); - } - /* If no input errors have been recieved */ - if ($InputError != 1) { - //And if its not a new part then update existing one - if (!isset($_POST['New'])) { - $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', - address1='" . $_POST['Address1'] . "', - address2='" . $_POST['Address2'] . "', - address3='" . $_POST['Address3'] . "', - address4='" . $_POST['Address4'] . "', - address5='" . $_POST['Address5'] . "', - address6='" . $_POST['Address6'] . "', - contact='" . $_POST['ContactName'] . "', - telephone='" . $_POST['Telephone'] . "', - fax='" . $_POST['Fax'] . "', - email='" . $_POST['Email'] . " ' - WHERE id = " . $FactorID; - $ErrMsg = _('The factoring company could not be updated because'); - $DbgMsg = _('The SQL that was used to update the factor but failed was'); - $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); - prnMsg(_('The factoring company record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been updated'), 'success'); - //If it is a new part then insert it - - } else { - $sql = "INSERT INTO factorcompanies (id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email) - VALUES (null, - '" . $_POST['FactorName'] . "', - '" . $_POST['Address1'] . "', - '" . $_POST['Address2'] . "', - '" . $_POST['Address3'] . "', - '" . $_POST['Address4'] . "', - '" . $_POST['Address5'] . "', - '" . $_POST['Address6'] . "', - '" . $_POST['ContactName'] . "', - '" . $_POST['Telephone'] . "', - '" . $_POST['Fax'] . "', - '" . $_POST['Email'] . "')"; - $ErrMsg = _('The factoring company') . ' ' . $_POST['FactorName'] . ' ' . _('could not be added because'); - $DbgMsg = _('The SQL that was used to insert the factor but failed was'); - $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); - prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'), 'success'); - unset($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - } - // But if errors were found in the input - - } else { - prnMsg(_('Validation failed') . _('no updates or deletes took place'), 'warn'); - } - /* If neither the Update or Insert buttons were pushed was it the delete button? */ -} elseif (isset($_POST['delete']) AND $_POST['delete'] != '') { - $CancelDelete = 0; - // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - $sql = "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='$FactorID'"; - $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'), 'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - if ($CancelDelete == 0) { - $sql = "DELETE FROM factorcompanies WHERE id='$FactorID'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'), 'success'); - unset($FactorID); - unset($_SESSION['FactorID']); - } //end if Delete factor - + +echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' + . _('Factor Companies') . '" alt="">' . ' ' .$title . '</div>'; + +/* This section has been reached because the user has pressed either the insert/update buttons on the + form hopefully with input in the correct fields, which we check for firsrt. */ + +//initialise no input errors assumed initially before we test +$InputError = 0; + +if (isset($_POST['submit']) or isset($_POST['update']) or isset($_POST['delete'])) { + + if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { + $InputError = 1; + prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); + } + + // But if errors were found in the input + if ($InputError>0) { + prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); + include('includes/footer.inc'); + exit; + } + + /* If no input errors have been recieved */ + if ($InputError == 0 and isset($_POST['submit'])){ + //And if its not a new part then update existing one + + $sql = "INSERT INTO factorcompanies (id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email) + VALUES (null, + '" .$_POST['FactorName'] . "', + '" . $_POST['Address1'] . "', + '" . $_POST['Address2'] . "', + '" . $_POST['Address3'] . "', + '" . $_POST['Address4'] . "', + '" . $_POST['Address5'] . "', + '" . $_POST['Address6'] . "', + '" . $_POST['ContactName'] . "', + '" . $_POST['Telephone'] . "', + '" . $_POST['Fax'] . "', + '" . $_POST['Email'] . "')"; + + $ErrMsg = _('The factoring company') . ' ' . $_POST['FactorName'] . ' ' . _('could not be added because'); + $DbgMsg = _('The SQL that was used to insert the factor but failed was'); + + $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + + prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); + + unset ($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); + + } + + if ($InputError == 0 and isset($_POST['update'])) { + $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', + address1='" . $_POST['Address1'] . "', + address2='" . $_POST['Address2'] . "', + address3='" . $_POST['Address3'] . "', + address4='" . $_POST['Address4'] . "', + address5='" . $_POST['Address5'] . "', + address6='" . $_POST['Address6'] . "', + contact='" . $_POST['ContactName'] . "', + telephone='" . $_POST['Telephone'] . "', + fax='" . $_POST['Fax'] . "', + email='" . $_POST['Email'] . "' + WHERE id = '" .$FactorID."'"; + + $ErrMsg = _('The factoring company could not be updated because'); + $DbgMsg = _('The SQL that was used to update the factor but failed was'); + $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + + prnMsg(_('The factoring company record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been updated'),'success'); + + //If it is a new part then insert it + } + + /* If neither the Update or Insert buttons were pushed was it the delete button? */ + + if (isset($_POST['delete'])) { + + $CancelDelete = 0; + + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts + + $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } + + if ($CancelDelete == 0) { + $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; + $result = DB_query($sql, $db); + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); + echo '<br>'; + unset($_SESSION['FactorID']); + } //end if Delete factor + } + unset($FactorID); } /* So the page hasn't called itself with the input/update/delete/buttons */ + /* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the -option to create a new one*/ -if (!isset($FactorID) or ($FactorID == 1 and isset($_POST['amend']))) { - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo "<input type='hidden' name='New' VALUE='No'>"; - $result = DB_query('SELECT id, coyname FROM factorcompanies', $db); - $NumberOfRows=DB_num_rows($result); - // $myrow = DB_fetch_array($result); - echo '<table><tr><td>'; - echo "<select tabindex=1 name='FactorID'>"; - while ($myrow = DB_fetch_array($result)) { - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; - } - echo "</select></td></tr></table><p><div class='centre'>"; - if ($NumberOfRows>0) { - echo "<input tabindex=2 type='Submit' name='amend' VALUE='" . _('Amend Factor') . "'>"; + option to create a new one*/ + +if (empty($FactorID)) { + + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + + echo "<input type='hidden' name='New' VALUE='No'>"; + echo '<table class=selection><tr>'; + echo '<th>' . _('ID') . '</th>'; + echo '<th>' . _('Company Name').'</th>'; + echo '<th>' . _('Address 1').'</th>'; + echo '<th>' . _('Address 2').'</th>'; + echo '<th>' . _('Address 3').'</th>'; + echo '<th>' . _('Address 4').'</th>'; + echo '<th>' . _('Address 5').'</th>'; + echo '<th>' . _('Address 6').'</th>'; + echo '<th>' . _('Contact').'</th>'; + echo '<th>' . _('Telephone').'</th>'; + echo '<th>' . _('Fax Number').'</th>'; + echo '<th>' . _('Email').'</th></tr>'; + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies"; + $result=DB_query($sql, $db); + $j=1; + while ($myrow = DB_fetch_array($result)) { + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $myrow['id'] . '</td>'; + echo '<td>' . $myrow['coyname'].'</td>'; + echo '<td>' . $myrow['address1'].'</td>'; + echo '<td>' . $myrow['address2'].'</td>'; + echo '<td>' . $myrow['address3'].'</td>'; + echo '<td>' . $myrow['address4'].'</td>'; + echo '<td>' . $myrow['address5'].'</td>'; + echo '<td>' . $myrow['address6'].'</td>'; + echo '<td>' . $myrow['contact'].'</td>'; + echo '<td>' . $myrow['telephone'].'</td>'; + echo '<td>' . $myrow['fax'].'</td>'; + echo '<td>' . $myrow['email'].'</td>'; + echo '<td><a href="'.$rootpath . '/Factors.php?' . SID . '&FactorID='.$myrow['id'].'">'._('Edit').'</a></td></tr>'; } - echo "<input tabindex=3 type='Submit' name='Create' VALUE='" . _('Create New Factor') . "'>"; - echo '</div></form>'; + echo "</table><p><div class='centre'>"; + echo "<br><input tabindex=3 type='Submit' name='Create' value='" . _('Create New Factor') . "'>"; + echo '</div></form>'; + include('includes/footer.inc'); + exit; + +} + +if (isset($FactorID) and isset($_POST['amend'])) { + + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies + WHERE id = '".$FactorID."'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['FactorName'] = $myrow['coyname']; + $_POST['Address1'] = $myrow['address1']; + $_POST['Address2'] = $myrow['address2']; + $_POST['Address3'] = $myrow['address3']; + $_POST['Address4'] = $myrow['address4']; + $_POST['Address5'] = $myrow['address5']; + $_POST['Address6'] = $myrow['address6']; + $_POST['ContactName'] = $myrow['contact']; + $_POST['Telephone'] = $myrow['telephone']; + $_POST['Fax'] = $myrow['fax']; + $_POST['Email'] = $myrow['email']; + } else { - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<table>'; - if (isset($_POST['New']) and $_POST['New'] == "No") { - $sql = "SELECT id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email - FROM factorcompanies - WHERE id = " . $FactorID; - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); - $_POST['FactorName'] = $myrow['coyname']; - $_POST['Address1'] = $myrow['address1']; - $_POST['Address2'] = $myrow['address2']; - $_POST['Address3'] = $myrow['address3']; - $_POST['Address4'] = $myrow['address4']; - $_POST['Address5'] = $myrow['address5']; - $_POST['Address6'] = $myrow['address6']; - $_POST['ContactName'] = $myrow['contact']; - $_POST['Telephone'] = $myrow['telephone']; - $_POST['Fax'] = $myrow['fax']; - $_POST['Email'] = $myrow['email']; - echo "<input type=hidden name='FactorID' VALUE='$FactorID'>"; - } else { - // its a new factor being added - echo "<input type=hidden name='New' VALUE='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55></td></tr>"; - } - if (isset($_POST['New']) and $_POST['New'] == "Yes") { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; - } else { - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' VALUE='" . $_POST['FactorName'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' VALUE='" . $_POST['Address1'] . "' ' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' VALUE='" . $_POST['Address2'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' VALUE='" . $_POST['Address3'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' VALUE='" . $_POST['Address4'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' VALUE='" . $_POST['Address5'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' VALUE='" . $_POST['Address6'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' VALUE='" . $_POST['ContactName'] . "' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' VALUE='" . $_POST['Telephone'] . "' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE='" . $_POST['Fax'] . "' VALUE=0 size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' VALUE='" . $_POST['Email'] . "' size=55 maxlength=55></td></tr>"; - echo "<p></table><div class='centre'><input tabindex=13 type='Submit' name='submit' VALUE='" . _('Update Factor') . "'>"; - prnMsg(_('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; - } + $_POST['FactorName'] = ''; + $_POST['Address1'] = ''; + $_POST['Address2'] = ''; + $_POST['Address3'] = ''; + $_POST['Address4'] = ''; + $_POST['Address5'] = ''; + $_POST['Address6'] = ''; + $_POST['ContactName'] = ''; + $_POST['Telephone'] = ''; + $_POST['Fax'] = ''; + $_POST['Email'] = ''; +} + +if (isset($_POST['amend']) or isset($_POST['Create'])) { + // its a new factor being added + + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + echo "<input type=hidden name='FactorID' value='".$FactorID."'>"; + echo '<table class=selection>'; + echo "<input type=hidden name='New' value='Yes'>"; + echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40 value='".$_POST['FactorName']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40 value='".$_POST['Address1']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40 value='".$_POST['Address2']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40 value='".$_POST['Address3']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40 value='".$_POST['Address4']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40 value='".$_POST['Address5']."'></td></tr>"; + echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40 value='".$_POST['Address6']."'></td></tr>"; + echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25 value='".$_POST['ContactName']."'></td></tr>"; + echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25 value='".$_POST['Telephone']."'></td></tr>"; + echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25 value='".$_POST['Fax']."'></td></tr>"; + echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55 value='".$_POST['Email']."'></td></tr>"; echo '</form>'; -} // end of main ifs -include ('includes/footer.inc'); +} + + +if (isset($_POST['Create'])) { + echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; +} else if (isset($_POST['amend'])) { + echo "</table><p><div class='centre'><input tabindex=13 type='Submit' name='update' VALUE='" . _('Update Factor') . "'><p>"; + prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); + echo "<p><input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; +} + + +include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:55:34 UTC (rev 3582) +++ trunk/doc/Change.log.html 2010-07-07 20:55:55 UTC (rev 3583) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>05/07/10 Tim: Factors.php - Redo much of script to conform more with webERP standards</p> <p>05/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> <p>05/07/10 Tim: EDIMessageFormat.php - Bug fixes with updating the format</p> <p>05/07/10 Tim: DiscountMatrix.php - Layout improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:56:23
|
Revision: 3584 http://web-erp.svn.sourceforge.net/web-erp/?rev=3584&view=rev Author: tim_schofield Date: 2010-07-07 20:56:17 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Layout improvements and properly quoting sql Modified Paths: -------------- trunk/FreightCosts.php trunk/doc/Change.log.html Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2010-07-07 20:55:55 UTC (rev 3583) +++ trunk/FreightCosts.php 2010-07-07 20:56:17 UTC (rev 3584) @@ -28,15 +28,16 @@ $SelectedFreightCost = $_POST['SelectedFreightCost']; } + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Freight Costs') . '" alt="">' . ' ' . $title . '</p>'; - if (!isset($LocationFrom) OR !isset($ShipperID)) { echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; $sql = 'SELECT shippername, shipper_id FROM shippers'; $ShipperResults = DB_query($sql,$db); - echo '<table border=1> + echo '<table class=selection> <tr> <td>' . _('Select A Freight Company to set up costs for') . "</td> <td><select name='ShipperID'>"; @@ -56,19 +57,18 @@ echo '<option VALUE=' . $myrow['loccode'] . '>' . $myrow['locationname']; } - echo "</select></td></tr></table><div class='centre'><input type=submit VALUE='" . _('Accept') . "' name='Accept'></div></form>"; + echo "</select></td></tr></table><br><div class='centre'><input type=submit value='" . _('Accept') . "' name='Accept'></div></form>"; } else { - $sql = "SELECT shippername FROM shippers WHERE shipper_id = $ShipperID"; + $sql = "SELECT shippername FROM shippers WHERE shipper_id = '".$ShipperID."'"; $ShipperResults = DB_query($sql,$db); $myrow = DB_fetch_row($ShipperResults); $ShipperName = $myrow[0]; - $sql = "SELECT locationname FROM locations WHERE loccode = '$LocationFrom'"; + $sql = "SELECT locationname FROM locations WHERE loccode = '".$LocationFrom."'"; $LocationResults = DB_query($sql,$db); $myrow = DB_fetch_row($LocationResults); $LocationName = $myrow[0]; - echo '<font size=4 color=BLUE>' . _('For Deliveries From') . ' ' . $LocationName . ' ' . _('using') . ' ' . $ShipperName . '</font><br>'; } @@ -109,22 +109,22 @@ prnMsg(_('The entries for Cubic Rate, KG Rate, Maximum Weight, Maximum Volume, Fixed Price and Minimum charge must be numeric'),'warn'); } - - + + if (isset($SelectedFreightCost) AND $InputError !=1) { $sql = "UPDATE freightcosts SET - locationfrom='$LocationFrom', + locationfrom='".$LocationFrom."', destination='" . $_POST['Destination'] . "', - shipperid=$ShipperID, - cubrate=" . $_POST['CubRate'] . ", - kgrate = " . $_POST['KGRate'] . ", - maxkgs = " . $_POST['MAXKGs'] . ", - maxcub= " . $_POST['MAXCub'] . ", - fixedprice = " . $_POST['FixedPrice'] . ", - minimumchg= " . $_POST['MinimumChg'] . " - WHERE shipcostfromid=" . $SelectedFreightCost; + shipperid='" . $ShipperID . "', + cubrate='" . $_POST['CubRate'] . "', + kgrate ='" . $_POST['KGRate'] . "', + maxkgs ='" . $_POST['MAXKGs'] . "', + maxcub= '" . $_POST['MAXCub'] . "', + fixedprice = '" . $_POST['FixedPrice'] . "', + minimumchg= '" . $_POST['MinimumChg'] . "' + WHERE shipcostfromid='" . $SelectedFreightCost . "'"; $msg = _('Freight cost record updated'); @@ -143,15 +143,15 @@ fixedprice, minimumchg) VALUES ( - '$LocationFrom', + '".$LocationFrom."', '" . $_POST['Destination'] . "', - $ShipperID, - " . $_POST['CubRate'] . ", - " . $_POST['KGRate'] . ", - " . $_POST['MAXKGs'] . ", - " . $_POST['MAXCub'] . ", - " . $_POST['FixedPrice'] .", - " . $_POST['MinimumChg'] . " + '" . $ShipperID . "', + '" . $_POST['CubRate'] . "', + '" . $_POST['KGRate'] . "', + '" . $_POST['MAXKGs'] . "', + '" . $_POST['MAXCub'] . "', + '" . $_POST['FixedPrice'] ."', + '" . $_POST['MinimumChg'] . "' )"; $msg = _('Freight cost record inserted'); @@ -164,7 +164,7 @@ $result = DB_query($sql,$db,$ErrMsg); prnMsg($msg,'success'); - + unset($SelectedFreightCost); unset($_POST['CubRate']); unset($_POST['KGRate']); @@ -175,7 +175,7 @@ } elseif (isset($_GET['delete'])) { - $sql = 'DELETE FROM freightcosts WHERE shipcostfromid=' . $SelectedFreightCost; + $sql = "DELETE FROM freightcosts WHERE shipcostfromid='" . $SelectedFreightCost . "'"; $result = DB_query($sql,$db); prnMsg( _('Freight cost record deleted'),'success'); unset ($SelectedFreightCost); @@ -194,13 +194,13 @@ fixedprice, minimumchg FROM freightcosts - WHERE freightcosts.locationfrom = '$LocationFrom' - AND freightcosts.shipperid = $ShipperID + WHERE freightcosts.locationfrom = '".$LocationFrom. "' + AND freightcosts.shipperid = '" . $ShipperID . "' ORDER BY destination"; $result = DB_query($sql,$db); - - echo '<table border=1>'; + + echo '<br><table class=selection>'; $TableHeader = "<tr> <th>" . _('Destination') . "</th> <th>" . _('Cubic Rate') . "</th> @@ -231,7 +231,7 @@ $k++; } - + printf("<td>%s</td> <td class=number>%s</td> <td class=number>%s</td> @@ -286,7 +286,7 @@ fixedprice, minimumchg FROM freightcosts - WHERE shipcostfromid=$SelectedFreightCost"; + WHERE shipcostfromid='" . $SelectedFreightCost ."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -300,7 +300,7 @@ $_POST['MAXCub'] = $myrow['maxcub']; $_POST['FixedPrice'] = $myrow['fixedprice']; $_POST['MinimumChg'] = $myrow['minimumchg']; - + echo "<input type=hidden name='SelectedFreightCost' VALUE=$SelectedFreightCost>"; } else { @@ -316,9 +316,11 @@ if (!isset($_POST['KGRate'])) {$_POST['KGRate']='';} if (!isset($_POST['MAXKGs'])) {$_POST['MAXKGs']='';} if (!isset($_POST['MAXCub'])) {$_POST['MAXCub']='';} - - echo '<table> - <tr><td>' . _('Destination') . ":</td> + + echo '<br><table class=selection>'; + echo '<tr><th colspan=2><font size=4 color=blue>' . _('For Deliveries From') . ' ' . $LocationName . ' ' . _('using') . ' ' . + $ShipperName . '</font></th></tr>'; + echo'<tr><td>' . _('Destination') . ":</td> <td><input type='text' maxlength=20 size=20 name='Destination' VALUE='" . $_POST['Destination'] . "'></td></tr>"; echo '<tr><td>' . _('Rate per Cubic Metre') . ":</td> <td><input type='Text' name='CubRate' class=number size=6 maxlength=5 value=" . $_POST['CubRate'] . "></td></tr>"; @@ -333,7 +335,7 @@ echo '<tr><td>' . _('Minimum Charge (0 is N/A)') . ":</a></td> <td><input type='Text' name='MinimumChg' class=number size=6 maxlength=5 value=" . $_POST['MinimumChg'] . "></td></tr>"; - echo '</table>'; + echo '</table><br>'; echo "<div class='centre'><input type='Submit' name='submit' value='" . _('Enter Information') . "'></div>"; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:55:55 UTC (rev 3583) +++ trunk/doc/Change.log.html 2010-07-07 20:56:17 UTC (rev 3584) @@ -1,8 +1,9 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>05/07/10 Tim: Factors.php - Redo much of script to conform more with webERP standards</p> -<p>05/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> -<p>05/07/10 Tim: EDIMessageFormat.php - Bug fixes with updating the format</p> +<p>07/07/10 Tim: FreightCosts.php - Layout improvements and properly quoting sql</p> +<p>07/07/10 Tim: Factors.php - Redo much of script to conform more with webERP standards</p> +<p>07/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> +<p>07/07/10 Tim: EDIMessageFormat.php - Bug fixes with updating the format</p> <p>05/07/10 Tim: DiscountMatrix.php - Layout improvements</p> <p>05/07/10 Tim: DiscountCategories.php - Layout improvements</p> <p>05/07/10 Tim: DemandWorkOrders.php - Remove redundant file</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:56:45
|
Revision: 3585 http://web-erp.svn.sourceforge.net/web-erp/?rev=3585&view=rev Author: tim_schofield Date: 2010-07-07 20:56:39 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Properly quoting sql Modified Paths: -------------- trunk/GeocodeSetup.php trunk/doc/Change.log.html Modified: trunk/GeocodeSetup.php =================================================================== --- trunk/GeocodeSetup.php 2010-07-07 20:56:17 UTC (rev 3584) +++ trunk/GeocodeSetup.php 2010-07-07 20:56:39 UTC (rev 3585) @@ -54,7 +54,7 @@ map_height='" . $_POST['map_height'] . "', map_width='" . $_POST['map_width'] . "', map_host='" . $_POST['map_host'] . "' - WHERE geocodeid = $SelectedParam"; + WHERE geocodeid = '" . $SelectedParam . "'"; } $msg = _('The geocode status record has been updated'); @@ -64,7 +64,7 @@ if (isset($_POST['geocode_key']) and $_POST['geocode_key']>0){ - $sql = 'INSERT INTO geocode_param ( + $sql = "INSERT INTO geocode_param ( geocodeid, geocode_key, center_long, @@ -72,16 +72,17 @@ map_height, map_width, map_host) - VALUES (' . "' - ', '" . - $_POST['geocode_key'] . "', '" . - $_POST['center_long'] . "', '" . - $_POST['center_lat'] . "', '" . - $_POST['map_height'] . "', '" . - $_POST['map_width'] . "', '" . - $_POST['map_host'] . "')"; + VALUES (" . " + '', + '" . $_POST['geocode_key'] . "', + '" . $_POST['center_long'] . "', + '" . $_POST['center_lat'] . "', + '" . $_POST['map_height'] . "', + '" . $_POST['map_width'] . "', + '" . $_POST['map_host'] . "' + )"; } else { - $sql = 'INSERT INTO geocode_param ( + $sql = "INSERT INTO geocode_param ( geocodeid, geocode_key, center_long, @@ -89,14 +90,15 @@ map_height, map_width, map_host) - VALUES (' . "'" . - $_POST['geocodeid'] . "', '" . - $_POST['geocode_key'] . "', '" . - $_POST['center_long'] . "', '" . - $_POST['center_lat'] . "', '" . - $_POST['map_height'] . "', '" . - $_POST['map_width'] . "', '" . - $_POST['map_host'] . "')"; + VALUES ( + '" . $_POST['geocodeid'] . "', + '" . $_POST['geocode_key'] . "', + '" . $_POST['center_long'] . "', + '" . $_POST['center_lat'] . "', + '" . $_POST['map_height'] . "', + '" . $_POST['map_width'] . "', + '" . $_POST['map_host'] . " + ')"; } $msg = _('A new geocode status record has been inserted'); @@ -110,7 +112,7 @@ } } elseif (isset($_GET['delete'])) { //the link to delete a selected record was clicked instead of the submit button -$sql = 'DELETE FROM geocode_param WHERE geocodeid = ' . $_GET['delete'] . ' LIMIT 1'; +$sql = "DELETE FROM geocode_param WHERE geocodeid = '" . $_GET['delete'] . "' LIMIT 1"; $result = DB_query($sql,$db); $msg = _('Geocode deleted'); //end if status code used in customer or supplier accounts @@ -126,7 +128,7 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT geocodeid, geocode_key, center_long, center_lat, map_height, map_width, map_host FROM geocode_param'; + $sql = "SELECT geocodeid, geocode_key, center_long, center_lat, map_height, map_width, map_host FROM geocode_param"; $result = DB_query($sql, $db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Geocode Setup') . '" alt="">'. _('Setup configuration for Geocoding of Customers and Suppliers') .'</p>'; @@ -203,7 +205,7 @@ map_width, map_host FROM geocode_param - WHERE geocodeid='$SelectedParam'"; + WHERE geocodeid='" . $SelectedParam . "'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -269,4 +271,4 @@ echo '<a href="' . $rootpath . '/geo_displaymap_suppliers.php">' . _('Display Map of Suppliers') . '</a></div>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:56:17 UTC (rev 3584) +++ trunk/doc/Change.log.html 2010-07-07 20:56:39 UTC (rev 3585) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/07/10 Tim: GeocodeStup.php - Properly quoting sql</p> <p>07/07/10 Tim: FreightCosts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: Factors.php - Redo much of script to conform more with webERP standards</p> <p>07/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:57:06
|
Revision: 3586 http://web-erp.svn.sourceforge.net/web-erp/?rev=3586&view=rev Author: tim_schofield Date: 2010-07-07 20:57:00 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Layout improvements and properly quoting sql Modified Paths: -------------- trunk/GLAccountInquiry.php trunk/doc/Change.log.html Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2010-07-07 20:56:39 UTC (rev 3585) +++ trunk/GLAccountInquiry.php 2010-07-07 20:57:00 UTC (rev 3586) @@ -31,61 +31,52 @@ $DefaultPeriodDate = Date ('Y-m-d', Mktime(0,0,0,Date('m'),0,Date('Y'))); /*Show a form to allow input of criteria for TB to show */ -echo '<table> - <tr> - <td>'._('Account').":</td> - <td><select Name='Account'>"; - $sql = 'SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode'; - $Account = DB_query($sql,$db); - while ($myrow=DB_fetch_array($Account,$db)){ - if($myrow['accountcode'] == $SelectedAccount){ - echo '<option selected VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname']; - } else { +echo '<table class=selection><tr><td>'._('Account').":</td><td><select Name='Account'>"; +$sql = "SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode"; +$Account = DB_query($sql,$db); +while ($myrow=DB_fetch_array($Account,$db)){ + if($myrow['accountcode'] == $SelectedAccount){ + echo '<option selected VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname']; + } else { echo '<option VALUE=' . $myrow['accountcode'] . '>' . $myrow['accountcode'] . ' ' . $myrow['accountname']; - } - } - echo '</select></td></tr>'; + } + } +echo '</select></td></tr>'; - //Select the tag - echo '<tr><td>' . _('Select Tag') . ':</td><td><select name="tag">'; +//Select the tag +echo '<tr><td>' . _('Select Tag') . ':</td><td><select name="tag">'; - $SQL = 'SELECT tagref, - tagdescription +$SQL = "SELECT tagref, + tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; - $result=DB_query($SQL,$db); - echo '<option value=0>0 - '._('All tags'); - while ($myrow=DB_fetch_array($result)){ - if (isset($_POST['tag']) and $_POST['tag']==$myrow["tagref"]){ +$result=DB_query($SQL,$db); +echo '<option value=0>0 - '._('All tags'); +while ($myrow=DB_fetch_array($result)){ + if (isset($_POST['tag']) and $_POST['tag']==$myrow["tagref"]){ echo '<option selected value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']; - } else { - echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']; - } + } else { + echo '<option value=' . $myrow['tagref'] . '>' . $myrow['tagref'].' - ' .$myrow['tagdescription']; } - echo '</select></td></tr>'; +} +echo '</select></td></tr>'; // End select tag - echo '<tr> - <td>'._('For Period range').':</td> - <td><select Name=Period[] multiple>'; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; - $Periods = DB_query($sql,$db); - $id=0; - while ($myrow=DB_fetch_array($Periods,$db)){ +echo '<tr> <td>'._('For Period range').':</td><td><select Name=Period[] multiple>'; +$sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; +$Periods = DB_query($sql,$db); +$id=0; +while ($myrow=DB_fetch_array($Periods,$db)){ + if(isset($SelectedPeriod[$id]) and $myrow['periodno'] == $SelectedPeriod[$id]){ + echo '<option selected value=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])); + $id++; + } else { + echo '<option value=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])); + } +} +echo "</select></td></tr><table>"; +echo "<p><div class='centre'><input type=submit name='Show' value='"._('Show Account Transactions')."'></div></form>"; - if(isset($SelectedPeriod[$id]) and $myrow['periodno'] == $SelectedPeriod[$id]){ - echo '<option selected VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])); - $id++; - } else { - echo '<option VALUE=' . $myrow['periodno'] . '>' . _(MonthAndYearFromSQLDate($myrow['lastdate_in_period'])); - } - - } - echo "</select></td> - </tr> -</table><p> -<div class='centre'><input type=submit name='Show' VALUE='"._('Show Account Transactions')."'></div></form>"; - /* End of the Form rest of script is what happens if the show button is hit*/ if (isset($_POST['Show'])){ @@ -99,7 +90,7 @@ $result = DB_query("SELECT pandl FROM accountgroups INNER JOIN chartmaster ON accountgroups.groupname=chartmaster.group_ - WHERE chartmaster.accountcode=$SelectedAccount",$db); + WHERE chartmaster.accountcode='" . $SelectedAccount ."'",$db); $PandLRow = DB_fetch_row($result); if ($PandLRow[0]==1){ $PandLAccount = True; @@ -120,11 +111,11 @@ periodno, tag FROM gltrans, systypes - WHERE gltrans.account = $SelectedAccount + WHERE gltrans.account = '" . $SelectedAccount . "' AND systypes.typeid=gltrans.type AND posted=1 - AND periodno>=$FirstPeriodSelected - AND periodno<=$LastPeriodSelected + AND periodno>='" . $FirstPeriodSelected . "' + AND periodno<='" . $LastPeriodSelected . "' ORDER BY periodno, gltrans.trandate, counterindex"; } else { @@ -137,20 +128,25 @@ periodno, tag FROM gltrans, systypes - WHERE gltrans.account = $SelectedAccount + WHERE gltrans.account = '" . $SelectedAccount . "' AND systypes.typeid=gltrans.type AND posted=1 - AND periodno>=$FirstPeriodSelected - AND periodno<=$LastPeriodSelected + AND periodno>= '" . $FirstPeriodSelected . "' + AND periodno<= '" . $LastPeriodSelected . "' AND tag='".$_POST['tag']."' ORDER BY periodno, gltrans.trandate, counterindex"; } + $namesql = "SELECT accountname FROM chartmaster WHERE accountcode='" . $SelectedAccount . "'"; + $nameresult = DB_query($namesql, $db); + $namerow=DB_fetch_array($nameresult); + $SelectedAccountName=$namerow['accountname']; $ErrMsg = _('The transactions for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved because') ; $TransResult = DB_query($sql,$db,$ErrMsg); - echo '<table>'; + echo '<br><table class=selection>'; + echo '<tr><th colspan=7><b>' ._('Transactions for account').' '.$SelectedAccount. ' - '. $SelectedAccountName.'</b></th></tr>'; $TableHeader = "<tr> <th>" . _('Type') . "</th> <th>" . _('Number') . "</th> @@ -158,21 +154,21 @@ <th>" . _('Debit') . "</th> <th>" . _('Credit') . "</th> <th>" . _('Narrative') . "</th> - <th>" . _('Tag') . '</th> - </tr>'; + <th>" . _('Tag') . "</th> + </tr>"; echo $TableHeader; if ($PandLAccount==True) { $RunningTotal = 0; } else { - // added to fix bug with Brought Forward Balance always being zero + // added to fix bug with Brought Forward Balance always being zero $sql = "SELECT bfwd, actual, period FROM chartdetails - WHERE chartdetails.accountcode= $SelectedAccount - AND chartdetails.period=" . $FirstPeriodSelected; + WHERE chartdetails.accountcode='" . $SelectedAccount . "' + AND chartdetails.period='" . $FirstPeriodSelected . "'"; $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); @@ -200,7 +196,7 @@ $ShowIntegrityReport = False; $j = 1; $k=0; //row colour counter - + $IntegrityReport=''; while ($myrow=DB_fetch_array($TransResult)) { if ($myrow['periodno']!=$PeriodNo){ @@ -211,8 +207,8 @@ actual, period FROM chartdetails - WHERE chartdetails.accountcode= $SelectedAccount - AND chartdetails.period=" . $PeriodNo; + WHERE chartdetails.accountcode='" . $SelectedAccount . "' + AND chartdetails.period='" . $PeriodNo . "'"; $ErrMsg = _('The chart details for account') . ' ' . $SelectedAccount . ' ' . _('could not be retrieved'); $ChartDetailsResult = DB_query($sql,$db,$ErrMsg); @@ -262,10 +258,10 @@ $FormatedTranDate = ConvertSQLDate($myrow['trandate']); $URL_to_TransDetail = $rootpath . '/GLTransInquiry.php?' . SID . '&TypeID=' . $myrow['type'] . '&TransNo=' . $myrow['typeno']; - $tagsql='SELECT tagdescription FROM tags WHERE tagref='.$myrow['tag']; + $tagsql="SELECT tagdescription FROM tags WHERE tagref='".$myrow['tag'] . "'"; $tagresult=DB_query($tagsql,$db); $tagrow = DB_fetch_array($tagresult); - + printf("<td>%s</td> <td class=number><a href='%s'>%s</a></td> <td>%s</td> @@ -309,4 +305,4 @@ echo '<p>'.$IntegrityReport; } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:56:39 UTC (rev 3585) +++ trunk/doc/Change.log.html 2010-07-07 20:57:00 UTC (rev 3586) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>07/07/10 Tim: GeocodeStup.php - Properly quoting sql</p> +<p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> +<p>07/07/10 Tim: GeocodeSetup.php - Properly quoting sql</p> <p>07/07/10 Tim: FreightCosts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: Factors.php - Redo much of script to conform more with webERP standards</p> <p>07/07/10 Tim: ExchangeRateTrend.php - Add Javascript, and layout improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:57:30
|
Revision: 3587 http://web-erp.svn.sourceforge.net/web-erp/?rev=3587&view=rev Author: tim_schofield Date: 2010-07-07 20:57:24 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Layout improvements and properly quoting sql Modified Paths: -------------- trunk/GLAccounts.php trunk/doc/Change.log.html Modified: trunk/GLAccounts.php =================================================================== --- trunk/GLAccounts.php 2010-07-07 20:57:00 UTC (rev 3586) +++ trunk/GLAccounts.php 2010-07-07 20:57:24 UTC (rev 3587) @@ -14,6 +14,9 @@ $SelectedAccount = $_GET['SelectedAccount']; } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . + _('General Ledger Accounts') . '" alt="">' . ' ' . $title . '</p>'; + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test @@ -36,7 +39,7 @@ $sql = "UPDATE chartmaster SET accountname='" . $_POST['AccountName'] . "', group_='" . $_POST['Group'] . "' - WHERE accountcode = $SelectedAccount"; + WHERE accountcode ='" . $SelectedAccount . "'"; $ErrMsg = _('Could not update the account because'); $result = DB_query($sql,$db,$ErrMsg); @@ -46,12 +49,13 @@ /*SelectedAccount is null cos no item selected on first time round so must be adding a record must be submitting new entries */ $ErrMsg = _('Could not add the new account code'); - $sql = 'INSERT INTO chartmaster (accountcode, + $sql = "INSERT INTO chartmaster (accountcode, accountname, group_) - VALUES (' . $_POST['AccountCode'] . ", - '" . $_POST['AccountName'] . "', - '" . $_POST['Group'] . "')"; + VALUES ('" . $_POST['AccountCode'] . "', + '" . $_POST['AccountName'] . "', + '" . $_POST['Group'] . "' + )"; $result = DB_query($sql,$db,$ErrMsg); /*Add the new chart details records for existing periods first */ @@ -82,7 +86,7 @@ - $sql= "SELECT COUNT(*) FROM chartdetails WHERE chartdetails.accountcode = $SelectedAccount AND chartdetails.actual <>0"; + $sql= "SELECT COUNT(*) FROM chartdetails WHERE chartdetails.accountcode ='" . $SelectedAccount . "' AND chartdetails.actual <>0"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -92,7 +96,7 @@ } else { // PREVENT DELETES IF DEPENDENT RECORDS IN 'GLTrans' - $sql= "SELECT COUNT(*) FROM gltrans WHERE gltrans.account = $SelectedAccount"; + $sql= "SELECT COUNT(*) FROM gltrans WHERE gltrans.account ='" . $SelectedAccount . "'"; $ErrMsg = _('Could not test for existing transactions because'); @@ -107,14 +111,14 @@ } else { //PREVENT DELETES IF Company default accounts set up to this account $sql= "SELECT COUNT(*) FROM companies - WHERE debtorsact=$SelectedAccount - OR pytdiscountact=$SelectedAccount - OR creditorsact=$SelectedAccount - OR payrollact=$SelectedAccount - OR grnact=$SelectedAccount - OR exchangediffact=$SelectedAccount - OR purchasesexchangediffact=$SelectedAccount - OR retainedearnings=$SelectedAccount"; + WHERE debtorsact='" . $SelectedAccount ."' + OR pytdiscountact='" . $SelectedAccount ."' + OR creditorsact='" . $SelectedAccount ."' + OR payrollact='" . $SelectedAccount ."' + OR grnact='" . $SelectedAccount ."' + OR exchangediffact='" . $SelectedAccount ."' + OR purchasesexchangediffact='" . $SelectedAccount ."' + OR retainedearnings='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for default company GL codes because'); @@ -129,8 +133,8 @@ } else { //PREVENT DELETES IF Company default accounts set up to this account $sql= "SELECT COUNT(*) FROM taxauthorities - WHERE taxglcode=$SelectedAccount - OR purchtaxglaccount =$SelectedAccount"; + WHERE taxglcode='" . $SelectedAccount ."' + OR purchtaxglaccount ='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for tax authority GL codes because'); $result = DB_query($sql,$db,$ErrMsg); @@ -142,8 +146,8 @@ } else { //PREVENT DELETES IF SALES POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM salesglpostings - WHERE salesglcode=$SelectedAccount - OR discountglcode=$SelectedAccount"; + WHERE salesglcode='" . $SelectedAccount ."' + OR discountglcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing sales interface GL codes because'); @@ -155,7 +159,7 @@ prnMsg( _('Cannot delete this account because it is used by one of the sales GL posting interface records'),'warn'); } else { //PREVENT DELETES IF COGS POSTINGS USE THE GL ACCOUNT - $sql= "SELECT COUNT(*) FROM cogsglpostings WHERE glcode=$SelectedAccount"; + $sql= "SELECT COUNT(*) FROM cogsglpostings WHERE glcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing cost of sales interface codes because'); @@ -169,11 +173,11 @@ } else { //PREVENT DELETES IF STOCK POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM stockcategory - WHERE stockact=$SelectedAccount - OR adjglact=$SelectedAccount - OR purchpricevaract=$SelectedAccount - OR materialuseagevarac=$SelectedAccount - OR wipact=$SelectedAccount"; + WHERE stockact='" . $SelectedAccount ."' + OR adjglact='" . $SelectedAccount ."' + OR purchpricevaract='" . $SelectedAccount ."' + OR materialuseagevarac='" . $SelectedAccount ."' + OR wipact='" . $SelectedAccount ."'"; $Errmsg = _('Could not test for existing stock GL codes because'); @@ -186,7 +190,7 @@ } else { //PREVENT DELETES IF STOCK POSTINGS USE THE GL ACCOUNT $sql= "SELECT COUNT(*) FROM bankaccounts - WHERE accountcode=$SelectedAccount"; + WHERE accountcode='" . $SelectedAccount ."'"; $ErrMsg = _('Could not test for existing bank account GL codes because'); $result = DB_query($sql,$db,$ErrMsg); @@ -197,9 +201,9 @@ prnMsg( _('Cannot delete this account because it is used by one the defined bank accounts'),'warn'); } else { - $sql = 'DELETE FROM chartdetails WHERE accountcode=' . $SelectedAccount; + $sql = "DELETE FROM chartdetails WHERE accountcode='" . $SelectedAccount ."'"; $result = DB_query($sql,$db); - $sql="DELETE FROM chartmaster WHERE accountcode= $SelectedAccount"; + $sql="DELETE FROM chartmaster WHERE accountcode= '" . $SelectedAccount ."'"; $result = DB_query($sql,$db); prnMsg( _('Account') . ' ' . $SelectedAccount . ' ' . _('has been deleted'),'succes'); } @@ -219,7 +223,7 @@ if (isset($SelectedAccount)) { //editing an existing account - $sql = "SELECT accountcode, accountname, group_ FROM chartmaster WHERE accountcode=$SelectedAccount"; + $sql = "SELECT accountcode, accountname, group_ FROM chartmaster WHERE accountcode='" . $SelectedAccount ."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -230,9 +234,9 @@ echo "<input type=hidden name='SelectedAccount' VALUE=$SelectedAccount>"; echo "<input type=hidden name='AccountCode' VALUE=" . $_POST['AccountCode'] .">"; - echo "<table><tr><td>" . _('Account Code') . ":</td><td>" . $_POST['AccountCode'] . "</td></tr>"; + echo "<table class=selection><tr><td>" . _('Account Code') . ":</td><td>" . $_POST['AccountCode'] . "</td></tr>"; } else { - echo "<table>"; + echo "<table class=selection>"; echo "<tr><td>" . _('Account Code') . ":</td><td><input type=TEXT name='AccountCode' size=11 class=number maxlength=10></td></tr>"; } @@ -258,20 +262,16 @@ } else { echo "<script>defaultControl(document.GLAccounts.AccountName);</script>"; } - - ?> - </select></td></tr> + echo '</select></td></tr></table>'; - </table> + echo '<br><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information') . '"></div>'; - <div class="centre"><input type="Submit" name="submit" value="<?php echo _('Enter Information'); ?>"></div> + echo '</form>'; - </form> +} //end if record deleted no point displaying form to add record -<?php } //end if record deleted no point displaying form to add record - if (!isset($SelectedAccount)) { /* It could still be the second time the page has been run and a record has been selected for modification - SelectedAccount will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of ChartMaster will be displayed with @@ -291,7 +291,7 @@ $result = DB_query($sql,$db,$ErrMsg); - echo '<table border=1>'; + echo '<br><table class=selection>'; echo "<tr> <th>" . _('Account Code') . "</th> <th>" . _('Account Name') . "</th> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:57:00 UTC (rev 3586) +++ trunk/doc/Change.log.html 2010-07-07 20:57:24 UTC (rev 3587) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/07/10 Tim: GLAccounts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GeocodeSetup.php - Properly quoting sql</p> <p>07/07/10 Tim: FreightCosts.php - Layout improvements and properly quoting sql</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-07 20:57:51
|
Revision: 3588 http://web-erp.svn.sourceforge.net/web-erp/?rev=3588&view=rev Author: tim_schofield Date: 2010-07-07 20:57:44 +0000 (Wed, 07 Jul 2010) Log Message: ----------- Layout improvements and properly quoting sql Modified Paths: -------------- trunk/GLBalanceSheet.php trunk/doc/Change.log.html Modified: trunk/GLBalanceSheet.php =================================================================== --- trunk/GLBalanceSheet.php 2010-07-07 20:57:24 UTC (rev 3587) +++ trunk/GLBalanceSheet.php 2010-07-07 20:57:44 UTC (rev 3588) @@ -17,29 +17,30 @@ /*Show a form to allow input of criteria for TB to show */ include('includes/header.inc'); -echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Balance Sheet') . '</div>'; -echo '<div class="page_help_text">' -. _('Balance Sheet (or statement of financial position) is a summary of balances. Assets, liabilities and ownership equity are listed as of a specific date, such as the end of its financial year. Of the four basic financial statements, the balance sheet is the only statement which applies to a single point in time.') . '<br>' -. _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<br>' -. _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' + . _('Print') . '" alt="">' . ' ' . _('Balance Sheet') . '</p></div>'; + echo '<div class="page_help_text">' + . _('Balance Sheet (or statement of financial position) is a summary of balances. Assets, liabilities and ownership equity are listed as of a specific date, such as the end of its financial year. Of the four basic financial statements, the balance sheet is the only statement which applies to a single point in time.') . '<br>' + . _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<br>' + . _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; echo "<form method='POST' action=" . $_SERVER['PHP_SELF'] . '?' . SID . '>'; - echo '<p><table class="table"><tr><td>'._('Select the balance date').":</td><td><select Name='BalancePeriodEnd'>"; + echo '<p><table class="selection"><tr><td>'._('Select the balance date').":</td><td><select Name='BalancePeriodEnd'>"; $periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno='.$periodno; + $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'"; $result = DB_query($sql,$db); $myrow=DB_fetch_array($result, $db); $lastdate_in_period=$myrow[0]; - + $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; $Periods = DB_query($sql,$db); while ($myrow=DB_fetch_array($Periods,$db)){ if( $myrow['periodno']== $periodno){ - echo '<option selected VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period); + echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period); } else { - echo '<option VALUE=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']); + echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']); } } @@ -69,15 +70,15 @@ $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno=' . $_POST['BalancePeriodEnd']; + $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['BalancePeriodEnd'] . "'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $BalanceDate = ConvertSQLDate($myrow[0]); /*Calculate B/Fwd retained earnings */ - $SQL = 'SELECT Sum(CASE WHEN chartdetails.period=' . $_POST['BalancePeriodEnd'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['BalancePeriodEnd'] - 12) . " THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lyaccumprofitbfwd + $SQL = "SELECT Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lyaccumprofitbfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -98,13 +99,13 @@ $AccumProfitRow = DB_fetch_array($AccumProfitResult); /*should only be one row returned */ - $SQL = 'SELECT accountgroups.sectioninaccounts, + $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, chartdetails.accountcode , chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['BalancePeriodEnd'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['BalancePeriodEnd'] - 12) . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lybalancecfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lybalancecfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -118,7 +119,7 @@ ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db); @@ -201,7 +202,7 @@ $Section = $myrow['sectioninaccounts']; if ($_POST['Detail']=='Detailed'){ - + $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,$Sections[$myrow['sectioninaccounts']]); $YPos -= (2 * $line_height); @@ -304,15 +305,15 @@ $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno=' . $_POST['BalancePeriodEnd']; + $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['BalancePeriodEnd'] . "'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $BalanceDate = ConvertSQLDate($myrow[0]); /*Calculate B/Fwd retained earnings */ - $SQL = 'SELECT Sum(CASE WHEN chartdetails.period=' . $_POST['BalancePeriodEnd'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['BalancePeriodEnd'] - 12) . " THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lyaccumprofitbfwd + $SQL = "SELECT Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS accumprofitbfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lyaccumprofitbfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -322,13 +323,13 @@ $AccumProfitRow = DB_fetch_array($AccumProfitResult); /*should only be one row returned */ - $SQL = 'SELECT accountgroups.sectioninaccounts, + $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, chartdetails.accountcode, chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['BalancePeriodEnd'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['BalancePeriodEnd'] - 12) . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lybalancecfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lybalancecfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -342,15 +343,14 @@ ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because')); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/preview.gif" title="' . _('Search') . '" alt=""> ' . _('HTML View') . '</p>'; - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/preview.gif" title="' . _('Search') . '" alt=""> ' . _('HTML View') . '<a href="GLBalanceSheet.php"> ' . _('Return') . '</a></p>'; - echo '<div class=invoice><table class="table1"><div class="centre"><font size=4 color=BLUE><b>' ._('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div><br>'; + echo '<div class=invoice><table class="selection"><tr><th colspan=6><div class="centre"><font size=4 color=blue><b>' . + _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div></th></tr>'; - echo '<table cellpadding=2>'; - if ($_POST['Detail']=='Detailed'){ $TableHeader = "<tr> <th>"._('Account')."</td> @@ -465,7 +465,7 @@ <td><hr></td> </tr>'; } - + printf('<tr> <td colspan=3><font size=4>%s</font></td> <td class=number>%s</td> @@ -480,8 +480,8 @@ $SectionBalanceLY = 0; $SectionBalance = 0; $Section = $myrow['sectioninaccounts']; - + if ($_POST['Detail']=='Detailed'){ printf('<tr> <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> @@ -495,7 +495,7 @@ if ($ActGrp!='' AND $myrow['parentgroupname']==$ActGrp){ $Level++; } - + if ($_POST['Detail']=='Detailed'){ $ActGrp = $myrow['groupname']; printf('<tr> @@ -548,9 +548,9 @@ number_format($LYAccountBalance) ); $j++; - + } - + } //end of loop @@ -595,7 +595,7 @@ number_format($GroupTotal[$Level]), number_format($LYGroupTotal[$Level]) ); - + if ($_POST['Detail']=='Detailed'){ echo '<tr> <td colspan=2></td> @@ -622,7 +622,7 @@ $Sections[$Section], number_format($SectionBalance), number_format($SectionBalanceLY)); - + $Section = $myrow['sectioninaccounts']; if (isset($myrow['sectioninaccounts']) and $_POST['Detail']=='Detailed'){ @@ -631,7 +631,7 @@ </tr>', $Sections[$myrow['sectioninaccounts']]); } - + echo '<tr> <td colspan=3></td> <td><hr></td> @@ -656,9 +656,9 @@ </tr>'; echo '</table>'; - echo "<div class='centre'><input type=submit Name='SelectADifferentPeriod' Value='"._('Select A Different Balance Date')."'></div>"; + echo "<br><div class='centre'><input type=submit Name='SelectADifferentPeriod' Value='"._('Select A Different Balance Date')."'></div>"; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:57:24 UTC (rev 3587) +++ trunk/doc/Change.log.html 2010-07-07 20:57:44 UTC (rev 3588) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/07/10 Tim: GLBalanceSheet.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccounts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GeocodeSetup.php - Properly quoting sql</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-08 19:49:15
|
Revision: 3589 http://web-erp.svn.sourceforge.net/web-erp/?rev=3589&view=rev Author: tim_schofield Date: 2010-07-08 19:49:09 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Correct typo Modified Paths: -------------- trunk/GLBudgets.php trunk/doc/Change.log.html trunk/doc/Manual/ManualPettyCash.html Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2010-07-07 20:57:44 UTC (rev 3588) +++ trunk/GLBudgets.php 2010-07-08 19:49:09 UTC (rev 3589) @@ -138,7 +138,7 @@ // Table Headers echo '<form name="form" action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; - echo '<br><table>'; + echo '<br><table class=selection>'; echo '<tr><th colspan=3>'. _('Last Financial Year') .'</th>'; echo '<th colspan=3>'. _('This Financial Year') .'</th>'; echo '<th colspan=3>'. _('Next Financial Year') .'</th></tr>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-07 20:57:44 UTC (rev 3588) +++ trunk/doc/Change.log.html 2010-07-08 19:49:09 UTC (rev 3589) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/07/10 Tim: ManualPettyCash.html - Correct typo</p> <p>07/07/10 Tim: GLBalanceSheet.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccounts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> Modified: trunk/doc/Manual/ManualPettyCash.html =================================================================== --- trunk/doc/Manual/ManualPettyCash.html 2010-07-07 20:57:44 UTC (rev 3588) +++ trunk/doc/Manual/ManualPettyCash.html 2010-07-08 19:49:09 UTC (rev 3589) @@ -90,7 +90,7 @@ <br><br> Expenses reported can be edited and deleted before are authorized. Once authorized and posted can not be modified in any way. <br><br> -<b>Expense authoritation</b> +<b>Expense authorisation</b> <br><br> Supervisor will need to authorize expenses and cash assignemnts reported. <br><br> @@ -149,5 +149,5 @@ 4) there's 2 options depending on company's culture: 1. extra cash assignment of 30 USD (cash assignment positive, so 500-530+30 = 0 balanced) - 2. next cash assignment of 500 USD will show he has only 470 available, as 30 were owed. + 2. next cash assignment of 500 USD will show he has only 470 available, as 30 were owed. <!-- Help End: Petty Cash --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-08 19:50:03
|
Revision: 3591 http://web-erp.svn.sourceforge.net/web-erp/?rev=3591&view=rev Author: tim_schofield Date: 2010-07-08 19:49:56 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Layout improvements and sql fixes Modified Paths: -------------- trunk/GLBudgets.php trunk/doc/Change.log.html trunk/includes/DateFunctions.inc trunk/sql/mysql/weberp-demo.sql Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2010-07-08 19:49:24 UTC (rev 3590) +++ trunk/GLBudgets.php 2010-07-08 19:49:56 UTC (rev 3591) @@ -34,10 +34,10 @@ echo '</br><tr><td>'. _('Select GL Account'). ":</td><td><select name='SelectedAccount' onChange='ReloadForm(selectaccount.Select)'>"; -$SQL = 'SELECT accountcode, +$SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result=DB_query($SQL,$db); if (DB_num_rows($result)==0){ @@ -84,12 +84,12 @@ $ErrMsg = _('Cannot update GL budgets'); $DbgMsg = _('The SQL that failed to update the GL budgets was'); for ($i=1; $i<=12; $i++) { - $SQL='UPDATE chartdetails SET budget='.Round($_POST[$i.'this'],2). ' - WHERE period=' . ($CurrentYearEndPeriod-(12-$i)) ." + $SQL="UPDATE chartdetails SET budget='".Round($_POST[$i.'this'],2). "' + WHERE period='" . ($CurrentYearEndPeriod-(12-$i)) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); - $SQL='UPDATE chartdetails SET budget='.Round($_POST[$i.'next'],2).' - WHERE period=' . ($CurrentYearEndPeriod+$i) ." + $SQL="UPDATE chartdetails SET budget='".Round($_POST[$i.'next'],2)."' + WHERE period='" . ($CurrentYearEndPeriod+$i) ."' AND accountcode = '" . $SelectedAccount."'"; $result=DB_query($SQL,$db,$ErrMsg,$DbgMsg); } @@ -107,11 +107,11 @@ } // End of create periods - $SQL='SELECT period, + $SQL="SELECT period, budget, actual FROM chartdetails - WHERE accountcode=' . $SelectedAccount; + WHERE accountcode='" . $SelectedAccount . "'"; $result=DB_query($SQL,$db); while ($myrow=DB_fetch_array($result)) { @@ -215,14 +215,14 @@ $LastPeriod=$MyRow[0]; for ($i=$FirstPeriod;$i<=$LastPeriod;$i++) { - $sql='SELECT accountcode, + $sql="SELECT accountcode, period, budget, actual, bfwd, bfwdbudget FROM chartdetails - WHERE period ='. $i . ' AND accountcode = ' . $SelectedAccount; + WHERE period ='". $i . "' AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg = _('Could not retrieve the ChartDetail records because'); $result = DB_query($sql,$db,$ErrMsg); @@ -230,7 +230,10 @@ while ($myrow=DB_fetch_array($result)){ $CFwdBudget = $myrow['bfwdbudget'] + $myrow['budget']; - $sql = 'UPDATE chartdetails SET bfwdbudget=' . $CFwdBudget . ' WHERE period=' . ($myrow['period'] +1) . ' AND accountcode = ' . $SelectedAccount; + $sql = "UPDATE chartdetails + SET bfwdbudget='" . $CFwdBudget . "' + WHERE period='" . ($myrow['period'] +1) . "' + AND accountcode = '" . $SelectedAccount . "'"; $ErrMsg =_('Could not update the chartdetails record because'); $updresult = DB_query($sql,$db,$ErrMsg); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-08 19:49:24 UTC (rev 3590) +++ trunk/doc/Change.log.html 2010-07-08 19:49:56 UTC (rev 3591) @@ -1,6 +1,8 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>07/07/10 Tim: ManualPettyCash.html - Correct typo</p> +<p>08/07/10 Tim: GLBudgets - Layout improvements and sql fixes</p> +<p>08/07/10 Tim: index.php - Correct typo</p> +<p>08/07/10 Tim: ManualPettyCash.html - Correct typo</p> <p>07/07/10 Tim: GLBalanceSheet.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccounts.php - Layout improvements and properly quoting sql</p> <p>07/07/10 Tim: GLAccountInquiry.php - Layout improvements and properly quoting sql</p> Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2010-07-08 19:49:24 UTC (rev 3590) +++ trunk/includes/DateFunctions.inc 2010-07-08 19:49:56 UTC (rev 3591) @@ -803,7 +803,7 @@ $LastPeriodEnd = mktime(0,0,0,Date('m')+2,0,Date('Y')); } else { $Date_Array = explode('-', $myrow[0]); - $LastPeriodEnd = mktime(0,0,0,$Date_Array[1]+1,0,(int)$Date_Array[0]); + $LastPeriodEnd = mktime(0,0,0,$Date_Array[1]+2,0,(int)$Date_Array[0]); $LastPeriod = $myrow[1]; } /* Find the unix timestamp of the first period end date in periods table */ @@ -817,7 +817,6 @@ /* If the period number doesn't exist */ if (!PeriodExists($TransDate, $db)) { /* if the transaction is after the last period */ - echo (date('d/m/Y',$TransDate) .' '. date('d/m/Y',$LastPeriodEnd)); if ($TransDate > $LastPeriodEnd) { $PeriodEnd = mktime(0,0,0,Date('m', $TransDate)+1, 0, Date('Y', $TransDate)); $Period = $LastPeriod + 1; Modified: trunk/sql/mysql/weberp-demo.sql =================================================================== --- trunk/sql/mysql/weberp-demo.sql 2010-07-08 19:49:24 UTC (rev 3590) +++ trunk/sql/mysql/weberp-demo.sql 2010-07-08 19:49:56 UTC (rev 3591) @@ -10870,56 +10870,6 @@ -- Dumping data for table `periods` -- -INSERT INTO `periods` VALUES (-11,'2006-06-30'); -INSERT INTO `periods` VALUES (-10,'2006-07-31'); -INSERT INTO `periods` VALUES (-9,'2006-08-31'); -INSERT INTO `periods` VALUES (-8,'2006-09-30'); -INSERT INTO `periods` VALUES (-7,'2006-10-31'); -INSERT INTO `periods` VALUES (-6,'2006-11-30'); -INSERT INTO `periods` VALUES (-5,'2006-12-31'); -INSERT INTO `periods` VALUES (-4,'2007-01-31'); -INSERT INTO `periods` VALUES (-3,'2007-02-28'); -INSERT INTO `periods` VALUES (-2,'2007-03-31'); -INSERT INTO `periods` VALUES (-1,'2007-04-30'); -INSERT INTO `periods` VALUES (0,'2007-05-31'); -INSERT INTO `periods` VALUES (1,'2007-06-30'); -INSERT INTO `periods` VALUES (2,'2007-07-31'); -INSERT INTO `periods` VALUES (3,'2007-08-31'); -INSERT INTO `periods` VALUES (4,'2007-09-30'); -INSERT INTO `periods` VALUES (5,'2007-10-31'); -INSERT INTO `periods` VALUES (6,'2007-11-30'); -INSERT INTO `periods` VALUES (7,'2007-12-31'); -INSERT INTO `periods` VALUES (8,'2008-01-31'); -INSERT INTO `periods` VALUES (9,'2008-02-29'); -INSERT INTO `periods` VALUES (10,'2008-03-31'); -INSERT INTO `periods` VALUES (11,'2008-04-30'); -INSERT INTO `periods` VALUES (12,'2008-05-31'); -INSERT INTO `periods` VALUES (13,'2008-06-30'); -INSERT INTO `periods` VALUES (14,'2008-07-31'); -INSERT INTO `periods` VALUES (15,'2008-08-31'); -INSERT INTO `periods` VALUES (16,'2008-09-30'); -INSERT INTO `periods` VALUES (17,'2008-10-31'); -INSERT INTO `periods` VALUES (18,'2008-11-30'); -INSERT INTO `periods` VALUES (19,'2008-12-31'); -INSERT INTO `periods` VALUES (20,'2009-01-31'); -INSERT INTO `periods` VALUES (21,'2009-02-28'); -INSERT INTO `periods` VALUES (22,'2009-03-31'); -INSERT INTO `periods` VALUES (23,'2009-04-30'); -INSERT INTO `periods` VALUES (24,'2009-05-31'); -INSERT INTO `periods` VALUES (25,'2009-06-30'); -INSERT INTO `periods` VALUES (26,'2009-07-31'); -INSERT INTO `periods` VALUES (27,'2009-08-31'); -INSERT INTO `periods` VALUES (28,'2009-09-30'); -INSERT INTO `periods` VALUES (29,'2009-10-31'); -INSERT INTO `periods` VALUES (30,'2009-11-30'); -INSERT INTO `periods` VALUES (31,'2009-12-31'); -INSERT INTO `periods` VALUES (32,'2010-01-31'); -INSERT INTO `periods` VALUES (33,'2010-02-28'); -INSERT INTO `periods` VALUES (34,'2010-03-31'); -INSERT INTO `periods` VALUES (35,'2010-04-30'); -INSERT INTO `periods` VALUES (36,'2010-05-31'); -INSERT INTO `periods` VALUES (37,'2010-06-30'); - -- -- Dumping data for table `pickinglistdetails` -- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-08 19:50:25
|
Revision: 3592 http://web-erp.svn.sourceforge.net/web-erp/?rev=3592&view=rev Author: tim_schofield Date: 2010-07-08 19:50:19 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Layout improvements and sql fixes Modified Paths: -------------- trunk/GLJournal.php trunk/doc/Change.log.html Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2010-07-08 19:49:56 UTC (rev 3591) +++ trunk/GLJournal.php 2010-07-08 19:50:19 UTC (rev 3592) @@ -24,7 +24,7 @@ Journals cannot be entered against bank accounts GL postings involving bank accounts must be done using a receipt or a payment transaction to ensure a bank trans is available for matching off vs statements */ - $SQL = 'SELECT accountcode FROM bankaccounts'; + $SQL = "SELECT accountcode FROM bankaccounts"; $result = DB_query($SQL,$db); $i=0; while ($Act = DB_fetch_row($result)){ @@ -62,43 +62,45 @@ $TransNo = GetNextTransNo( 0, $db); foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { - $SQL = 'INSERT INTO gltrans (type, + $SQL = "INSERT INTO gltrans (type, typeno, trandate, periodno, account, narrative, amount, - tag) '; - $SQL= $SQL . 'VALUES (0, - ' . $TransNo . ", + tag) "; + $SQL= $SQL . "VALUES (0, + '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', - " . $PeriodNo . ", - " . $JournalItem->GLCode . ", + '" . $PeriodNo . "', + '" . $JournalItem->GLCode . "', '" . $JournalItem->Narrative . "', - " . $JournalItem->Amount . - ",'".$JournalItem->tag."')"; + '" . $JournalItem->Amount . "', + '" . $JournalItem->tag."' + )"; $ErrMsg = _('Cannot insert a GL entry for the journal line because'); $DbgMsg = _('The SQL that failed to insert the GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); if ($_POST['JournalType']==_('Reversing')){ - $SQL = 'INSERT INTO gltrans (type, + $SQL = "INSERT INTO gltrans (type, typeno, trandate, periodno, account, narrative, amount, - tag) '; - $SQL= $SQL . 'VALUES (0, - ' . $TransNo . ", + tag) "; + $SQL= $SQL . "VALUES (0, + '" . $TransNo . "', '" . FormatDateForSQL($_SESSION['JournalDetail']->JnlDate) . "', - " . ($PeriodNo + 1) . ", - " . $JournalItem->GLCode . ", + '" . ($PeriodNo + 1) . "', + '" . $JournalItem->GLCode . "', 'Reversal - " . $JournalItem->Narrative . "', - " . -($JournalItem->Amount) . - ",'".$JournalItem->tag."')"; + '" . -($JournalItem->Amount) ."', + '".$JournalItem->tag."' + )"; $ErrMsg =_('Cannot insert a GL entry for the reversing journal because'); $DbgMsg = _('The SQL that failed to insert the GL Trans record was'); @@ -163,9 +165,9 @@ } if ($AllowThisPosting) { - $SQL = 'SELECT accountname + $SQL = "SELECT accountname FROM chartmaster - WHERE accountcode=' . $_POST['GLManualCode']; + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); if (DB_num_rows($Result)==0){ @@ -234,8 +236,7 @@ echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post name="form">'; -echo '<p><table border=0 width=100%> - <p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<tr><hr></tr>'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title; // A new table in the first column of the main table @@ -244,8 +245,8 @@ $_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); } - echo '<tr> - <td colspan=5><table border=0 width=30%><tr><td>'._('Date to Process Journal').":</td> + echo '<table><tr> + <td colspan=5><table class=selection><tr><td>'._('Date to Process Journal').":</td> <td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='JournalProcessDate' maxlength=10 size=11 value='" . $_SESSION['JournalDetail']->JnlDate . "'></td>"; echo '<td>' . _('Type') . ':</td> @@ -265,9 +266,11 @@ /* close off the table in the first column */ echo '<br>'; - echo '<table border=0 width=70%>'; + echo '<table class=selection width=70%>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ + echo '<tr><th colspan=3><div class="centre"><font size=3 color=blue><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; + /*now set up a GLCode field to select from avaialble GL accounts */ echo '<tr><th>' . _('GL Tag') . '</th>'; echo '<th>' . _('GL Account Code') . '</th>'; @@ -275,15 +278,13 @@ /* Set upthe form for the transaction entry for a GL Payment Analysis item */ -echo '<div class="centre"><font size=3 color=blue>' . _('Journal Line Entry') . '</font></div>'; - //Select the tag echo '<tr><td><select name="tag">'; - $SQL = 'SELECT tagref, + $SQL = "SELECT tagref, tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); echo '<option value=0>0 - None'; @@ -304,10 +305,10 @@ "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' VALUE='. $_POST['GLManualCode'] .' ></td>'; - $sql='SELECT accountcode, + $sql="SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -342,12 +343,14 @@ echo '<td><input type="text" name="GLNarrative" maxlength=100 size=100 value="' . $_POST['GLNarrative'] . '"></td>'; - echo '</tr></table>'; /*Close the main table */ - echo "<div class='centre'><input type=submit name=Process value='" . _('Accept') . "'></div><br><hr><br>"; + echo '</tr></table><br>'; /*Close the main table */ + echo "<div class='centre'><input type=submit name=Process value='" . _('Accept') . "'></div><br><br>"; - echo "<table border =1 width=85%><tr><td><table width=100%> - <tr> + echo "<table class=selection width=85%>"; + + echo '<tr><th colspan=6><div class="centre"><font size=3 color=blue><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; + echo "<tr> <th>"._('GL Tag')."</th> <th>"._('GL Account')."</th> <th>"._('Debit')."</th> @@ -366,9 +369,9 @@ echo '<tr class="EvenTableRows">'; $j++; } - $sql='SELECT tagdescription ' . - 'FROM tags ' . - 'WHERE tagref='.$JournalItem->tag; + $sql="SELECT tagdescription + FROM tags + WHERE tagref='".$JournalItem->tag . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($JournalItem->tag==0) { @@ -405,7 +408,7 @@ number_format(abs($debittotal-$credittotal),2); } if ($debittotal>$credittotal) {echo ' Credit';} else if ($debittotal<$credittotal) {echo ' Debit';} - echo '</b></td></tr></table></td></tr></table>'; + echo '</b></td></tr></table>'; if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ echo "<br><br><div class='centre'><input type=submit name='CommitBatch' value='"._('Accept and Process Journal')."'></div>"; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-08 19:49:56 UTC (rev 3591) +++ trunk/doc/Change.log.html 2010-07-08 19:50:19 UTC (rev 3592) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>08/07/10 Tim: GLBudgets - Layout improvements and sql fixes</p> +<p>08/07/10 Tim: GLJournal - Layout improvements and sql fixes</p> +<p>08/07/10 Tim: GLBudgets - Bug fixes and layout improvements and sql fixes</p> <p>08/07/10 Tim: index.php - Correct typo</p> <p>08/07/10 Tim: ManualPettyCash.html - Correct typo</p> <p>07/07/10 Tim: GLBalanceSheet.php - Layout improvements and properly quoting sql</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-08 19:50:44
|
Revision: 3593 http://web-erp.svn.sourceforge.net/web-erp/?rev=3593&view=rev Author: tim_schofield Date: 2010-07-08 19:50:37 +0000 (Thu, 08 Jul 2010) Log Message: ----------- Layout improvements and sql fixes Modified Paths: -------------- trunk/GLProfit_Loss.php trunk/doc/Change.log.html Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2010-07-08 19:50:19 UTC (rev 3592) +++ trunk/GLProfit_Loss.php 2010-07-08 19:50:37 UTC (rev 3593) @@ -36,9 +36,9 @@ $period=GetPeriod($FromDate, $db); /*Show a form to allow input of criteria for profit and loss to show */ - echo '<p><table class="table"><tr><td>'._('Select Period From').":</td><td><select Name='FromPeriod'>"; + echo '<p><table class="selection"><tr><td>'._('Select Period From').":</td><td><select Name='FromPeriod'>"; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); @@ -61,7 +61,7 @@ echo '</select></td></tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $lastDate = date("Y-m-d",mktime(0,0,0,Date('m')+1,0,Date('Y'))); - $sql = "SELECT periodno FROM periods where lastdate_in_period = '$lastDate'"; + $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $lastDate . "'"; $MaxPrd = DB_query($sql,$db); $MaxPrdrow = DB_fetch_row($MaxPrd); $DefaultToPeriod = (int) ($MaxPrdrow[0]); @@ -124,17 +124,17 @@ $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); - $SQL = 'SELECT accountgroups.sectioninaccounts, + $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, chartdetails.accountcode , chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['FromPeriod'] - 12) . ' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['ToPeriod']-12) . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -148,7 +148,7 @@ ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db); @@ -528,23 +528,23 @@ exit; } - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno=' . $_POST['ToPeriod']; + $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='" . $_POST['ToPeriod'] . "'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); - $SQL = 'SELECT accountgroups.sectioninaccounts, + $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, chartdetails.accountcode, chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['FromPeriod'] - 12) . ' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . ($_POST['ToPeriod']-12) . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode @@ -559,7 +559,7 @@ accountgroups.sequenceintb, accountgroups.groupname, accountgroups.sequenceintb, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because'),_('The SQL that failed was')); @@ -568,7 +568,7 @@ /*show a table of the accounts info returned by the SQL Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */ - echo '<table cellpadding=2>'; + echo '<table cellpadding=2 class=selection>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = "<tr> @@ -843,7 +843,7 @@ $ActGrp = $myrow['groupname']; if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> + <th colspan=8><font size=3 color=BLUE><b>%s</b></font></th> </tr>', $myrow['groupname']); echo $TableHeader; @@ -1192,9 +1192,9 @@ </tr>'; echo '</table>'; - echo "<div class='centre'><input type=submit Name='SelectADifferentPeriod' Value='"._('Select A Different Period')."'></div>"; + echo "<br><div class='centre'><input type=submit Name='SelectADifferentPeriod' Value='"._('Select A Different Period')."'></div>"; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-08 19:50:19 UTC (rev 3592) +++ trunk/doc/Change.log.html 2010-07-08 19:50:37 UTC (rev 3593) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>08/07/10 Tim: GLProfit_Loss - Layout improvements and sql fixes</p> <p>08/07/10 Tim: GLJournal - Layout improvements and sql fixes</p> <p>08/07/10 Tim: GLBudgets - Bug fixes and layout improvements and sql fixes</p> <p>08/07/10 Tim: index.php - Correct typo</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-07-09 08:01:20
|
Revision: 3595 http://web-erp.svn.sourceforge.net/web-erp/?rev=3595&view=rev Author: daintree Date: 2010-07-09 08:01:14 +0000 (Fri, 09 Jul 2010) Log Message: ----------- <p>09/07/10 Phil: includes/DateFunctions.inc added assumption for 2 digit years to d/m/Y m/d/Y and Y/m/d formats <p>09/07/10 Phil: Prices.php fixed error trapping to allow end dates of 0000-00-00 - the default no end date used by the logic Modified Paths: -------------- trunk/Prices.php trunk/doc/Change.log.html trunk/includes/DateFunctions.inc Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2010-07-08 19:50:50 UTC (rev 3594) +++ trunk/Prices.php 2010-07-09 08:01:14 UTC (rev 3595) @@ -58,7 +58,7 @@ echo _('Pricing for part') . ':<input type=text name="Item" MAXSIZEe=22 VALUE="' . $Item . '" maxlength=20><input type=submit name=NewPart Value="' . _('Review Prices') . '">'; echo '<hr>'; -if ($myrow[1]=="K"){ +if ($myrow[1]=='K'){ prnMsg(_('The part selected is a kit set item') .', ' . _('these items explode into their components when selected on an order') . ', ' . _('prices must be set up for the components and no price can be set for the whole kit'),'error'); exit; } @@ -79,18 +79,21 @@ $InputError =1; prnMsg (_('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); } - if (! Is_Date($_POST['EndDate']) AND $_POST['EndDate']!=''){ - $InputError =1; - prnMsg (_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); + + if (FormatDateForSQL($_POST['EndDate'])!='0000-00-00'){ + if (! Is_Date($_POST['EndDate']) AND $_POST['EndDate']!=''){ + $InputError =1; + prnMsg (_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); + } + if (Date1GreaterThanDate2($_POST['StartDate'],$_POST['EndDate']) AND $_POST['EndDate']!='' AND FormatDateForSQL($_POST['EndDate'])!='0000-00-00'){ + $InputError =1; + prnMsg (_('The end date is expected to be after the start date, enter an end date after the start date for this price'),'error'); + } + if (Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']),$_POST['EndDate']) AND $_POST['EndDate']!='' AND FormatDateForSQL($_POST['EndDate'])!='0000-00-00'){ + $InputError =1; + prnMsg(_('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!'),'error'); + } } - if (Date1GreaterThanDate2($_POST['StartDate'],$_POST['EndDate']) AND $_POST['EndDate']!=''){ - $InputError =1; - prnMsg (_('The end date is expected to be after the start date, enter an end date after the start date for this price'),'error'); - } - if (Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']),$_POST['EndDate']) AND $_POST['EndDate']!=''){ - $InputError =1; - prnMsg(_('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!'),'error'); - } if (Is_Date($_POST['EndDate'])){ $SQLEndDate = FormatDateForSQL($_POST['EndDate']); } else { @@ -270,14 +273,14 @@ $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; $_POST['Price'] = $_GET['Price']; $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); - if ($_GET['EndDate']==''){ - $_POST['EndDate'] =''; + if ($_GET['EndDate']=='' OR $_GET['EndDate']=='0000-00-00'){ + $_POST['EndDate'] = ''; } else { $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']); } } - $SQL = "SELECT currabrev, currency FROM currencies"; + $SQL = 'SELECT currabrev, currency FROM currencies'; $result = DB_query($SQL,$db); echo '<table><tr><td>' . _('Currency') . ':</td><td><select name="CurrAbrev">'; @@ -329,7 +332,9 @@ <tr><td><?php echo _('Price'); ?>:</td> <td> <input type="Text" class=number name="Price" size=12 maxlength=11 value= - <?php if(isset($_POST['Price'])) {echo $_POST['Price'];}?>> + <?php if(isset($_POST['Price'])) { + echo $_POST['Price']; + }?>> </td></tr> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-08 19:50:50 UTC (rev 3594) +++ trunk/doc/Change.log.html 2010-07-09 08:01:14 UTC (rev 3595) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>09/07/10 Phil: includes/DateFunctions.inc added assumption for 2 digit years to d/m/Y m/d/Y and Y/m/d formats +<p>09/07/10 Phil: Prices.php fixed error trapping to allow end dates of 0000-00-00 - the default no end date used by the logic <p>08/07/10 Tim: GLProfit_Loss - Layout improvements and sql fixes</p> <p>08/07/10 Tim: GLJournal - Layout improvements and sql fixes</p> <p>08/07/10 Tim: GLBudgets - Bug fixes and layout improvements and sql fixes</p> Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2010-07-08 19:50:50 UTC (rev 3594) +++ trunk/includes/DateFunctions.inc 2010-07-09 08:01:14 UTC (rev 3595) @@ -376,10 +376,8 @@ /* takes a date in a the format specified in $_SESSION['DefaultDateFormat'] and converts to a yyyy/mm/dd format */ - $DateEntry = trim($DateEntry); - if (strpos($DateEntry,'/')) { $Date_Array = explode('/',$DateEntry); } elseif (strpos ($DateEntry,'-')) { @@ -397,29 +395,36 @@ } if ($_SESSION['DefaultDateFormat']=='Y/m/d') { + if (strlen($Date_Array[0])==2) { + if ((int)$Date_Array[0] <=60) { + $Date_Array[0] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[0] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[0] = '19'.$Date_Array[2]; + } + } return $Date_Array[0].'-'.$Date_Array[1].'-'.$Date_Array[2]; - } - -//to modify assumption in 2030 - if (strlen($Date_Array[0])==2) { - if ((int)$Date_Array[2] <60) { - $Date_Array[2] = '20'.$Date_Array[2]; - } elseif ((int)$Date_Array[2] >59 AND (int)$Date_Array[2] <100) { - $Date_Array[0] = '19'.$Date_Array[2]; - } elseif ((int)$Date_Array[2] >9999) { - return 0; + + }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ + if (strlen($Date_Array[2])==2) { + if ((int)$Date_Array[2] <=60) { + $Date_Array[2] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[2] = '19'.$Date_Array[2]; + } } - } - if (($_SESSION['DefaultDateFormat']=='d/m/Y')){ /* echo '<BR>The date returned is ' . $Date_Array[2].'/'.$Date_Array[1].'/'.$Date_Array[0]; */ return $Date_Array[2].'-'.$Date_Array[1].'-'.$Date_Array[0]; - } elseif ($_SESSION['DefaultDateFormat']=='d.m.Y') { - return $Date_Array[2].'-'.$Date_Array[1].'-'.$Date_Array[0]; + } elseif ($_SESSION['DefaultDateFormat']=='m/d/Y') { + if (strlen($Date_Array[2])==2) { + if ((int)$Date_Array[2] <=60) { + $Date_Array[2] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[2] = '19'.$Date_Array[2]; + } + } return $Date_Array[2].'-'.$Date_Array[0].'-'.$Date_Array[1]; - } elseif ($_SESSION['DefaultDateFormat']=='Y/m/d') { - return $Date_Array[0].'-'.$Date_Array[1].'-'.$Date_Array[2]; - } + } }// end of function This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-09 21:54:51
|
Revision: 3599 http://web-erp.svn.sourceforge.net/web-erp/?rev=3599&view=rev Author: tim_schofield Date: 2010-07-09 21:54:44 +0000 (Fri, 09 Jul 2010) Log Message: ----------- Layout improvements changed period number to date and year and sql fixes Modified Paths: -------------- trunk/GLTransInquiry.php trunk/doc/Change.log.html Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2010-07-09 12:41:47 UTC (rev 3598) +++ trunk/GLTransInquiry.php 2010-07-09 21:54:44 UTC (rev 3599) @@ -10,7 +10,6 @@ include('includes/header.inc'); // Page Border -echo '<table border=1 width=100%><tr><td bgcolor="#FFFFFF"><div class="centre">'; $menuUrl = '<a href="'. $rootpath . '/index.php?&Application=GL'. SID .'">' . _('General Ledger Menu') . '</a></div>'; if ( !isset($_GET['TypeID']) OR !isset($_GET['TransNo']) ) @@ -18,10 +17,10 @@ prnMsg(_('This page requires a valid transaction type and number'),'warn'); echo $menuUrl; } else { - $typeSQL = 'SELECT typename, + $typeSQL = "SELECT typename, typeno FROM systypes - WHERE typeid = ' . $_GET['TypeID']; + WHERE typeid = '" . $_GET['TypeID'] . "'"; $TypeResult = DB_query($typeSQL,$db); @@ -34,15 +33,14 @@ $TransName = $myrow[0]; // Context Navigation and Title - echo '<table width=100%> - <td width=40% align=left>' . $menuUrl. '</td> - <td align=left><font size=4 color=blue><u><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></u></font></td> - </table><p>'; - + echo $menuUrl; // //========[ SHOW SYNOPSYS ]=========== // - echo '<table border=1>'; //Main table + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' + . _('Print') . '" alt="">' . ' ' . $title . '</p>'; + echo '<table class=selection>'; //Main table + echo '<tr><th colspan=7><font size=3 color=blue><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th></tr>'; echo '<tr> <th>' . _('Date') . '</th> <th>' . _('Period') .'</th> @@ -60,12 +58,15 @@ gltrans.narrative, gltrans.amount, gltrans.posted, - chartmaster.accountname + chartmaster.accountname, + periods.lastdate_in_period FROM gltrans, - chartmaster + chartmaster, + periods WHERE gltrans.account = chartmaster.accountcode - AND gltrans.type= " . $_GET['TypeID'] . " - AND gltrans.typeno = " . $_GET['TransNo'] . " + AND periods.periodno=gltrans.periodno + AND gltrans.type= '" . $_GET['TypeID'] . "' + AND gltrans.typeno = '" . $_GET['TransNo'] . "' ORDER BY gltrans.counterindex"; $TransResult = DB_query($SQL,$db); @@ -90,7 +91,7 @@ $URL = $rootpath . '/CustomerInquiry.php?' . SID . '&CustomerID='; $date = '&TransAfterDate=' . $TranDate; - $DetailSQL = 'SELECT debtortrans.debtorno, + $DetailSQL = "SELECT debtortrans.debtorno, debtortrans.ovamount, debtortrans.ovgst, debtortrans.rate, @@ -98,14 +99,14 @@ FROM debtortrans, debtorsmaster WHERE debtortrans.debtorno = debtorsmaster.debtorno - AND debtortrans.type = ' . $TransRow['type'] . ' - AND debtortrans.transno = ' . $_GET['TransNo']; + AND debtortrans.type = '" . $TransRow['type'] . "' + AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { $URL = $rootpath . '/SupplierInquiry.php?' . SID . '&SupplierID='; $date = '&FromDate=' . $TranDate; - $DetailSQL = 'SELECT supptrans.supplierno, + $DetailSQL = "SELECT supptrans.supplierno, supptrans.ovamount, supptrans.ovgst, supptrans.rate, @@ -113,8 +114,8 @@ FROM supptrans, suppliers WHERE supptrans.supplierno = suppliers.supplierid - AND supptrans.type = ' . $TransRow['type'] . ' - AND supptrans.transno = ' . $_GET['TransNo']; + AND supptrans.type = '" . $TransRow['type'] . "' + AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { $URL = $rootpath . '/GLAccountInquiry.php?' . SID . '&Account=' . $TransRow['account']; @@ -134,7 +135,7 @@ $j++; } echo '<td>' . $TranDate . '</td> - <td class=number>' . $TransRow['periodno'] . '</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> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-09 12:41:47 UTC (rev 3598) +++ trunk/doc/Change.log.html 2010-07-09 21:54:44 UTC (rev 3599) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>09/07/10 Tim: GLTransInquiry.php - Layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTags - Layout improvements and sql fixes</p> <p>09/07/10 Phil: includes/DateFunctions.inc added assumption for 2 digit years to d/m/Y m/d/Y and Y/m/d formats <p>09/07/10 Phil: Prices.php fixed error trapping to allow end dates of 0000-00-00 - the default no end date used by the logic This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-09 21:55:21
|
Revision: 3600 http://web-erp.svn.sourceforge.net/web-erp/?rev=3600&view=rev Author: tim_schofield Date: 2010-07-09 21:55:13 +0000 (Fri, 09 Jul 2010) Log Message: ----------- Bug fixes, layout improvements changed period number to date and year and sql fixes Modified Paths: -------------- trunk/GLTrialBalance.php trunk/doc/Change.log.html trunk/includes/session.inc Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2010-07-09 21:54:44 UTC (rev 3599) +++ trunk/GLTrialBalance.php 2010-07-09 21:55:13 UTC (rev 3600) @@ -24,8 +24,10 @@ if ((! isset($_POST['FromPeriod']) AND ! isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ include ('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . + _('Trial Balance') . '" alt="">' . ' ' . $title . '</div>'; echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; - + if (Date('m') > $_SESSION['YearEnd']){ /*Dates in SQL format */ $DefaultFromDate = Date ('Y-m-d', Mktime(0,0,0,$_SESSION['YearEnd'] + 2,0,Date('Y'))); @@ -37,9 +39,13 @@ $period=GetPeriod($FromDate, $db); /*Show a form to allow input of criteria for TB to show */ - echo '<table><tr><td>' . _('Select Period From:') . '</td><td><select Name="FromPeriod">'; + echo '<table class=selection><tr><td>' . _('Select Period From:') . '</td><td><select Name="FromPeriod">'; $nextYear = date("Y-m-d",strtotime("+1 Year")); - $sql = "SELECT periodno, lastdate_in_period FROM periods where lastdate_in_period < '$nextYear' ORDER BY periodno DESC"; + $sql = "SELECT periodno, + lastdate_in_period + FROM periods + WHERE lastdate_in_period < '" . $nextYear . "' + ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); @@ -62,7 +68,9 @@ echo '</select></td></tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $lastDate = date("Y-m-d",mktime(0,0,0,Date('m')+1,0,Date('Y'))); - $sql = "SELECT periodno FROM periods where lastdate_in_period = '$lastDate'"; + $sql = "SELECT periodno + FROM periods + WHERE lastdate_in_period = '" . $lastDate . "'"; $MaxPrd = DB_query($sql,$db); $MaxPrdrow = DB_fetch_row($MaxPrd); $DefaultToPeriod = (int) ($MaxPrdrow[0]); @@ -78,12 +86,12 @@ while ($myrow=DB_fetch_array($Periods,$db)){ if($myrow['periodno']==$DefaultToPeriod){ - echo '<option selected VALUE="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']); + echo '<option selected value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']); } else { - echo '<option VALUE ="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']); + echo '<option value ="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']); } } - echo '</select></td></tr></table>'; + echo '</select></td></tr></table><br>'; echo '<div class="centre"><input type=submit Name="ShowTB" Value="' . _('Show Trial Balance') .'">'; echo "<input type=submit Name='PrintPDF' Value='"._('PrintPDF')."'></div>"; @@ -93,9 +101,9 @@ include ('includes/GLPostings.inc'); } else if (isset($_POST['PrintPDF'])) { - + include('includes/PDFStarter.php'); - + $pdf->addInfo('Title', _('Trial Balance') ); $pdf->addInfo('Subject', _('Trial Balance') ); $PageNumber = 0; @@ -104,24 +112,26 @@ $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno=' . $_POST['ToPeriod']; + $sql = "SELECT lastdate_in_period + FROM periods + WHERE periodno='" . $_POST['ToPeriod'] . "'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; - $SQL = 'SELECT accountgroups.groupname, + $SQL = "SELECT accountgroups.groupname, accountgroups.parentgroupname, accountgroups.pandl, chartdetails.accountcode , chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.actual ELSE 0 END) AS monthactual, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.budget ELSE 0 END) AS monthbudget, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.actual ELSE 0 END) AS monthactual, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.budget ELSE 0 END) AS monthbudget, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode GROUP BY accountgroups.groupname, @@ -133,7 +143,7 @@ ORDER BY accountgroups.pandl desc, accountgroups.sequenceintb, accountgroups.groupname, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db); if (DB_error_no($db) !=0) { @@ -156,9 +166,9 @@ include('includes/footer.inc'); exit; } - + include('includes/PDFTrialBalancePageHeader.inc'); - + $j = 1; $Level = 1; $ActGrp = ''; @@ -168,13 +178,22 @@ $GrpBudget = array(0); $GrpPrdActual = array(0); $GrpPrdBudget = array(0); + $PeriodProfitLoss = 0; + $PeriodBudgetProfitLoss = 0; + $MonthProfitLoss = 0; + $MonthBudgetProfitLoss= 0; + $BFwdProfitLoss = 0; + $CheckMonth = 0; + $CheckBudgetMonth = 0; + $CheckPeriodActual = 0; + $CheckPeriodBudget = 0; while ($myrow=DB_fetch_array($AccountsResult)) { - + if ($myrow['groupname']!= $ActGrp){ - if ($ActGrp !=''){ - + if ($ActGrp !=''){ + // Print heading if at end of page if ($YPos < ($Bottom_Margin+ (2 * $line_height))) { include('includes/PDFTrialBalancePageHeader.inc'); @@ -184,7 +203,7 @@ $ParentGroups[$Level]=$myrow['groupname']; }elseif ($myrow['parentgroupname']==$ParentGroups[$Level]){ $YPos -= (.5 * $line_height); - $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); + $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); @@ -200,11 +219,11 @@ $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; $GrpPrdBduget[$Level] =0; - + } else { do { $YPos -= $line_height; - $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); + $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); @@ -221,11 +240,11 @@ $GrpPrdActual[$Level] =0; $GrpPrdBduget[$Level] =0; $Level--; - } while ($myrow['parentgroupname']!=$ParentGroups[$Level] AND $Level>0); + } while ($Level>0 and $myrow['parentgroupname']!=$ParentGroups[$Level]); if ($Level>0){ $YPos -= $line_height; - $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); + $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60, $YPos, 190, $FontSize, $ParentGroups[$Level]); @@ -265,7 +284,7 @@ $PeriodProfitLoss += $AccountPeriodActual; $PeriodBudgetProfitLoss += $AccountPeriodBudget; $MonthProfitLoss += $myrow['monthactual']; - $MonthBudgetProfitLoss += $myrow['budget']; + $MonthBudgetProfitLoss += $myrow['monthbudget']; $BFwdProfitLoss += $myrow['firstprdbfwd']; } else { /*PandL ==0 its a balance sheet account */ if ($myrow['accountcode']==$RetainedEarningsAct){ @@ -278,9 +297,21 @@ } for ($i=0;$i<=$Level;$i++){ + if (!isset($GrpActual[$i])) { + $GrpActual[$i]=0; + } $GrpActual[$i] +=$myrow['monthactual']; + if (!isset($GrpBudget[$i])) { + $GrpBudget[$i]=0; + } $GrpBudget[$i] +=$myrow['monthbudget']; + if (!isset($GrpPrdActual[$i])) { + $GrpPrdActual[$i]=0; + } $GrpPrdActual[$i] +=$AccountPeriodActual; + if (!isset($GrpPrdBudget[$i])) { + $GrpPrdBudget[$i]=0; + } $GrpPrdBudget[$i] +=$AccountPeriodBudget; } @@ -288,7 +319,7 @@ $CheckBudgetMonth += $myrow['monthbudget']; $CheckPeriodActual += $AccountPeriodActual; $CheckPeriodBudget += $AccountPeriodBudget; - + // Print heading if at end of page if ($YPos < ($Bottom_Margin)){ include('includes/PDFTrialBalancePageHeader.inc'); @@ -302,14 +333,14 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin+370,$YPos,70,$FontSize,number_format($AccountPeriodActual,2),'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($AccountPeriodBudget,2),'right'); $YPos -= $line_height; - + } //end of while loop - - - while ($myrow['parentgroupname']!=$ParentGroups[$Level] AND $Level>0) { - + + + while ($Level>0 and $myrow['parentgroupname']!=$ParentGroups[$Level]) { + $YPos -= (.5 * $line_height); - $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); + $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Total')); $LeftOvers = $pdf->addTextWrap($Left_Margin+60,$YPos,190,$FontSize,$ParentGroups[$Level]); @@ -327,16 +358,16 @@ $Level--; } - + $YPos -= (2 * $line_height); - $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); + $pdf->line($Left_Margin+250, $YPos+$line_height,$Left_Margin+500, $YPos+$line_height); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,_('Check Totals')); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,70,$FontSize,number_format($CheckMonth,2),'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+310,$YPos,70,$FontSize,number_format($CheckBudgetMonth,2),'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+370,$YPos,70,$FontSize,number_format($CheckPeriodActual,2),'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+430,$YPos,70,$FontSize,number_format($CheckPeriodBudget,2),'right'); - $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); - + $pdf->line($Left_Margin+250, $YPos,$Left_Margin+500, $YPos); + /* header('Content-type: application/pdf'); header('Content-Length: ' . $len); @@ -356,24 +387,26 @@ $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; - $sql = 'SELECT lastdate_in_period FROM periods WHERE periodno=' . $_POST['ToPeriod']; + $sql = "SELECT lastdate_in_period + FROM periods + WHERE periodno='" . $_POST['ToPeriod'] . "'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; - $SQL = 'SELECT accountgroups.groupname, + $SQL = "SELECT accountgroups.groupname, accountgroups.parentgroupname, accountgroups.pandl, chartdetails.accountcode , chartmaster.accountname, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.actual ELSE 0 END) AS monthactual, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.budget ELSE 0 END) AS monthbudget, - Sum(CASE WHEN chartdetails.period=' . $_POST['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['FromPeriod'] . "' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.actual ELSE 0 END) AS monthactual, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.budget ELSE 0 END) AS monthbudget, + Sum(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode GROUP BY accountgroups.groupname, @@ -385,7 +418,7 @@ ORDER BY accountgroups.pandl desc, accountgroups.sequenceintb, accountgroups.groupname, - chartdetails.accountcode'; + chartdetails.accountcode"; $AccountsResult = DB_query($SQL, @@ -393,12 +426,15 @@ _('No general ledger accounts were returned by the SQL because'), _('The SQL that failed was:')); - echo '<div class="centre"><font size=4 color=BLUE><b>'. _('Trial Balance for the month of ') . $PeriodToDate . _(' and for the ') . $NumberOfMonths . _(' months to ') . $PeriodToDate .'</b></font></div><br>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . + _('Trial Balance') . '" alt="">' . ' ' . _('Trial Balance Report') . '</div>'; /*show a table of the accounts info returned by the SQL Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */ - echo '<table cellpadding=2>'; + echo '<table cellpadding=2 class=selection>'; + echo '<tr><th colspan=6><font size=3 color=blue><b>'. _('Trial Balance for the month of ') . $PeriodToDate . + _(' and for the ') . $NumberOfMonths . _(' months to ') . $PeriodToDate .'</b></font></th></tr>'; $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>' . _('Account Name') . '</th> @@ -418,7 +454,7 @@ $GrpBudget =array(0); $GrpPrdActual =array(0); $GrpPrdBudget =array(0); - + $PeriodProfitLoss = 0; $PeriodBudgetProfitLoss = 0; $MonthProfitLoss = 0; @@ -454,7 +490,7 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; @@ -474,18 +510,18 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; $GrpPrdBudget[$Level] =0; $ParentGroups[$Level]=''; $Level--; - + $j++; } while ($Level>0 and $myrow['groupname']!=$ParentGroups[$Level]); - - if ($Level>0){ + + if ($Level>0){ printf('<tr> <td colspan=2><font size=2><I>%s ' . _('Total') . ' </I></font></td> <td class=number><I>%s</I></td> @@ -498,7 +534,7 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; @@ -602,7 +638,7 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; @@ -622,18 +658,18 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; $GrpPrdBudget[$Level] =0; $ParentGroups[$Level]=''; $Level--; - + $j++; } while (isset($ParentGroups[$Level]) and ($myrow['groupname']!=$ParentGroups[$Level] and $Level>0)); - - if ($Level >0){ + + if ($Level >0){ printf('<tr> <td colspan=2><font size=2><I>%s ' . _('Total') . ' </I></font></td> <td class=number><I>%s</I></td> @@ -646,7 +682,7 @@ number_format($GrpBudget[$Level],2), number_format($GrpPrdActual[$Level],2), number_format($GrpPrdBudget[$Level],2)); - + $GrpActual[$Level] =0; $GrpBudget[$Level] =0; $GrpPrdActual[$Level] =0; @@ -672,10 +708,10 @@ number_format($CheckPeriodActual,2), number_format($CheckPeriodBudget,2)); - echo '</table>'; + echo '</table><br>'; echo '<div class="centre"><input type=submit Name="SelectADifferentPeriod" Value="' . _('Select A Different Period') . '"></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-09 21:54:44 UTC (rev 3599) +++ trunk/doc/Change.log.html 2010-07-09 21:55:13 UTC (rev 3600) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>09/07/10 Tim: GLTrialBalance.php - Bug fixes, layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTransInquiry.php - Layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTags - Layout improvements and sql fixes</p> <p>09/07/10 Phil: includes/DateFunctions.inc added assumption for 2 digit years to d/m/Y m/d/Y and Y/m/d formats Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2010-07-09 21:54:44 UTC (rev 3599) +++ trunk/includes/session.inc 2010-07-09 21:55:13 UTC (rev 3600) @@ -40,9 +40,15 @@ if (isset($_SESSION['DatabaseName'])){ foreach ($_POST as $key => $value) { if (gettype($value) != "array") { + if(get_magic_quotes_gpc()) { + $_POST['name'] = stripslashes($_POST['name']); + } $_POST[$key] = DB_escape_string($value); } else { foreach ($value as $key1 => $value1) { + if(get_magic_quotes_gpc()) { + $value[$key1] = stripslashes($value[$key1]); + } $value[$key1] = DB_escape_string($value1); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-10 11:43:43
|
Revision: 3601 http://web-erp.svn.sourceforge.net/web-erp/?rev=3601&view=rev Author: tim_schofield Date: 2010-07-10 11:43:37 +0000 (Sat, 10 Jul 2010) Log Message: ----------- Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/StockLocTransfer.php trunk/StockLocTransferReceive.php trunk/doc/Change.log.html trunk/includes/DefineStockTransfers.php Modified: trunk/StockLocTransfer.php =================================================================== --- trunk/StockLocTransfer.php 2010-07-09 21:55:13 UTC (rev 3600) +++ trunk/StockLocTransfer.php 2010-07-10 11:43:37 UTC (rev 3601) @@ -8,7 +8,7 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); -If (isset($_POST['Submit']) OR isset($_POST['EnterMoreItems'])){ +if (isset($_POST['Submit']) OR isset($_POST['EnterMoreItems'])){ /*Trap any errors in input */ $InputError = False; /*Start off hoping for the best */ @@ -65,7 +65,7 @@ } /*Ship location and Receive location are different */ - If ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ + if ($_POST['FromStockLocation']==$_POST['ToStockLocation']){ $InputError=True; $ErrorMessage .= _('The transfer must have a different location to receive into and location sent from'); } @@ -78,6 +78,11 @@ for ($i=0;$i < $_POST['LinesCounter'];$i++){ if($_POST['StockID' . $i] != ""){ + $DecimalsSql = "SELECT decimalplaces + FROM stockmaster + WHERE stockid='" . $_POST['StockID' . $i] . "'"; + $DecimalResult = DB_Query($DecimalsSql, $db); + $DecimalRow = DB_fetch_array($DecimalResult); $sql = "INSERT INTO loctransfers (reference, stockid, shipqty, @@ -86,7 +91,7 @@ recloc) VALUES ('" . $_POST['Trf_ID'] . "', '" . $_POST['StockID' . $i] . "', - '" . $_POST['StockQTY' . $i] . "', + '" . round($_POST['StockQTY' . $i], $DecimalRow['decimalplaces']) . "', '" . Date('Y-m-d') . "', '" . $_POST['FromStockLocation'] ."', '" . $_POST['ToStockLocation'] . "')"; @@ -94,16 +99,16 @@ $resultLocShip = DB_query($sql,$db, $ErrMsg); } } - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to COMMIT Location Transfer transaction'); - DB_Txn_Commit($db); + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to COMMIT Location Transfer transaction'); + DB_Txn_Commit($db); prnMsg( _('The inventory transfer records have been created successfully'),'success'); echo '<p><a href="'.$rootpath.'/PDFStockLocTransfer.php?' . SID . 'TransferNo=' . $_POST['Trf_ID'] . '">'. _('Print the Transfer Docket'). '</a>'; unset($_SESSION['DispatchingTransfer']); unset($_SESSION['Transfer']); + include('includes/footer.inc'); - } else { //Get next Inventory Transfer Shipment Reference Number if (isset($_GET['Trf_ID'])){ @@ -116,7 +121,7 @@ $Trf_ID = GetNextTransNo(16,$db); } - If (isset($InputError) and $InputError==true){ + if (isset($InputError) and $InputError==true){ echo '<br>'; prnMsg($ErrorMessage, 'error'); @@ -124,13 +129,18 @@ } - echo '<hr><form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . + '" alt="">' . ' ' . $title . ''; - echo '<div class="centre"><input type=hidden name="Trf_ID" VALUE="' . $Trf_ID . '"><h2>'. _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</h2>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post>'; + echo '<table class=selection>'; + echo '<tr><th colspan=4><input type=hidden name="Trf_ID" VALUE="' . $Trf_ID . '"><font size=3 color=blue>'. + _('Inventory Location Transfer Shipment Reference').' # '. $Trf_ID. '</font></th></tr>'; + $sql = 'SELECT loccode, locationname FROM locations'; $resultStkLocs = DB_query($sql,$db); - echo _('From Stock Location').':<select name="FromStockLocation">'; + echo '<tr><td>'._('From Stock Location').':</td><td><select name="FromStockLocation">'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['FromStockLocation'])){ if ($myrow['loccode'] == $_POST['FromStockLocation']){ @@ -145,10 +155,10 @@ echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } - echo '</select>'; + echo '</select></td>'; DB_data_seek($resultStkLocs,0); //go back to the start of the locations result - echo _('To Stock Location').':<select name="ToStockLocation">'; + echo '<td>'._('To Stock Location').':</td><td><select name="ToStockLocation">'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['ToStockLocation'])){ if ($myrow['loccode'] == $_POST['ToStockLocation']){ @@ -163,9 +173,9 @@ echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } - echo '</select></div><br>'; + echo '</select></td></tr></table><p>'; - echo '<table>'; + echo '<table class=selection>'; $tableheader = '<tr><th>'. _('Item Code'). '</th><th>'. _('Quantity'). '</th></tr>'; echo $tableheader; @@ -205,7 +215,7 @@ } echo '</table><br><div class="centre"> - <input type=hidden name="LinesCounter" value='. $i .'><input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"><input type=submit name="Submit" value="'. _('Create Transfer Shipment'). '"><br><hr>'; + <input type=hidden name="LinesCounter" value='. $i .'><input type=submit name="EnterMoreItems" value="'. _('Add More Items'). '"><input type=submit name="Submit" value="'. _('Create Transfer Shipment'). '"><br>'; echo '<script type="text/javascript">defaultControl(document.forms[0].StockID0);</script>'; echo '</form></div>'; include('includes/footer.inc'); Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2010-07-09 21:55:13 UTC (rev 3600) +++ trunk/StockLocTransferReceive.php 2010-07-10 11:43:37 UTC (rev 3601) @@ -93,13 +93,13 @@ VALUES ( '" . $TrfLine->StockID . "', 16, - " . $_SESSION['Transfer']->TrfID . ", + '" . $_SESSION['Transfer']->TrfID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . $SQLTransferDate . "', - " . $PeriodNo . ", + '" . $PeriodNo . "', '" . _('To') . ' ' . $_SESSION['Transfer']->StockLocationToName . "', - " . -$TrfLine->Quantity . ", - " . ($QtyOnHandPrior - $TrfLine->Quantity) . " + '" . round(-$TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior - $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); @@ -148,7 +148,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . $Item->BundleRef . "', - " . -$Item->BundleQty . ")"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item for the stock being transferred out of the existing location could not be inserted because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -164,10 +164,10 @@ serialno, moveqty ) VALUES ( - " . $StkMoveNo . ", + '" . $StkMoveNo . "', '" . $TrfLine->StockID . "', '" . $Item->BundleRef . "', - " . -$Item->BundleQty . " + '" . -$Item->BundleQty . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); @@ -206,11 +206,13 @@ VALUES ( '" . $TrfLine->StockID . "', 16, - " . $_SESSION['Transfer']->TrfID . ", + '" . $_SESSION['Transfer']->TrfID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', - '" . $SQLTransferDate . "'," . $PeriodNo . ", + '" . $SQLTransferDate . "', + '" . $PeriodNo . "', '" . _('From') . ' ' . $_SESSION['Transfer']->StockLocationFromName ."', - " . $TrfLine->Quantity . ", " . ($QtyOnHandPrior + $TrfLine->Quantity) . " + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + '" . round($QtyOnHandPrior + $TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the incoming stock cannot be added because'); @@ -243,7 +245,7 @@ if ($SerialItemExistsRow[0]==1){ $SQL = "UPDATE stockserialitems SET - quantity= quantity + " . $Item->BundleQty . " + quantity= quantity + '" . $Item->BundleQty . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' @@ -261,7 +263,7 @@ VALUES ('" . $TrfLine->StockID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record for the stock coming in could not be added because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -271,14 +273,15 @@ /* now insert the serial stock movement */ - $SQL = "INSERT INTO stockserialmoves (stockmoveno, + $SQL = "INSERT INTO stockserialmoves ( + stockmoveno, stockid, serialno, moveqty) VALUES (" . $StkMoveNo . ", '" . $TrfLine->StockID . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -287,7 +290,7 @@ } /*end if the transfer item is a controlled item */ $SQL = "UPDATE locstock - SET quantity = quantity - " . $TrfLine->Quantity . " + SET quantity = quantity - '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; @@ -296,7 +299,7 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); $SQL = "UPDATE locstock - SET quantity = quantity + " . $TrfLine->Quantity . " + SET quantity = quantity + '" . round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "' WHERE stockid='" . $TrfLine->StockID . "' AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; @@ -306,30 +309,30 @@ prnMsg(_('A stock transfer for item code'). ' - ' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . ' '. _('has been created from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . ' ' . _('for a quantity of'). ' '. $TrfLine->Quantity,'success'); - if ($TrfLine->CancelBalance==1){ - $sql = "UPDATE loctransfers SET recqty = recqty + ". $TrfLine->Quantity . ", - shipqty = recqty + ". $TrfLine->Quantity . ", + if ($TrfLine->CancelBalance==1){ + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + shipqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', recdate = '".date('Y-m-d H:i:s'). "' WHERE reference = '". $_SESSION['Transfer']->TrfID . "' AND stockid = '". $TrfLine->StockID."'"; - } else { - $sql = "UPDATE loctransfers SET recqty = recqty + ". $TrfLine->Quantity . ", - recdate = '".date('Y-m-d H:i:s'). "' - WHERE reference = '". $_SESSION['Transfer']->TrfID . "' - AND stockid = '". $TrfLine->StockID."'"; - } + } else { + $sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "', + recdate = '".date('Y-m-d H:i:s'). "' + WHERE reference = '". $_SESSION['Transfer']->TrfID . "' + AND stockid = '". $TrfLine->StockID."'"; + } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to update the Location Transfer Record'); $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true); unset ($_SESSION['Transfer']->LineItem[$i]); unset ($_POST['Qty' . $i]); } /*end if Quantity > 0 */ - if ($TrfLine->CancelBalance==1){ - $sql = "UPDATE loctransfers SET shipqty = recqty - WHERE reference = '". $_SESSION['Transfer']->TrfID . "' - AND stockid = '". $TrfLine->StockID."'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to set the quantity received to the quantity shipped to cancel the balance on this transfer line'); + if ($TrfLine->CancelBalance==1){ + $sql = "UPDATE loctransfers SET shipqty = recqty + WHERE reference = '". $_SESSION['Transfer']->TrfID . "' + AND stockid = '". $TrfLine->StockID."'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to set the quantity received to the quantity shipped to cancel the balance on this transfer line'); $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true); - } + } $i++; } /*end of foreach TransferItem */ @@ -364,7 +367,7 @@ ON loctransfers.recloc = reclocations.loccode INNER JOIN stockmaster ON loctransfers.stockid=stockmaster.stockid - WHERE reference =" . $_GET['Trf_ID'] . " ORDER BY loctransfers.stockid"; + WHERE reference ='" . $_GET['Trf_ID'] . "' ORDER BY loctransfers.stockid"; $ErrMsg = _('The details of transfer number') . ' ' . $_GET['Trf_ID'] . ' ' . _('could not be retrieved because') .' '; @@ -408,15 +411,19 @@ if (isset($_SESSION['Transfer'])){ //Begin Form for receiving shipment - echo '<hr><form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post>'; - echo '<a href="'.$_SERVER['PHP_SELF']. '?' . SID . '&NewTransfer=true">'. _('Select A Different Transfer').'</a>'; - echo '<div class="centre"><H2>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . $_SESSION['Transfer']->StockLocationToName . '</H2></div>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . + '" alt="">' . ' ' . $title . ''; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post>'; + prnMsg(_('Please Verify Shipment Quantities Received'),'info'); $i = 0; //Line Item Array pointer - echo "<br><table border=1>"; + echo "<br><table class=selection>"; + echo '<tr><th colspan=7><font size=3 color=blue>' . _('Location Transfer Reference'). ' #' . $_SESSION['Transfer']->TrfID . + ' '. _('from').' ' . $_SESSION['Transfer']->StockLocationFromName . ' '. _('to'). ' ' . + $_SESSION['Transfer']->StockLocationToName . '</font></th></tr>'; $tableheader = '<tr> <th>'. _('Item Code') . '</th> @@ -425,15 +432,21 @@ <th>'. _('Quantity Received'). '</th> <th>'. _('Quantity To Receive'). '</th> <th>'. _('Units'). '</th> - <th>'. _('Cancel Balance') . '</th> + <th>'. _('Cancel Balance') . '</th> </tr>'; echo $tableheader; - + $k=0; foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } - echo '<tr> - <td>' . $TrfLine->StockID . '</td> + echo '<td>' . $TrfLine->StockID . '</td> <td>' . $TrfLine->ItemDescription . '</td>'; echo '<td class=number>' . number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '</td>'; @@ -443,7 +456,7 @@ } else { $Qty = $TrfLine->Quantity; } - echo '<td>' . number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; + echo '<td class=number>' . number_format($TrfLine->PrevRecvQty, $TrfLine->DecimalPlaces) . '</td>'; if ($TrfLine->Controlled==1){ echo '<td><input type=hidden name="Qty' . $i . '" VALUE="' . $Qty . '"><a href="' . $rootpath .'/StockTransferControlled.php?' . SID . '&TransferItem=' . $i . '">' . $Qty . '</a></td>'; @@ -472,14 +485,18 @@ echo '</table><br /> <div class="centre"><input type=submit name="ProcessTransfer" VALUE="'. _('Process Inventory Transfer'). '"><bR /> </form></div>'; + echo '<a href="'.$_SERVER['PHP_SELF']. '?' . SID . '&NewTransfer=true">'. _('Select A Different Transfer').'</a>'; } else { /*Not $_SESSION['Transfer'] set */ - echo '<hr><form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post name=form1>'; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . + '" alt="">' . ' ' . $title . ''; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID . '" method=post name=form1>'; + $LocResult = DB_query("SELECT locationname, loccode FROM locations",$db); - echo '<table BORDER=0>'; + echo '<table class=selection>'; echo '<tr><td>'. _('Select Location Receiving Into'). ':</td><td>'; echo '<select NAME = "RecLocation" onChange=ReloadForm(form1.RefreshTransferList)>'; if (!isset($_POST['RecLocation'])){ @@ -504,17 +521,26 @@ $TrfResult = DB_query($sql,$db); if (DB_num_rows($TrfResult)>0){ - - echo '<table BORDER=0>'; - + $LocSql = "SELECT locationname FROM locations WHERE loccode='" . $_POST['RecLocation'] . "'"; + $LocResult = DB_query($LocSql,$db); + $LocRow = DB_fetch_array($LocResult); + echo '<table class=selection>'; + echo '<tr><th colspan=4><font size=3 color=blue>'._('Pending Transfers Into').' '.$LocRow['locationname'].'</font></th></tr>'; echo '<tr> <th>'. _('Transfer Ref'). '</th> <th>'. _('Transfer From'). '</th> <th>'. _('Dispatch Date'). '</th></tr>'; - + $k=0; while ($myrow=DB_fetch_array($TrfResult)){ - echo '<tr><td class=number>' . $myrow['reference'] . '</td> + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + echo '<td class=number>' . $myrow['reference'] . '</td> <td>' . $myrow['trffromloc'] . '</td> <td>' . ConvertSQLDate($myrow['shipdate']) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td></tr>'; @@ -528,4 +554,4 @@ echo '</form>'; } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-09 21:55:13 UTC (rev 3600) +++ trunk/doc/Change.log.html 2010-07-10 11:43:37 UTC (rev 3601) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>09/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>09/07/10 Tim: GLTrialBalance.php - Bug fixes, layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTransInquiry.php - Layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTags - Layout improvements and sql fixes</p> Modified: trunk/includes/DefineStockTransfers.php =================================================================== --- trunk/includes/DefineStockTransfers.php 2010-07-09 21:55:13 UTC (rev 3600) +++ trunk/includes/DefineStockTransfers.php 2010-07-10 11:43:37 UTC (rev 3601) @@ -55,6 +55,7 @@ $this->PartUnit = $PartUnit; $this->Controlled = $Controlled; $this->Serialised = $Serialised; + $this->DecimalPlaces = $DecimalPlaces; $this->ShipQty = $Quantity; if ($this->Controlled==1){ $this->Quantity = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-10 21:11:03
|
Revision: 3602 http://web-erp.svn.sourceforge.net/web-erp/?rev=3602&view=rev Author: tim_schofield Date: 2010-07-10 21:10:57 +0000 (Sat, 10 Jul 2010) Log Message: ----------- Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes Modified Paths: -------------- trunk/StockTransfers.php trunk/doc/Change.log.html Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2010-07-10 11:43:37 UTC (rev 3601) +++ trunk/StockTransfers.php 2010-07-10 21:10:57 UTC (rev 3602) @@ -13,6 +13,10 @@ include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['CheckCode'])) { + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Dispatch') . + '" alt="">' . ' ' . _('Select Item to Transfer') . ''; + if (strlen($_POST['StockText'])>0) { $sql='SELECT stockid, description from stockmaster where description like "%'.$_POST['StockText'].'%"'; } else { @@ -21,18 +25,20 @@ $ErrMsg=_('The stock information cannot be retrieved because'); $DbgMsg=_('The SQL to get the stock description was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - echo '<table><tr><th>'._('Stock Code').'</th><th>'._('Stock Description').'</th></tr>'; + echo '<table class=selection><tr><th>'._('Stock Code').'</th><th>'._('Stock Description').'</th></tr>'; while ($myrow = DB_fetch_row($result)) { echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td><td><a href="StockTransfers.php?StockID='.$myrow[0].'&Description='.$myrow[1].'">Transfer</a></tr>'; } echo '</table>'; + include('includes/footer.inc'); + exit; } $NewTransfer = false; /*initialise this first then determine from form inputs */ if (isset($_GET['NewTransfer'])){ - unset($_SESSION['Transfer']); - unset($_SESSION['TransferItem']); /*this is defined in bulk transfers but needs to be unset for individual trsnsfers */ + unset($_SESSION['Transfer']); + unset($_SESSION['TransferItem']); /*this is defined in bulk transfers but needs to be unset for individual trsnsfers */ } @@ -171,16 +177,17 @@ reference, qty, newqoh) - VALUES ('" . - $_SESSION['Transfer']->TransferItem[0]->StockID . "', + VALUES ( + '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', 16, - " . $TransferNumber . ", + '" . $TransferNumber . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', - '" . $SQLTransferDate . "'," . $PeriodNo . ", + '" . $SQLTransferDate . "', + '" . $PeriodNo . "', 'To " . $_SESSION['Transfer']->StockLocationTo ."', - " . -$_SESSION['Transfer']->TransferItem[0]->Quantity . ", - " . ($QtyOnHandPrior - $_SESSION['Transfer']->TransferItem[0]->Quantity) . - ")"; + '" . round(-$_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces) . "', + '" . ($QtyOnHandPrior - round($_SESSION['Transfer']->TransferItem[0]->Quantity,$_SESSION['Transfer']->TransferItem[0]->DecimalPlaces)) ."' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement record was used'); @@ -210,12 +217,11 @@ if ($SerialItemExistsRow[0]==1){ - $SQL = "UPDATE stockserialitems SET - quantity= quantity - " . $Item->BundleQty . " - WHERE - stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' - AND serialno='" . $Item->BundleRef . "'"; + $SQL = "UPDATE stockserialitems + SET quantity= quantity - '" . $Item->BundleQty . "' + WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -229,7 +235,7 @@ VALUES ('" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', '" . $_SESSION['Transfer']->StockLocationFrom . "', '" . $Item->BundleRef . "', - " . -$Item->BundleQty . ")"; + '" . -$Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be added because'); $DbgMsg = _('The following SQL to insert the serial stock item record was used'); @@ -245,10 +251,10 @@ serialno, moveqty) VALUES ( - " . $StkMoveNo . ", + '" . $StkMoveNo . "', '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', '" . $Item->BundleRef . "', - -" . $Item->BundleQty . " + '" . $Item->BundleQty . "' )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); @@ -261,8 +267,8 @@ // Need to get the current location quantity will need it later for the stock movement $SQL="SELECT locstock.quantity - FROM locstock - WHERE locstock.stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + FROM locstock + WHERE locstock.stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' AND loccode= '" . $_SESSION['Transfer']->StockLocationTo . "'"; $ErrMsg = _('Could not retrieve QOH at the destination because'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg,true); @@ -286,14 +292,14 @@ newqoh) VALUES ('" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', 16, - " . $TransferNumber . ", + '" . $TransferNumber . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . $SQLTransferDate . "', - " . $PeriodNo . ", + '" . $PeriodNo . "', '" . _('From') . " " . $_SESSION['Transfer']->StockLocationFrom . "', - " . $_SESSION['Transfer']->TransferItem[0]->Quantity . ", - " . ($QtyOnHandPrior + $_SESSION['Transfer']->TransferItem[0]->Quantity) . - ")"; + '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "', + '" . ($QtyOnHandPrior + $_SESSION['Transfer']->TransferItem[0]->Quantity) . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement record was used'); @@ -323,12 +329,11 @@ if ($SerialItemExistsRow[0]==1){ - $SQL = "UPDATE stockserialitems SET - quantity= quantity + " . $Item->BundleQty . " - WHERE - stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' - AND serialno='" . $Item->BundleRef . "'"; + $SQL = "UPDATE stockserialitems + SET quantity= quantity + '" . $Item->BundleQty . "' + WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "' + AND serialno='" . $Item->BundleRef . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be updated because'); $DbgMsg = _('The following SQL to update the serial stock item record was used'); @@ -342,7 +347,7 @@ VALUES ('" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', '" . $_SESSION['Transfer']->StockLocationTo . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be added because'); $DbgMsg = _('The following SQL to insert the serial stock item record was used:'); @@ -356,10 +361,10 @@ stockid, serialno, moveqty) - VALUES (" . $StkMoveNo . ", + VALUES ('" . $StkMoveNo . "', '" . $_SESSION['Transfer']->TransferItem[0]->StockID . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -369,18 +374,18 @@ $SQL = "UPDATE locstock - SET quantity = quantity - " . $_SESSION['Transfer']->TransferItem[0]->Quantity . " - WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; + SET quantity = quantity - '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "' + WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationFrom . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); $DbgMsg = _('The following SQL to update the location stock record was used'); $Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); $SQL = "UPDATE locstock - SET quantity = quantity + " . $_SESSION['Transfer']->TransferItem[0]->Quantity . " - WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' - AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; + SET quantity = quantity + '" . $_SESSION['Transfer']->TransferItem[0]->Quantity . "' + WHERE stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "' + AND loccode='" . $_SESSION['Transfer']->StockLocationTo . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The location stock record could not be updated because'); @@ -408,6 +413,9 @@ $_SESSION['Transfer']->TransferItem[0]->Controlled = ''; } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Dispatch') . + '" alt="">' . ' ' . $title . ''; + echo '<form action="'. $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; //echo '<table> @@ -419,10 +427,20 @@ if (!isset($_GET['Description'])) { $_GET['Description']=''; } -echo '<table><tr><td>'. _('Stock Code'). ':</td><td><input type=text name="StockID" size=21 value="' . $_POST['StockID'] . '" maxlength=20></td></tr><tr><td>'. - _('Partial Description'). ':</td><td><input type=text name="StockText" size=21 value="' . $_GET['Description'] .'">'. - _('Partial Stock Code'). ':<input type=text name="StockCode" size=21 value="' . $_POST['StockID'] . - '" maxlength=20> <input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; +echo '<table class=selection><tr><td>'. _('Stock Code'). ':</td><td>'; +if (isset($_POST['StockID'])) { + echo '<input type=text name="StockID" size=21 value="' . $_POST['StockID'] . '" maxlength=20></td></tr>'; +} else { + echo '<input type=text name="StockID" size=21 value="" maxlength=20></td></tr>'; +} +echo '<tr><td>'. _('Partial Description'). ':</td><td><input type=text name="StockText" size=21 value="' . + $_GET['Description'] .'"></td><td>'._('Partial Stock Code'). ':</td><td>'; +if (isset($_POST['StockID'])) { + echo '<input type=text name="StockCode" size=21 value="' . $_POST['StockID'] .'" maxlength=20>'; +} else { + echo '<input type=text name="StockCode" size=21 value="" maxlength=20>'; +} +echo '</td><td><input type=submit name="CheckCode" VALUE="'._('Check Part').'"></td></tr>'; if (strlen($_SESSION['Transfer']->TransferItem[0]->ItemDescription)>1){ echo '<tr><td colspan=3><font color=BLUE size=3>' . $_SESSION['Transfer']->TransferItem[0]->ItemDescription . ' ('._('In Units of').' ' . $_SESSION['Transfer']->TransferItem[0]->PartUnit . ' )</font></td></tr>'; @@ -435,9 +453,9 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Transfer']->StockLocationFrom)){ if ($myrow['loccode'] == $_SESSION['Transfer']->StockLocationFrom){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; @@ -456,9 +474,9 @@ while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_SESSION['Transfer']->StockLocationTo)){ if ($myrow['loccode'] == $_SESSION['Transfer']->StockLocationTo){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; @@ -478,21 +496,22 @@ } if ($_SESSION['Transfer']->TransferItem[0]->Controlled==1){ - echo '<td class=number><input type=hidden name="Quantity" VALUE=' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '><a href="' . $rootpath .'/StockTransferControlled.php?' . SID . '">' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '</a></td></tr>'; + echo '<td class=number><input type=hidden name="Quantity" value=' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '><a href="' . $rootpath .'/StockTransferControlled.php?' . SID . '">' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '</a></td></tr>'; } else { echo '<td><input type=text class="number" name="Quantity" size=12 maxlength=12 Value=' . $_SESSION['Transfer']->TransferItem[0]->Quantity . '></td></tr>'; } -echo "</table><div class='centre'><br><input type=submit name='EnterTransfer' VALUE='" . _('Enter Stock Transfer') . "'>"; -echo '<hr>'; +echo "</table><div class='centre'><br><input type=submit name='EnterTransfer' VALUE='" . _('Enter Stock Transfer') . "'><br>"; -if (empty($_SESSION['Transfer']->TransferItem[0]->StockID)) { +if (empty($_SESSION['Transfer']->TransferItem[0]->StockID) and isset($_POST['StockID'])) { $StockID=$_POST['StockID']; +} else if (isset($_SESSION['Transfer']->TransferItem[0]->StockID)) { + $StockID=$_SESSION['Transfer']->TransferItem[0]->StockID; } else { - $StockID=$_SESSION['Transfer']->TransferItem[0]->StockID; + $StockID=''; } -echo '<a href="'.$rootpath.'/StockStatus.php?' . SID . '&StockID=' . $StockID . '">'._('Show Stock Status').'</a>'; +echo '<br><a href="'.$rootpath.'/StockStatus.php?' . SID . '&StockID=' . $StockID . '">'._('Show Stock Status').'</a>'; echo '<br><a href="'.$rootpath.'/StockMovements.php?' . SID . '&StockID=' . $StockID . '">'._('Show Movements').'</a>'; echo '<br><a href="'.$rootpath.'/StockUsage.php?' . SID . '&StockID=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Show Stock Usage') . '</a>'; echo '<br><a href="'.$rootpath.'/SelectSalesOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '&StockLocation=' . $_SESSION['Transfer']->StockLocationFrom . '">' . _('Search Outstanding Sales Orders') . '</a>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-10 11:43:37 UTC (rev 3601) +++ trunk/doc/Change.log.html 2010-07-10 21:10:57 UTC (rev 3602) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>09/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> +<p>10/07/10 Tim: StockTransfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> +<p>10/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>09/07/10 Tim: GLTrialBalance.php - Bug fixes, layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTransInquiry.php - Layout improvements changed period number to date and year and sql fixes</p> <p>09/07/10 Tim: GLTags - Layout improvements and sql fixes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-11 16:57:52
|
Revision: 3603 http://web-erp.svn.sourceforge.net/web-erp/?rev=3603&view=rev Author: tim_schofield Date: 2010-07-11 16:57:46 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Fix typo in variable declaration Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/DefineCartClass.php Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-10 21:10:57 UTC (rev 3602) +++ trunk/doc/Change.log.html 2010-07-11 16:57:46 UTC (rev 3603) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: DefineCartClass.php - Fix typo in variable declaration</p> <p>10/07/10 Tim: StockTransfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>10/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>09/07/10 Tim: GLTrialBalance.php - Bug fixes, layout improvements changed period number to date and year and sql fixes</p> Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2010-07-10 21:10:57 UTC (rev 3602) +++ trunk/includes/DefineCartClass.php 2010-07-11 16:57:46 UTC (rev 3603) @@ -63,7 +63,7 @@ $this->total=0; $this->ItemsOrdered=0; $this->LineCounter=0; - $this->DefaltSalesType=""; + $this->DefaultSalesType=""; $this->FreightCost =0; $this->FreightTaxes = array(); } @@ -97,7 +97,7 @@ $ExRate=1){ if (isset($StockID) AND $StockID!="" AND $Qty>0 AND isset($Qty)){ - + if ($Price<0){ /*madness check - use a credit note to give money away!*/ $Price=0; } @@ -170,13 +170,13 @@ Return 0; } - function update_cart_item( $UpdateLineNumber, - $Qty, - $Price, - $Disc, - $Narrative, - $UpdateDB='No', - $ItemDue, + function update_cart_item( $UpdateLineNumber, + $Qty, + $Price, + $Disc, + $Narrative, + $UpdateDB='No', + $ItemDue, $POLine, $GPPercent){ @@ -489,7 +489,7 @@ $this->StandardCost = $StandardCost; $this->EOQ = $EOQ; $this->NextSerialNo = $NextSerialNo; - + if ($Prc > 0){ $this->GPPercent = ((($Prc * (1 - $DiscPercent)) - ($StandardCost * $ExRate))*100)/$Prc; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-11 16:58:26
|
Revision: 3604 http://web-erp.svn.sourceforge.net/web-erp/?rev=3604&view=rev Author: tim_schofield Date: 2010-07-11 16:58:19 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Fix conversion factor bug, layout changes, sql quoting fixed Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Header.php trunk/PO_Items.php trunk/doc/Change.log.html trunk/includes/DefinePOClass.php trunk/includes/PO_ReadInOrder.inc Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/GoodsReceived.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -29,7 +29,7 @@ } elseif (isset($_GET['PONumber']) AND !isset($_POST['Update'])) { /*Update only occurs if the user hits the button to refresh the data and recalc the value of goods recd*/ - $_GET['ModifyOrderNumber'] = $_GET['PONumber']; + $_GET['ModifyOrderNumber'] = (int)$_GET['PONumber']; include('includes/PO_ReadInOrder.inc'); } elseif (isset($_POST['Update']) OR isset($_POST['ProcessGoodsReceived'])) { @@ -45,7 +45,7 @@ } } -$statussql='SELECT status FROM purchorders WHERE orderno='.$_SESSION['PO']->OrderNo; +$statussql="SELECT status FROM purchorders WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $statusresult=DB_query($statussql, $db); $mystatusrow=DB_fetch_array($statusresult); $Status=$mystatusrow['status']; @@ -60,31 +60,44 @@ /* Always display quantities received and recalc balance for all items on the order */ -echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Receive') . '" alt="">' . ' ' . _('Receive Purchase Order') . ''; +echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Receive') . '" alt="">' . ' ' . _('Receive Purchase Order') . ''; -echo ' : '. $_SESSION['PO']->OrderNo .' '. _('from'). ' ' . $_SESSION['PO']->SupplierName . ' </U></b></font></div><br>'; +echo ' : '. $_SESSION['PO']->OrderNo .' '. _('from'). ' ' . $_SESSION['PO']->SupplierName . ' </u></b></font></div>'; echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post>'; -echo '<table cellpadding=2 colspan=7 border=0> -<tr><th>' . _('Item Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '<br>' . _('Ordered') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('Already Received') . '</th> - <th>' . _('This Delivery') . '<br>' . _('Quantity') . '</th>'; +if (!isset($_POST['ProcessGoodsReceived'])) { + if (!isset($_POST['DefaultReceivedDate'])){ + $_POST['DefaultReceivedDate'] = Date($_SESSION['DefaultDateFormat']); + } -if ($_SESSION['ShowValueOnGRN']==1) { - echo '<th>' . _('Price') . '</th><th>' . _('Total Value') . '<br>' . _('Received') . '</th>'; + echo '<table class=selection><tr><td>'. _('Date Goods/Service Received'). ':</td><td><input type=text class=date alt="'. + $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". + $_SESSION['DefaultDateFormat']."'".')" name=DefaultReceivedDate value="' . $_POST['DefaultReceivedDate'] . + '"></td></tr></table><br>'; + + echo '<table cellpadding=2 class=selection> + <tr><th>' . _('Item Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '<br>' . _('Ordered') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Already Received') . '</th> + <th>' . _('This Delivery') . '<br>' . _('Quantity') . '</th>'; + + if ($_SESSION['ShowValueOnGRN']==1) { + echo '<th>' . _('Price') . '</th><th>' . _('Total Value') . '<br>' . _('Received') . '</th>'; + } + + echo '<td> </td> + </tr>'; + /*show the line items on the order with the quantity being received for modification */ + + $_SESSION['PO']->total = 0; } -echo '<td> </td> - </tr>'; -/*show the line items on the order with the quantity being received for modification */ - -$_SESSION['PO']->total = 0; $k=0; //row colour counter -if (count($_SESSION['PO']->LineItems)>0){ +if (count($_SESSION['PO']->LineItems)>0 and !isset($_POST['ProcessGoodsReceived'])){ foreach ($_SESSION['PO']->LineItems as $LnItm) { if ($k==1){ @@ -112,16 +125,16 @@ $DisplayLineTotal = number_format($LineTotal,2); $DisplayPrice = number_format($LnItm->Price,2); - $uomsql='SELECT unitsofmeasure.unitname, + $uomsql="SELECT unitsofmeasure.unitname, conversionfactor, suppliersuom, max(effectivefrom) FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$_SESSION['PO']->SupplierID.'" - AND stockid="'.$LnItm->StockID.'" - GROUP BY unitsofmeasure.unitname'; + WHERE supplierno='".$_SESSION['PO']->SupplierID."' + AND stockid='".$LnItm->StockID."' + GROUP BY unitsofmeasure.unitname"; $uomresult=DB_query($uomsql, $db); if (DB_num_rows($uomresult)>0) { @@ -138,12 +151,12 @@ } //Now Display LineItem - echo '<td><font size=2>' . $LnItm->StockID . '</font></td>'; - echo '<td><font size=2>' . $LnItm->ItemDescription . '</td>'; - echo '<td class=number><font size=2>' . $DisplayQtyOrd . '</td>'; - echo '<td><font size=2>' . $LnItm->uom . '</td>'; - echo '<td class=number><font size=2>' . $DisplayQtyRec . '</td>'; - echo '<td class=number><font size=2>'; + echo '<td>' . $LnItm->StockID . '</td>'; + echo '<td>' . $LnItm->ItemDescription . '</td>'; + echo '<td class=number>' . $DisplayQtyOrd . '</td>'; + echo '<td>' . $LnItm->uom . '</td>'; + echo '<td class=number>' . $DisplayQtyRec . '</td>'; + echo '<td class=number>'; if ($LnItm->Controlled == 1) { @@ -154,8 +167,8 @@ } if ($_SESSION['ShowValueOnGRN']==1) { - echo '<td class=number><font size=2>' . $DisplayPrice . '</td>'; - echo '<td class=number><font size=2>' . $DisplayLineTotal . '</font></td>'; + echo '<td class=number>' . $DisplayPrice . '</td>'; + echo '<td class=number>' . $DisplayLineTotal . '</td>'; } @@ -171,17 +184,17 @@ echo '</tr>'; }//foreach(LineItem) echo "<script>defaultControl(document.forms[0].RecvQty_$LnItm->LineNo);</script>"; -}//If count(LineItems) > 0 - $DisplayTotal = number_format($_SESSION['PO']->total,2); if ($_SESSION['ShowValueOnGRN']==1) { echo '<tr><td colspan=7 class=number><b>' . _('Total value of goods received'). '</b></td> - <td class=number><font size=2><b>'. $DisplayTotal. '</b></font></td> + <td class=number><b>'. $DisplayTotal. '</b></td> </tr></table>'; } else { echo '</table>'; } +}//If count(LineItems) > 0 + $SomethingReceived = 0; if (count($_SESSION['PO']->LineItems)>0){ foreach ($_SESSION['PO']->LineItems as $OrderLine) { @@ -257,7 +270,7 @@ /*Now need to check that the order details are the same as they were when they were read into the Items array. If they've changed then someone else must have altered them */ // Otherwise if you try to fullfill item quantities separately will give error. - $SQL = 'SELECT itemcode, + $SQL = "SELECT itemcode, glcode, quantityord, quantityrecd, @@ -265,9 +278,9 @@ shiptref, jobref FROM purchorderdetails - WHERE orderno=' . (int) $_SESSION['PO']->OrderNo . ' + WHERE orderno='" . (int) $_SESSION['PO']->OrderNo . "' AND completed=0 - ORDER BY podetailitem'; + ORDER BY podetailitem"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('Could not check that the details of the purchase order had not been changed by another user because'). ':'; $DbgMsg = _('The following SQL to retrieve the purchase order details was used'); @@ -382,16 +395,16 @@ if ($OrderLine->ReceiveQty >= ($OrderLine->Quantity - $OrderLine->QtyReceived)){ $SQL = "UPDATE purchorderdetails SET - quantityrecd = quantityrecd + " . $OrderLine->ReceiveQty . ", - stdcostunit=" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", + quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', + stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=1 - WHERE podetailitem = " . $OrderLine->PODetailRec; + WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } else { $SQL = "UPDATE purchorderdetails SET - quantityrecd = quantityrecd + " . $OrderLine->ReceiveQty . ", - stdcostunit=" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", + quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', + stdcostunit='" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', completed=0 - WHERE podetailitem = " . $OrderLine->PODetailRec; + WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase order detail record could not be updated with the quantity received because'); @@ -415,14 +428,14 @@ qtyrecd, supplierid, stdcostunit) - VALUES (" . $GRN . ", - " . $OrderLine->PODetailRec . ", + VALUES ('" . $GRN . "', + '" . $OrderLine->PODetailRec . "', '" . $OrderLine->StockID . "', '" . $OrderLine->ItemDescription . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $OrderLine->ReceiveQty . ", + '" . $OrderLine->ReceiveQty . "', '" . $_SESSION['PO']->SupplierID . "', - " . $CurrentStandardCost *$conversionfactor. ')'; + '" . $CurrentStandardCost *$OrderLine->ConversionFactor. "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('A GRN record could not be inserted') . '. ' . _('This receipt of goods has not been processed because'); $DbgMsg = _('The following SQL to insert the GRN record was used'); @@ -447,10 +460,10 @@ $QtyOnHandPrior = 0; } - $sql='SELECT conversionfactor + $sql="SELECT conversionfactor FROM purchdata - WHERE supplierno="'.$_SESSION['PO']->SupplierID.'" - AND stockid="'.$OrderLine->StockID.'"'; + WHERE supplierno='".$_SESSION['PO']->SupplierID."' + AND stockid='".$OrderLine->StockID."'"; $result=DB_query($sql, $db); if (DB_num_rows($result)>0) { $myrow=DB_fetch_array($result); @@ -461,7 +474,7 @@ $OrderLine->ReceiveQty=$OrderLine->ReceiveQty*$conversionfactor; $SQL = "UPDATE locstock - SET quantity = locstock.quantity + " . $OrderLine->ReceiveQty . " + SET quantity = locstock.quantity + '" . $OrderLine->ReceiveQty . "' WHERE locstock.stockid = '" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['PO']->Location . "'"; @@ -483,16 +496,19 @@ qty, standardcost, newqoh) - VALUES ('" . $OrderLine->StockID . "', + VALUES ( + '" . $OrderLine->StockID . "', 25, - " . $GRN . ", '" . $_SESSION['PO']->Location . "', + '" . $GRN . "', + '" . $_SESSION['PO']->Location . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $LocalCurrencyPrice / $conversionfactor . ", - " . $PeriodNo . ", + '" . $LocalCurrencyPrice / $conversionfactor . "', + '" . $PeriodNo . "', '" . $_SESSION['PO']->SupplierID . " (" . $_SESSION['PO']->SupplierName . ") - " .$_SESSION['PO']->OrderNo . "', - " . $OrderLine->ReceiveQty . ", - " . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . ", - " . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . ")"; + '" . $OrderLine->ReceiveQty . "', + '" . $_SESSION['PO']->LineItems[$OrderLine->LineNo]->StandardCost . "', + '" . ($QtyOnHandPrior + $OrderLine->ReceiveQty) . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('stock movement records could not be inserted because'); $DbgMsg = _('The following SQL to insert the stock movement records was used'); @@ -519,9 +535,9 @@ if (trim($Item->BundleRef) != ""){ if ($AlreadyExistsRow[0]>0){ if ($OrderLine->Serialised == 1) { - $SQL = 'UPDATE stockserialitems SET quantity = ' . $Item->BundleQty . ' '; + $SQL = "UPDATE stockserialitems SET quantity = '" . $Item->BundleQty . " "; } else { - $SQL = 'UPDATE stockserialitems SET quantity = quantity + ' . $Item->BundleQty . ' '; + $SQL = "UPDATE stockserialitems SET quantity = quantity + '" . $Item->BundleQty . " "; } $SQL .= "WHERE stockid='" . $OrderLine->StockID . "' AND loccode = '" . $_SESSION['PO']->Location . "' @@ -536,7 +552,7 @@ '" . $_SESSION['PO']->Location . "', '" . $Item->BundleRef . "', '', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); @@ -544,21 +560,24 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); /*Update fixed asset details */ - $sql='select stocktype from stockcategory - left join stockmaster on - stockcategory.categoryid=stockmaster.categoryid - where stockmaster.stockid="'.$OrderLine->StockID.'"'; + $sql="SELECT stocktype + FROM stockcategory + LEFT JOIN stockmaster + ON stockcategory.categoryid=stockmaster.categoryid + WHERE stockmaster.stockid='".$OrderLine->StockID."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow['stocktype']=='A') { $SQL = "INSERT INTO assetmanager - VALUES (NULL, + VALUES ( + NULL, '" . $OrderLine->StockID . "', '" . $Item->BundleRef . "', '', - ".$Item->BundleQty*$OrderLine->Price.", - 0,'". - $_POST['DefaultReceivedDate']."',0)"; + '".$Item->BundleQty*$OrderLine->Price."', + 0, + '". $_POST['DefaultReceivedDate']."', + 0)"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock item records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -571,10 +590,12 @@ stockid, serialno, moveqty) - VALUES (" . $StkMoveNo . ", + VALUES ( + '" . $StkMoveNo . "', '" . $OrderLine->StockID . "', '" . $Item->BundleRef . "', - " . $Item->BundleQty . ")"; + '" . $Item->BundleQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -595,13 +616,17 @@ account, narrative, amount) - VALUES (25, - " . $GRN . ", + VALUES ( + 25, + '" . $GRN . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $PeriodNo . ", - " . $OrderLine->GLCode . ", - 'PO: " . $_SESSION['PO']->OrderNo . " " . $_SESSION['PO']->SupplierID . " - " . $OrderLine->StockID . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . number_format($CurrentStandardCost,2) . "', - " . $CurrentStandardCost * $OrderLine->ReceiveQty . ")"; + '" . $PeriodNo . "', + '" . $OrderLine->GLCode . "', + 'PO: " . $_SESSION['PO']->OrderNo . " " . $_SESSION['PO']->SupplierID . " - " . $OrderLine->StockID + . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + number_format($CurrentStandardCost,2) . "', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -619,12 +644,15 @@ narrative, amount) VALUES (25, - " . $GRN . ", + '" . $GRN . "', '" . $_POST['DefaultReceivedDate'] . "', - " . $PeriodNo . ", - " . $_SESSION['CompanyRecord']['grnact'] . ", '" . - _('PO') . ': ' . $_SESSION['PO']->OrderNo . ' ' . $_SESSION['PO']->SupplierID . ' - ' . $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', - " . -$UnitCost * $OrderLine->ReceiveQty . ")"; + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['grnact'] . "', + '" . _('PO') . ': ' . $_SESSION['PO']->OrderNo . ' ' . $_SESSION['PO']->SupplierID . ' - ' . + $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . + $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', + '" . -$UnitCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GRN Suspense GLTrans record was used'); @@ -633,16 +661,18 @@ } /* end of if GL and stock integrated and standard cost !=0 */ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - $completedsql='SELECT SUM(completed) as completedlines, + $completedsql="SELECT SUM(completed) as completedlines, COUNT(podetailitem) as alllines FROM purchorderdetails - WHERE orderno='.$_SESSION['PO']->OrderNo; + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $completedresult=DB_query($completedsql,$db); $mycompletedrow=DB_fetch_array($completedresult); $status=$mycompletedrow['alllines']-$mycompletedrow['completedlines']; if ($status==0) { - $sql='SELECT stat_comment FROM purchorders WHERE orderno='.$_SESSION['PO']->OrderNo; + $sql="SELECT stat_comment + FROM purchorders + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $result=DB_query($sql,$db); $myrow=DB_fetch_array($result); $comment=$myrow['stat_comment']; @@ -651,7 +681,7 @@ $sql="UPDATE purchorders SET status='" . PurchOrder::STATUS_COMPLITED . "', stat_comment='".$StatusComment."' - WHERE orderno=".$_SESSION['PO']->OrderNo; + WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; $result=DB_query($sql,$db); } @@ -662,27 +692,23 @@ unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); - echo '<br>'. _('GRN number'). ' '. $GRN .' '. _('has been processed').'<br>'; + echo '<br><div class=centre>'. _('GRN number'). ' '. $GRN .' '. _('has been processed').'<br>'; echo '<br><a href=PDFGrn.php?GRNNo='.$GRN .'&PONo='.$PONo.'>'. _('Print this Goods Received Note (GRN)').'</a><br><br>'; - echo "<a href='$rootpath/PO_SelectOSPurchOrder.php?" . SID . "'>" . _('Select a different purchase order for receiving goods against'). '</a>'; + echo "<a href='" . $rootpath . "/PO_SelectOSPurchOrder.php?" . SID . "'>" . + _('Select a different purchase order for receiving goods against'). '</a></div>'; /*end of process goods received entry */ include('includes/footer.inc'); exit; } else { /*Process Goods received not set so show a link to allow mod of line items on order and allow input of date goods received*/ - echo "<br><div class='centre'><a href='$rootpath/PO_Items.php?=" . SID . "'>" . _('Modify Order Items'). '</a></div>'; + echo "<br><div class='centre'><a href='" . $rootpath . "/PO_Items.php?=" . SID . "'>" . _('Modify Order Items'). '</a></div>'; - if (!isset($_POST['DefaultReceivedDate'])){ - $_POST['DefaultReceivedDate'] = Date($_SESSION['DefaultDateFormat']); - } - echo '<table><tr><td>'. _('Date Goods/Service Received'). ':</td><td><input type=text class=date alt="'.$_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" name=DefaultReceivedDate value="' . $_POST['DefaultReceivedDate'] . '"></td></tr>'; - - echo '</table><br><div class="centre"><input type=submit name=Update Value=' . _('Update') . '><p>'; + echo '<br><div class="centre"><input type=submit name=Update Value=' . _('Update') . '><p>'; echo '<input type=submit name="ProcessGoodsReceived" Value="' . _('Process Goods Received') . '"></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/PO_Header.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -385,7 +385,7 @@ if (strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - + $SQL = "SELECT suppliers.supplierid, suppliers.suppname, suppliers.address1, @@ -724,13 +724,16 @@ $sql='SELECT price, suppliersuom, - suppliers_partno + suppliers_partno, + conversionfactor FROM purchdata WHERE supplierno="'.$_GET['SelectedSupplier'] .'" AND stockid="'.$purch_item.'" '; $result=DB_query($sql, $db); $purchdatarow=DB_fetch_array($result); - + if (!isset($purchdatarow['conversionfactor'])) { + $purchdatarow['conversionfactor']=1; + } $sql='SELECT stockact FROM stockcategory @@ -759,6 +762,7 @@ $stockmasterrow['decimalplaces'], $purch_item, $purchdatarow['suppliersuom'], + $purchdatarow['conversionfactor'], $purchdatarow['suppliers_partno'], $Qty*$purchdatarow['price'], '', Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/PO_Items.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -696,6 +696,7 @@ $_POST['itemno'], $_POST['uom'], $_POST['suppliers_partno'], + 1, $_POST['subtotal_amount'], $_POST['package'], $_POST['pcunit'], @@ -814,6 +815,7 @@ $myrow['decimalplaces'], $ItemCode, $myrow['unitname'], + $myrow['conversionfactor'], $myrow['suppliers_partno'], $Quantity*$myrow['price'], $myrow['leadtime'], @@ -846,6 +848,7 @@ 0, $ItemCode, $myrow['units'], + 1, '', 0, 0, Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/doc/Change.log.html 2010-07-11 16:58:19 UTC (rev 3604) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: Goods Receiving - Fix conversion factor bug, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: DefineCartClass.php - Fix typo in variable declaration</p> <p>10/07/10 Tim: StockTransfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> <p>10/07/10 Tim: Bulk Transfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/includes/DefinePOClass.php 2010-07-11 16:58:19 UTC (rev 3604) @@ -96,6 +96,7 @@ $DecimalPlaces=2, $itemno, $uom, + $ConversionFactor, $leadtime, $suppliers_partno, $subtotal_amount, @@ -128,6 +129,7 @@ $DecimalPlaces, $itemno, $uom, + $ConversionFactor, $leadtime, $suppliers_partno, $subtotal_amount, @@ -155,6 +157,7 @@ $JobRef , $itemno, $uom, + $ConversionFactor, $suppliers_partno, $subtotal_amount, $package, @@ -175,6 +178,7 @@ $this->LineItems[$LineNo]->JobRef = $JobRef; $this->LineItems[$LineNo]->itemno = $itemno; $this->LineItems[$LineNo]->uom = $uom; + $this->LineItems[$LineNo]->ConversionFactor = $ConversionFactor; $this->LineItems[$LineNo]->suppliers_partno = $suppliers_partno; $this->LineItems[$LineNo]->subtotal_amount = $subtotal_amount; $this->LineItems[$LineNo]->package = $package; @@ -244,6 +248,7 @@ Var $JobRef; Var $itemno; Var $uom; + var $ConversionFactor; Var $suppliers_partno; Var $subtotal_amount; Var $leadtime; @@ -280,6 +285,7 @@ $DecimalPlaces, $itemno, $uom, + $ConversionFactor, $suppliers_partno, $subtotal_amount, $leadtime, @@ -309,6 +315,7 @@ $this->JobRef = $JobRef; $this->itemno = $itemno; $this->uom = $uom; + $this->ConversionFactor = $ConversionFactor; $this->suppliers_partno = $suppliers_partno; $this->subtotal_amount = $subtotal_amount; $this->leadtime = $leadtime; Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2010-07-11 16:57:46 UTC (rev 3603) +++ trunk/includes/PO_ReadInOrder.inc 2010-07-11 16:58:19 UTC (rev 3604) @@ -196,7 +196,8 @@ $date=DB_fetch_row($dateresult); if ($date[0]!='') { $sql='SELECT unitsofmeasure.unitname, - suppliers_partno + suppliers_partno, + conversionfactor FROM purchdata LEFT JOIN unitsofmeasure ON purchdata.suppliersuom=unitsofmeasure.unitid @@ -209,6 +210,7 @@ $sql='SELECT units as unitname, stockid as suppliers_partno FROM stockmaster WHERE stockid="'.$StockID.'"'; $purchdataresult=DB_query($sql, $db); $myrow2=DB_fetch_array($purchdataresult); + $myrow2['conversionfactor']=1; } $_SESSION['PO'.$identifier]->add_to_order($_SESSION['PO'.$identifier]->LinesOnOrder+1, @@ -230,6 +232,7 @@ $myrow['decimalplaces'], $myrow['itemno'], $myrow2['unitname'], + $myrow2['conversionfactor'], $myrow2['suppliers_partno'], $myrow['subtotal_amount'], 0, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-07-11 20:59:16
|
Revision: 3605 http://web-erp.svn.sourceforge.net/web-erp/?rev=3605&view=rev Author: tim_schofield Date: 2010-07-11 20:59:10 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Layout changes, sql quoting fixed Modified Paths: -------------- trunk/InventoryPlanning.php trunk/doc/Change.log.html trunk/includes/PDFInventoryPlanPageHeader.inc Modified: trunk/InventoryPlanning.php =================================================================== --- trunk/InventoryPlanning.php 2010-07-11 16:58:19 UTC (rev 3604) +++ trunk/InventoryPlanning.php 2010-07-11 20:59:10 UTC (rev 3605) @@ -144,23 +144,23 @@ if ($_POST['Location']=='All'){ - $SQL = "SELECT SUM(CASE WHEN prd=" . $CurrentPeriod . " THEN -qty ELSE 0 END) AS prd0, - SUM(CASE WHEN prd=" . $Period_1 . " THEN -qty ELSE 0 END) AS prd1, - SUM(CASE WHEN prd=" . $Period_2 . " THEN -qty ELSE 0 END) AS prd2, - SUM(CASE WHEN prd=" . $Period_3 . " THEN -qty ELSE 0 END) AS prd3, - SUM(CASE WHEN prd=" . $Period_4 . " THEN -qty ELSE 0 END) AS prd4, - SUM(CASE WHEN prd=" . $Period_5 . " THEN -qty ELSE 0 END) AS prd5 + $SQL = "SELECT SUM(CASE WHEN prd='" . $CurrentPeriod . "' THEN -qty ELSE 0 END) AS prd0, + SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1, + SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2, + SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3, + SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4, + SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5 FROM stockmoves WHERE stockid='" . $InventoryPlan['stockid'] . "' AND (type=10 OR type=11) AND stockmoves.hidemovt=0"; } else { - $SQL = "SELECT SUM(CASE WHEN prd=" . $CurrentPeriod . " THEN -qty ELSE 0 END) AS prd0, - SUM(CASE WHEN prd=" . $Period_1 . " THEN -qty ELSE 0 END) AS prd1, - SUM(CASE WHEN prd=" . $Period_2 . " THEN -qty ELSE 0 END) AS prd2, - SUM(CASE WHEN prd=" . $Period_3 . " THEN -qty ELSE 0 END) AS prd3, - SUM(CASE WHEN prd=" . $Period_4 . " THEN -qty ELSE 0 END) AS prd4, - SUM(CASE WHEN prd=" . $Period_5 . " THEN -qty ELSE 0 END) AS prd5 + $SQL = "SELECT SUM(CASE WHEN prd='" . $CurrentPeriod . "' THEN -qty ELSE 0 END) AS prd0, + SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1, + SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2, + SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3, + SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4, + SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5 FROM stockmoves WHERE stockid='" . $InventoryPlan['stockid'] . "' AND stockmoves.loccode ='" . $_POST['Location'] . "' @@ -362,12 +362,13 @@ $title=_('Inventory Planning Reporting'); include('includes/header.inc'); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Search') . '" alt="">' . ' ' . $title.'<br>'; - if (strlen($_POST['FromCriteria'])<1 || strlen($_POST['ToCriteria'])<1) { + if (empty($_POST['FromCriteria']) or empty($_POST['ToCriteria'])) { /*if $FromCriteria is not set then show a form to allow input */ - echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table>"; + echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table class=selection>"; echo '<tr> <td>' . _('From Inventory Category Code') . ':</font></td> @@ -428,10 +429,10 @@ </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-11 16:58:19 UTC (rev 3604) +++ trunk/doc/Change.log.html 2010-07-11 20:59:10 UTC (rev 3605) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/07/10 Tim: InventoryPlanning.php - Layout changes, sql quoting fixed</p> <p>11/07/10 Tim: Goods Receiving - Fix conversion factor bug, layout changes, sql quoting fixed</p> <p>11/07/10 Tim: DefineCartClass.php - Fix typo in variable declaration</p> <p>10/07/10 Tim: StockTransfers - Bug fixes, correctly round the decimal places, fix sql quoting errors and layout changes</p> Modified: trunk/includes/PDFInventoryPlanPageHeader.inc =================================================================== --- trunk/includes/PDFInventoryPlanPageHeader.inc 2010-07-11 16:58:19 UTC (rev 3604) +++ trunk/includes/PDFInventoryPlanPageHeader.inc 2010-07-11 20:59:10 UTC (rev 3605) @@ -16,7 +16,7 @@ $FontSize=10; -if ($_POST['SupplierID']=="0"){ //no supplier selected its a stock category report +if (isset($_POST['SupplierID']) and $_POST['SupplierID']=="0"){ //no supplier selected its a stock category report $ReportTitle = _('Inventory Planning for Categories Between') . ' ' . $_POST['FromCriteria'] . ' ' . _('and') . ' ' . $_POST['ToCriteria']; } else { //supplier selected its just planning for products from the supplier $ReportTitle = _('Inventory Planning for Products Category') . ' ' . $_POST['FromCriteria']; @@ -57,12 +57,12 @@ $LeftOvers = $pdf->addTextWrap(471,$YPos,40,$FontSize,$Period_0_Name . ' ' . _('MTD'),'centre'); $stat=$_POST['NumberMonthsHolding']; - if ($_POST['NumberMonthsHolding']>10){ + if ($_POST['NumberMonthsHolding']>10){ $NumberMonthsHolding=$_POST['NumberMonthsHolding']-10; } - else{ - $NumberMonthsHolding=$_POST['NumberMonthsHolding']; - + else{ + $NumberMonthsHolding=$_POST['NumberMonthsHolding']; + } $LeftOvers = $pdf->addTextWrap(512,$YPos,40,$FontSize,$NumberMonthsHolding . ' ' . _('ms stk'),'centre'); $LeftOvers = $pdf->addTextWrap(617,$YPos,40,$FontSize,_('QOH'),'centre'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |