From: <tim...@us...> - 2010-09-10 10:12:00
|
Revision: 3723 http://web-erp.svn.sourceforge.net/web-erp/?rev=3723&view=rev Author: tim_schofield Date: 2010-09-10 10:11:54 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Layout improvements Modified Paths: -------------- trunk/PeriodsInquiry.php trunk/doc/Change.log.html Modified: trunk/PeriodsInquiry.php =================================================================== --- trunk/PeriodsInquiry.php 2010-09-08 21:41:50 UTC (rev 3722) +++ trunk/PeriodsInquiry.php 2010-09-10 10:11:54 UTC (rev 3723) @@ -19,39 +19,61 @@ $ErrMsg = _('No periods were returned by the SQL because'); $PeriodsResult = DB_query($SQL,$db,$ErrMsg); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' + . $title . '</p>'; /*show a table of the orders returned by the SQL */ -echo '<table cellpadding=2 colspan=2>'; +$NumberOfPeriods = DB_num_rows($PeriodsResult); +$PeriodsInTable = round($NumberOfPeriods/3,0); $TableHeader = '<tr><th>' . _('Period Number') . '</th> <th>' . _('Date of Last Day') . '</th> </tr>'; - +echo '<table><tr>'; +for ($i=0;$i<2;$i++) { + echo '<td>'; + echo '<table cellpadding=2 colspan=2 class=selection>'; + echo $TableHeader; + $k=0; + for ($j=0; $j<$PeriodsInTable;$j++) { + $myrow=DB_fetch_array($PeriodsResult); + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); + echo "<td>".$myrow['periodno']."</td> + <td>".$FormatedLastDate."</td> + </tr>"; + } + echo '</table>'; + echo '</td>'; +} +echo '<td>'; +echo '<table cellpadding=2 colspan=2 class=selection>'; echo $TableHeader; - -$j = 1; -$k=0; //row colour counter +$k = 0; //row colour counter while ($myrow=DB_fetch_array($PeriodsResult)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k++; - } - - $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); - printf("<td><font size=2>%s</td> - <td>%s</td> - </tr>", - $myrow['periodno'], - $FormatedLastDate); - + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); + echo "<td>".$myrow['periodno']."</td> + <td>".$FormatedLastDate."</td> + </tr>"; } +echo '</table>'; +echo '</td>'; +echo '</tr></table>'; //end of while loop -echo '</table>'; - include('includes/footer.inc'); ?> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-08 21:41:50 UTC (rev 3722) +++ trunk/doc/Change.log.html 2010-09-10 10:11:54 UTC (rev 3723) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/09/10 Tim: PeriodsInquiry.php - Layout improvements</p> <p>08/09/10 Tim: PDFTopItems.php - Correct the sql quoting</p> <p>08/09/10 Tim: PDFSuppTransListing.php - Screen layout improvements. Correct the sql quoting</p> <p>08/09/10 Tim: PDFStockTransfer.php - Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-10 10:21:31
|
Revision: 3724 http://web-erp.svn.sourceforge.net/web-erp/?rev=3724&view=rev Author: tim_schofield Date: 2010-09-10 10:21:24 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Layout improvements, and sql quoting corrections Modified Paths: -------------- trunk/PO_AuthorisationLevels.php trunk/doc/Change.log.html Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2010-09-10 10:11:54 UTC (rev 3723) +++ trunk/PO_AuthorisationLevels.php 2010-09-10 10:21:24 UTC (rev 3724) @@ -29,25 +29,25 @@ if ($_POST['authlevel']=='') { $_POST['authlevel']=0; } - $sql='SELECT COUNT(*) + $sql="SELECT COUNT(*) FROM purchorderauth - WHERE userid="'.$_POST['userid'].'" - AND currabrev="'.$_POST['currabrev'].'"'; + WHERE userid='".$_POST['userid']."' + AND currabrev='".$_POST['currabrev']."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { - $sql='INSERT INTO purchorderauth ( + $sql="INSERT INTO purchorderauth ( userid, currabrev, cancreate, offhold, authlevel) VALUES( - "'.$_POST['userid'].'", - "'.$_POST['currabrev'].'", - '.$cancreate.', - '.$offhold.', - '.$_POST['authlevel'].')'; + '".$_POST['userid']."', + '".$_POST['currabrev']."', + '".$cancreate."', + '".$offhold."', + '".$_POST['authlevel']."')"; $ErrMsg = _('The authentication details cannot be inserted because'); $Result=DB_query($sql,$db,$ErrMsg); } else { @@ -67,33 +67,33 @@ } else { $offhold=1; } - $sql='UPDATE purchorderauth SET - cancreate='.$cancreate.', - offhold='.$offhold.', - authlevel='.$_POST['authlevel'].' - WHERE userid="'.$_POST['userid'].'" - AND currabrev="'.$_POST['currabrev'].'"'; + $sql="UPDATE purchorderauth SET + cancreate='".$cancreate."', + offhold='".$offhold."', + authlevel='".$_POST['authlevel']."' + WHERE userid='".$_POST['userid']."' + AND currabrev='".$_POST['currabrev']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } if (isset($_GET['Delete'])) { - $sql='DELETE FROM purchorderauth - WHERE userid="'.$_GET['UserID'].'" - AND currabrev="'.$_GET['Currency'].'"'; + $sql="DELETE FROM purchorderauth + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be deleted because'); $Result=DB_query($sql,$db,$ErrMsg); } if (isset($_GET['Edit'])) { - $sql='SELECT cancreate, + $sql="SELECT cancreate, offhold, authlevel FROM purchorderauth - WHERE userid="'.$_GET['UserID'].'" - AND currabrev="'.$_GET['Currency'].'"'; + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); $result=DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); @@ -104,7 +104,7 @@ $AuthLevel=$myrow['authlevel']; } -$sql='SELECT +$sql="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, @@ -114,12 +114,12 @@ purchorderauth.authlevel FROM (purchorderauth LEFT JOIN www_users ON purchorderauth.userid=www_users.userid) - LEFT JOIN currencies ON purchorderauth.currabrev=currencies.currabrev'; + LEFT JOIN currencies ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); -echo '<table><tr>'; +echo '<table class=selection><tr>'; echo '<th>'._('User ID').'</th>'; echo '<th>'._('User Name').'</th>'; echo '<th>'._('Currency').'</th>'; @@ -153,7 +153,7 @@ echo '</table><br><br>'; echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method=post name='form1'>"; -echo '<table>'; +echo '<table class=selection>'; if (isset($_GET['Edit'])) { echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-10 10:11:54 UTC (rev 3723) +++ trunk/doc/Change.log.html 2010-09-10 10:21:24 UTC (rev 3724) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PeriodsInquiry.php - Layout improvements</p> <p>08/09/10 Tim: PDFTopItems.php - Correct the sql quoting</p> <p>08/09/10 Tim: PDFSuppTransListing.php - Screen layout improvements. Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-10 10:38:25
|
Revision: 3725 http://web-erp.svn.sourceforge.net/web-erp/?rev=3725&view=rev Author: tim_schofield Date: 2010-09-10 10:38:19 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Layout improvements, and sql quoting corrections Modified Paths: -------------- trunk/PO_AuthoriseMyOrders.php trunk/doc/Change.log.html Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2010-09-10 10:21:24 UTC (rev 3724) +++ trunk/PO_AuthoriseMyOrders.php 2010-09-10 10:38:19 UTC (rev 3725) @@ -11,7 +11,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' . $title . '</p>'; -$emailsql='SELECT email FROM www_users WHERE userid="'.$_SESSION['UserID'].'"'; +$emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; $emailresult=DB_query($emailsql, $db); $emailrow=DB_fetch_array($emailresult); @@ -26,7 +26,7 @@ SET status='".$status."', stat_comment='".$comment."', allowprint=1 - WHERE orderno=".$orderno; + WHERE orderno='".$orderno."'"; $result=DB_query($sql, $db); } } @@ -34,7 +34,7 @@ /* Retrieve the purchase order header information */ -$sql='SELECT purchorders.*, +$sql="SELECT purchorders.*, suppliers.suppname, suppliers.currcode, www_users.realname, @@ -44,11 +44,11 @@ ON suppliers.supplierid=purchorders.supplierno LEFT JOIN www_users ON www_users.userid=purchorders.initiator - WHERE status="'. _('Pending'). '"'; + WHERE status='Pending'"; $result=DB_query($sql, $db); echo '<form method=post action="' . $_SERVER['PHP_SELF'] . '">'; -echo '<table><tr>'; +echo '<table class=selection><tr>'; /* Create the table for the purchase order header */ echo '<th>'._('Order Number').'</th>'; @@ -61,17 +61,17 @@ while ($myrow=DB_fetch_array($result)) { - $authsql='SELECT authlevel FROM purchorderauth - WHERE userid="'.$_SESSION['UserID'].'" - AND currabrev="'.$myrow['currcode'].'"'; + $authsql="SELECT authlevel FROM purchorderauth + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$myrow['currcode']."'"; $authresult=DB_query($authsql, $db); $myauthrow=DB_fetch_array($authresult); $authlevel=$myauthrow['authlevel']; - $ordervaluesql='SELECT sum(unitprice*quantityord) as ordervalue + $ordervaluesql="SELECT sum(unitprice*quantityord) as ordervalue FROM purchorderdetails - WHERE orderno='.$myrow['orderno']; + WHERE orderno='".$myrow['orderno'] . "'"; $ordervalueresult=DB_query($ordervaluesql, $db); $myordervaluerow=DB_fetch_array($ordervalueresult); @@ -92,15 +92,15 @@ echo '</select></td>'; echo '</tr>'; echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; - $linesql='SELECT purchorderdetails.*, + $linesql="SELECT purchorderdetails.*, stockmaster.description FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode - WHERE orderno='.$myrow['orderno']; + WHERE orderno='".$myrow['orderno'] . "'"; $lineresult=DB_query($linesql, $db); - echo '<tr><td></td><td colspan=5 align=left><table align=left>'; + echo '<tr><td></td><td colspan=5 align=left><table class=selection align=left>'; echo '<th>'._('Product').'</th>'; echo '<th>'._('Quantity Ordered').'</th>'; echo '<th>'._('Currency').'</th>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-10 10:21:24 UTC (rev 3724) +++ trunk/doc/Change.log.html 2010-09-10 10:38:19 UTC (rev 3725) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PeriodsInquiry.php - Layout improvements</p> <p>08/09/10 Tim: PDFTopItems.php - Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-10 15:16:54
|
Revision: 3726 http://web-erp.svn.sourceforge.net/web-erp/?rev=3726&view=rev Author: tim_schofield Date: 2010-09-10 15:16:48 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Layout improvements, and sql quoting corrections Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/doc/Change.log.html Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2010-09-10 10:38:19 UTC (rev 3725) +++ trunk/PO_Header.php 2010-09-10 15:16:48 UTC (rev 3726) @@ -79,10 +79,10 @@ $date = date($_SESSION['DefaultDateFormat']); if ($OldStatus!=$NewStatus) { /* assume this in the first instance */ - $authsql='SELECT authlevel + $authsql="SELECT authlevel FROM purchorderauth - WHERE userid="'.$_SESSION['UserID'].'" - AND currabrev="'.$_SESSION['PO'.$identifier]->CurrCode.'"'; + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$_SESSION['PO'.$identifier]->CurrCode."'"; $authresult=DB_query($authsql,$db); $myrow=DB_fetch_array($authresult); @@ -170,7 +170,7 @@ status='" . $_POST['Stat']. "', stat_comment='" . $StatusComment ."', allowprint='".$AllowPrint."' - WHERE purchorders.orderno =" . $_SESSION['ExistingOrder']; + WHERE purchorders.orderno ='" . $_SESSION['ExistingOrder'] ."'"; $ErrMsg = _('The order status could not be updated because'); $DelResult=DB_query($SQL,$db,$ErrMsg); @@ -257,9 +257,9 @@ $_SESSION['PO'.$identifier]->AllowPrintPO=1; - $sql = 'UPDATE purchorders + $sql = "UPDATE purchorders SET purchorders.allowprint=1 - WHERE purchorders.orderno=' . $_SESSION['PO'.$identifier]->OrderNo; + WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('An error occurred updating the purchase order to allow reprints') . '. ' . _('The error says'); $updateResult = DB_query($sql,$db,$ErrMsg); @@ -306,7 +306,7 @@ } if ($OK_to_delete==1){ - $emailsql='SELECT email FROM www_users WHERE userid="'.$_SESSION['PO'.$identifier]->Initiator.'"'; + $emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['PO'.$identifier]->Initiator."'"; $emailresult=DB_query($emailsql, $db); $emailrow=DB_fetch_array($emailresult); $StatusComment=date($_SESSION['DefaultDateFormat']). @@ -318,16 +318,16 @@ if($_SESSION['ExistingOrder']!=0){ - $sql = 'UPDATE purchorderdetails + $sql = "UPDATE purchorderdetails SET completed=1 - WHERE purchorderdetails.orderno =' . $_SESSION['ExistingOrder']; + WHERE purchorderdetails.orderno ='" . $_SESSION['ExistingOrder'] ."'"; $ErrMsg = _('The order detail lines could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); $sql="UPDATE purchorders SET status='".PurchOrder::STATUS_CANCELLED."', stat_comment='".$StatusComment."' - WHERE orderno=".$_SESSION['ExistingOrder']; + WHERE orderno='".$_SESSION['ExistingOrder']."'"; $ErrMsg = _('The order header could not be deleted because'); $DelResult=DB_query($sql,$db,$ErrMsg); @@ -414,7 +414,7 @@ suppliers.address6, suppliers.currcode FROM suppliers - WHERE suppliers.suppname " . LIKE . " '$SearchString' + WHERE suppliers.suppname LIKE '". $SearchString ."' ORDER BY suppliers.suppname"; } elseif (strlen($_POST['SuppCode'])>0){ @@ -428,7 +428,7 @@ suppliers.address6, suppliers.currcode FROM suppliers - WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SuppCode'] . "%' + WHERE suppliers.supplierid LIKE '%" . $_POST['SuppCode'] . "%' ORDER BY suppliers.supplierid"; } @@ -477,30 +477,30 @@ /* will only be true if page called from supplier selection form * or set because only one supplier record returned from a search * so parse the $Select string into supplier code and branch code */ - $sql='SELECT currcode FROM suppliers where supplierid="'.$_POST['Select'].'"'; + $sql="SELECT currcode FROM suppliers where supplierid='".$_POST['Select']."'"; $result=DB_query($sql,$db); $myrow=DB_fetch_array($result); $SupplierCurrCode=$myrow['currcode']; - $authsql='SELECT cancreate + $authsql="SELECT cancreate FROM purchorderauth - WHERE userid="'.$_SESSION['UserID'].'" - AND currabrev="'.$SupplierCurrCode.'"'; + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$SupplierCurrCode."'"; $authresult=DB_query($authsql,$db); $sql = "SELECT suppliers.suppname, - suppliers.currcode, - currencies.rate, - suppliers.paymentterms, - suppliers.address1, - suppliers.address2, - suppliers.address3, - suppliers.address4, - suppliers.address5, - suppliers.address6, - suppliers.phn, - suppliers.port + suppliers.currcode, + currencies.rate, + suppliers.paymentterms, + suppliers.address1, + suppliers.address2, + suppliers.address3, + suppliers.address4, + suppliers.address5, + suppliers.address6, + suppliers.phn, + suppliers.port FROM suppliers INNER JOIN currencies ON suppliers.currcode=currencies.currabrev WHERE supplierid='" . $_POST['Select'] . "'"; @@ -622,7 +622,7 @@ prnMsg($msg,'warn'); } - echo '<table cellpadding=3 colspan=4> + echo '<table cellpadding=3 colspan=4 class=selection> <tr> <td><font size=1>' . _('Enter text in the supplier name') . ":</font></td> <td><input type='Text' name='Keywords' size=20 maxlength=25></td> @@ -640,7 +640,7 @@ if (isset($result_SuppSelect)) { - echo '<br><table cellpadding=3 colspan=7 border=1>'; + echo '<br><table cellpadding=3 colspan=7 class=selection>'; $tableheader = "<tr> <th>" . _('Code') . "</th> @@ -728,35 +728,35 @@ $Qty=1; } - $sql='SELECT + $sql="SELECT controlled, serialised, description, units , decimalplaces FROM stockmaster - WHERE stockid="'.$purch_item.'" '; + WHERE stockid='".$purch_item."'"; $result=DB_query($sql, $db); $stockmasterrow=DB_fetch_array($result); - $sql='SELECT + $sql="SELECT price, suppliersuom, suppliers_partno, conversionfactor FROM purchdata - WHERE supplierno="'.$_GET['SelectedSupplier'] .'" - AND stockid="'.$purch_item.'" '; + 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 + $sql="SELECT stockact FROM stockcategory LEFT JOIN stockmaster ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockid="'.$purch_item.'" '; + WHERE stockid='".$purch_item. "'"; $result=DB_query($sql, $db); $categoryrow=DB_fetch_array($result); @@ -820,14 +820,14 @@ } // move apart by Hudson - echo '<br><table border=1 colspan=1 width=80%> + echo '<br><table colspan=1 width=80%> <tr> - <td><font color=blue size=4><b>' . _('Order Initiation Details') . '</b></font></td> + <th><font color=blue size=4><b>' . _('Order Initiation Details') . '</b></font></th> - <td><font color=blue size=4><b>' . _('Order Status') . '</b></font></td> + <th><font color=blue size=4><b>' . _('Order Status') . '</b></font></th> </tr> <tr><td style="width:50%">'; - echo '<table>'; + echo '<table class=selection width=100%>'; echo '<tr><td>' . _('PO Date') . ':</td><td>'; if ($_SESSION['ExistingOrder']!=0){ echo ConvertSQLDate($_SESSION['PO'.$identifier]->Orig_OrderDate); @@ -886,7 +886,7 @@ } if (isset($_POST['AllowRePrint'])) { - $sql='UPDATE purchorders SET allowprint=1 WHERE orderno='.$_SESSION['PO'.$identifier]->OrderNo; + $sql="UPDATE purchorders SET allowprint=1 WHERE orderno='".$_SESSION['PO'.$identifier]->OrderNo . "'"; $result=DB_query($sql, $db); } @@ -901,7 +901,7 @@ echo '</table>'; - echo '<td style="width:50%"><table>'; + echo '<td style="width:50%" valign=top><table class=selection width=100%>'; if($_SESSION['ExistingOrder'] != 0 and $_SESSION['PO'.$identifier]->Stat == PurchOrder::STATUS_PRINTED){ echo '<tr><td><a href="' .$rootpath . "/GoodsReceived.php?" . SID . "&PONumber=" . $_SESSION['PO'.$identifier]->OrderNo . "&identifier=".$identifier.'">'._('Receive this order').'</a></td></tr>'; @@ -960,21 +960,21 @@ // end of move by Hudson - echo '<table border=1 width=80%> + echo '<table width=80%> <tr> - <td><font color=blue size=4><b>' . _('Warehouse Info') . '</b></font></td> - <!-- <td><font color=blue size=4><b>' . _('Delivery To') . '</b></font></td> --> - <td><font color=blue size=4><b>' . _('Supplier Info') . '</b></font></td> + <th><font color=blue size=4><b>' . _('Warehouse Info') . '</b></font></th> + <!-- <th><font color=blue size=4><b>' . _('Delivery To') . '</b></font></th> --> + <th><font color=blue size=4><b>' . _('Supplier Info') . '</b></font></th> </tr> <tr><td valign=top>'; /*nested table level1 */ - echo '<table><tr><td>' . _('Warehouse') . ':</td> + echo '<table class=selection width=100%><tr><td>' . _('Warehouse') . ':</td> <td><select name=StkLocation onChange="ReloadForm(form1.LookupDeliveryAddress)">'; - $sql = 'SELECT loccode, + $sql = "SELECT loccode, locationname - FROM locations'; + FROM locations"; $LocnResult = DB_query($sql,$db); while ($LocnRow=DB_fetch_array($LocnResult)){ @@ -1103,7 +1103,7 @@ echo '<tr><td>' . _('Delivery By') . ':</td><td><select name=deliveryby>'; - $sql = 'SELECT shipper_id, shippername FROM shippers'; + $sql = "SELECT shipper_id, shippername FROM shippers"; $shipperResult = DB_query($sql,$db); while ($shipperRow=DB_fetch_array($shipperResult)){ @@ -1118,7 +1118,7 @@ /* end of sub table */ echo '</td><td>'; /*sub table nested */ - echo '<table><tr><td>' . _('Supplier Selection') . ':</td><td> + echo '<table class=selection width=100%><tr><td>' . _('Supplier Selection') . ':</td><td> <select name=Keywords onChange="ReloadForm(form1.SearchSuppliers)">'; $sql = "SELECT supplierid,suppname FROM suppliers ORDER BY suppname"; @@ -1176,7 +1176,7 @@ </td><td><input type='text' name=supptel size=31 maxlength=30 value='" . $_SESSION['PO'.$identifier]->supptel . "'></td> </tr>"; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); + $result=DB_query("SELECT terms, termsindicator FROM paymentterms", $db); echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='paymentterms'>"; @@ -1206,7 +1206,7 @@ } echo '</td></tr></table>'; /*end of sub table */ - echo '</td></tr><tr><th colspan=4>' . _('Comments'); + echo '</td></tr><tr><th colspan=4><font color=blue size=4><b>' . _('Comments'); $Default_Comments = ''; @@ -1214,7 +1214,7 @@ $_POST['Comments']=$Default_Comments; } - echo ":</th></tr><tr><td colspan=4><textarea name='Comments' style='width:100%' rows=5>" . $_POST['Comments'] . '</textarea>'; + echo ":</b></font></th></tr><tr><td colspan=4><textarea name='Comments' style='width:100%' rows=5>" . $_POST['Comments'] . '</textarea>'; echo '</table>'; @@ -1229,4 +1229,4 @@ echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-09-10 10:38:19 UTC (rev 3725) +++ trunk/PO_Items.php 2010-09-10 15:16:48 UTC (rev 3726) @@ -96,7 +96,7 @@ /*If all clear then proceed to update the database */ if ($InputError!=1){ - $emailsql='SELECT email FROM www_users WHERE userid="'.$_SESSION['PO'.$identifier]->Initiator.'"'; + $emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['PO'.$identifier]->Initiator."'"; $emailresult=DB_query($emailsql, $db); $emailrow=DB_fetch_array($emailresult); $sql = 'BEGIN'; @@ -457,7 +457,7 @@ and stockmaster.discontinued!=1 AND stockmaster.stockid LIKE '" . $_POST['StockCode'] . "' ORDER BY stockmaster.stockid - LIMIT '".$_SESSION['DefaultDisplayRecordsMax']."'"; + LIMIT ".$_SESSION['DefaultDisplayRecordsMax']; } else { $sql = "SELECT stockmaster.stockid, stockmaster.description, @@ -954,14 +954,14 @@ $uom=$POLine->Units; } // echo "<td>$POLine->StockID</td><td>$POLine->ItemDescription</td>td> class=number>$DisplayQuantity</td><td>$POLine->Units</td><td>$POLine->ReqDelDate</td>td> class=number>$DisplayPrice</td>td> class=number>$DisplayLineTotal</font></td><td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "&Edit=" . $POLine->LineNo . "'>" . _('Select') . "</a></td></tr>"; - echo "<td>$POLine->StockID</td> + echo "<td>".$POLine->StockID ."</td> <td>".$POLine->ItemDescription."</td> - <td><input type=text class=number name=Qty$POLine->LineNo size=11 value=".$DisplayQuantity."></td> - <td>$uom</td> - <td><input type=text class=number name=nw$POLine->LineNo size=11 value=".$POLine->nw."></td> - <td><input type=text class=number name=Price$POLine->LineNo size=11 value=".$DisplayPrice."></td> - <td class=number>$DisplayLineTotal</td> - <td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name=ReqDelDate$POLine->LineNo size=11 value=".$POLine->ReqDelDate."></td> + <td><input type=text class=number name=Qty".$POLine->LineNo ." size=11 value=".$DisplayQuantity."></td> + <td>".$uom."</td> + <td><input type=text class=number name=nw".$POLine->LineNo." size=11 value=".$POLine->nw."></td> + <td><input type=text class=number name=Price".$POLine->LineNo." size=11 value=".$DisplayPrice."></td> + <td class=number>".$DisplayLineTotal."</td> + <td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name=ReqDelDate".$POLine->LineNo." size=11 value=".$POLine->ReqDelDate."></td> <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "identifier=".$identifier. "&Delete=" . $POLine->LineNo . "'>" . _('Delete') . "</a></td></tr>"; $_SESSION['PO'.$identifier]->total = $_SESSION['PO'.$identifier]->total + $LineTotal; } @@ -984,11 +984,11 @@ echo '<td><input type=text name=ItemDescription size=40></td></tr>'; echo '<tr><td>'._('General Ledger Code').'</td>'; echo '<td><select name="GLCode">'; - $sql='SELECT + $sql="SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode ASC'; + ORDER BY accountcode ASC"; $result=DB_query($sql, $db); while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['accountcode'].'">'.$myrow['accountcode'].' - '.$myrow['accountname'].'</option>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-10 10:38:19 UTC (rev 3725) +++ trunk/doc/Change.log.html 2010-09-10 15:16:48 UTC (rev 3726) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections</p> +<p>10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PeriodsInquiry.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-09-10 19:03:31
|
Revision: 3727 http://web-erp.svn.sourceforge.net/web-erp/?rev=3727&view=rev Author: tim_schofield Date: 2010-09-10 19:03:24 +0000 (Fri, 10 Sep 2010) Log Message: ----------- Layout improvements, links to SelectSuppliers.php and sql quoting corrections Modified Paths: -------------- trunk/PO_OrderDetails.php trunk/SelectSupplier.php trunk/doc/Change.log.html Modified: trunk/PO_OrderDetails.php =================================================================== --- trunk/PO_OrderDetails.php 2010-09-10 15:16:48 UTC (rev 3726) +++ trunk/PO_OrderDetails.php 2010-09-10 19:03:24 UTC (rev 3727) @@ -21,7 +21,7 @@ FROM purchorderdetails, grns WHERE purchorderdetails.podetailitem=grns.podetailitem - AND grns.grnno=" . $_GET['FromGRNNo']; + AND grns.grnno='" . $_GET['FromGRNNo'] ."'"; $ErrMsg = _('The search of the GRNs was unsuccessful') . ' - ' . _('the SQL statement returned the error'); $orderResult = DB_query($SQL, $db, $ErrMsg); @@ -49,13 +49,16 @@ suppliers.supplierid, suppliers.suppname, suppliers.currcode, - www_users.realname + www_users.realname, + locations.locationname FROM purchorders LEFT JOIN www_users - ON purchorders.initiator=www_users.userid, - suppliers - WHERE purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno = " . $_GET['OrderNo']; + ON purchorders.initiator=www_users.userid + LEFT JOIN locations + ON locations.loccode=purchorders.intostocklocation + LEFT JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + WHERE purchorders.orderno = '" . $_GET['OrderNo'] ."'"; $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db, $ErrMsg); @@ -79,10 +82,13 @@ $myrow = DB_fetch_array($GetOrdHdrResult); /* SHOW ALL THE ORDER INFO IN ONE PLACE */ +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . + _('Purchase Order') . '" alt="">' . ' ' . $title . '</p>'; -echo '<br><table BORDER=0 cellpadding=2>'; -echo '<tr><th style="text-align:left">' . _('Supplier Code'). '</td><td>' . $myrow['supplierid'] . '</td> - <th style="text-align:left">' . _('Supplier Name'). '</td><td>' . $myrow['suppname'] . '</td></tr>'; +echo '<table class=selection cellpadding=2>'; +echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Header Details'). '</font></th></tr>'; +echo '<tr><th style="text-align:left">' . _('Supplier Code'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['supplierid'] . '</a></td> + <th style="text-align:left">' . _('Supplier Name'). '</td><td><a href="SelectSupplier.php?SupplierID='.$myrow['supplierid'].'">' . $myrow['suppname'] . '</a></td></tr>'; echo '<tr><th style="text-align:left">' . _('Ordered On'). '</td><td>' . ConvertSQLDate($myrow['orddate']) . '</td> <th style="text-align:left">' . _('Delivery Address 1'). '</td><td>' . $myrow['deladd1'] . '</td></tr>'; @@ -93,7 +99,7 @@ echo '<tr><th style="text-align:left">' . _('Exchange Rate'). '</td><td>' . $myrow['rate'] . '</td> <th style="text-align:left">' . _('Delivery Address 3'). '</td><td>' . $myrow['deladd3'] . '</td></tr>'; -echo '<tr><th style="text-align:left">' . _('Deliver Into Location'). '</td><td>' . $myrow['intostocklocation'] . '</td> +echo '<tr><th style="text-align:left">' . _('Deliver Into Location'). '</td><td>' . $myrow['locationname'] . '</td> <th style="text-align:left">' . _('Delivery Address 4'). '</td><td>' . $myrow['deladd4'] . '</td></tr>'; echo '<tr><th style="text-align:left">' . _('Initiator'). '</td><td>' . $myrow['realname'] . '</td> @@ -116,7 +122,7 @@ echo '</td></tr>'; echo '<tr><th style="text-align:left">'. _('Status') . '</td><td>'. _($myrow['status']) . '</td></tr>'; -echo '<tr><th style="text-align:left">' . _('Comments'). '</td><td bgcolor=white colspan=3>' . $myrow['comments'] . '</td></tr>'; +echo '<tr><th style="text-align:left">' . _('Comments'). '</td><td colspan=3>' . $myrow['comments'] . '</td></tr>'; echo '</table>'; @@ -125,14 +131,14 @@ /*Now get the line items */ $ErrMsg = _('The line items of the purchase order could not be retrieved'); $LineItemsSQL = "SELECT purchorderdetails.* FROM purchorderdetails - WHERE purchorderdetails.orderno = " . $_GET['OrderNo']; + WHERE purchorderdetails.orderno = '" . $_GET['OrderNo'] ."'"; $LineItemsResult = db_query($LineItemsSQL,$db, $ErrMsg); -echo '<div class="centre"><font size=4 color=BLUE>'. _('Order Line Details'). '</font></div>'; -echo '<table colspan=8 BORDER=0 cellpadding=0> - <tr> +echo '<table colspan=8 class=selection cellpadding=0>'; +echo '<tr><th colspan=8><font size=3 color=navy>'. _('Order Line Details'). '</font></th></tr>'; +echo '<tr> <th>' . _('Item Code'). '</td> <th>' . _('Item Description'). '</td> <th>' . _('Ord Qty'). '</td> @@ -200,4 +206,4 @@ echo '<br>'; include ('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2010-09-10 15:16:48 UTC (rev 3726) +++ trunk/SelectSupplier.php 2010-09-10 19:03:24 UTC (rev 3727) @@ -8,6 +8,9 @@ if (!isset($_SESSION['SupplierID'])) { echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/supplier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Suppliers') . ''; } +if (isset($_GET['SupplierID'])) { + $_SESSION['SupplierID']=$_GET['SupplierID']; +} // only get geocode information if integration is on, and supplier has been selected if ($_SESSION['geocode_integration'] == 1 AND isset($_SESSION['SupplierID'])) { $sql = "SELECT * FROM geocode_param WHERE 1"; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-10 15:16:48 UTC (rev 3726) +++ trunk/doc/Change.log.html 2010-09-10 19:03:24 UTC (rev 3727) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections</p> <p>10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2010-09-11 03:56:16
|
Revision: 3728 http://web-erp.svn.sourceforge.net/web-erp/?rev=3728&view=rev Author: daintree Date: 2010-09-11 03:56:09 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Manual changes - for counter sales, utf-8 languages, PDFLanguage selection Modified Paths: -------------- trunk/doc/Change.log.html trunk/doc/Manual/ManualContributors.html trunk/doc/Manual/ManualGettingStarted.html trunk/doc/Manual/ManualSalesOrders.html trunk/includes/UserLogin.php Added Paths: ----------- trunk/doc/Manual/images/Installer_1.jpg trunk/doc/Manual/images/Installer_2.jpg trunk/doc/Manual/images/UserSettings.jpg Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-10 19:03:24 UTC (rev 3727) +++ trunk/doc/Change.log.html 2010-09-11 03:56:09 UTC (rev 3728) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script <p>10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections</p> <p>10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections</p> @@ -302,7 +303,7 @@ <p>07/04/10 Tim: SelectOrderItems.php - Improve layout and correct for paging of items.</p> <p>07/04/10 Tim: PO_Items.php - Remove the Back To Purchase Order Header link if the order is already posted.</p> <p>07/04/10 Tim: SystemParameters.php and Currencies.php - Correct so that currency updates are only done when Automatic is chosen.</p> -<p>05/04/10 exson qu: Chinese translation update.</p> +<p>05/04/10 Exson Qu: Chinese translation update.</p> <p>05/04/10 Matt Taylor: Z_ImportStocks.php : Correct DB_txn functions and add validation check.</p> <p>05/04/10 Zhiguo: Japanese translation updates</p> <p>04/04/10 Tim: upgrade3.11.1-3.12.sql - Enlarge fieldname column in reportfields to 60 characters</p> Modified: trunk/doc/Manual/ManualContributors.html =================================================================== --- trunk/doc/Manual/ManualContributors.html 2010-09-10 19:03:24 UTC (rev 3727) +++ trunk/doc/Manual/ManualContributors.html 2010-09-11 03:56:09 UTC (rev 3728) @@ -73,18 +73,24 @@ <br><br> Sherif Omar <br><br> +Simon Peter Otandeka +<br><br> Afan Ottenheimer (phplot) <br><br> Ricardo Pedroso <br><br> Jesse Peterson <br><br> +Kalmer Piiskop +<br><br> Olivier Plathey (FPDF - from which TCPDF was derived) <br><br> Renier du Plessis <BR><BR> Dave Premo (report writer) <BR><BR> +Pak Ricard +<BR><BR> Harald Ringehahn <BR><BR> Gunnar Rikardsson @@ -97,15 +103,23 @@ <br><br> Danilo Segan (php-gettext) <BR><BR> +Gjergj Sheldija +<br><br> Matthew Sibson <BR><BR> Vitaliy Shevkunov <br><br> Jake Stride <br><br> +Matt Taylor +<BR><BR> +Paul Thursby +<br><br> Marcos Garcia Trejo <br><br> Mark Yeager (MRP) +<br><br> +Zhiguo Yuan </td> <td valign="top"> <b>Translation </b> @@ -134,8 +148,12 @@ <br><br> Juan L Grassi - Spanish <br><br> +Tanya Komarova - Russian +<br><br> Eddie Molina - Spanish <br><br> +Exson Qu - Chinese +<br><br> J. Hernán Ramírez R. - Spanish (Venezuelan) <br><br> Harald Ringehahn - German @@ -152,7 +170,7 @@ <br><br> Carlos Vera - Spanish <BR><BR> -Tanya Komarova - Russian +Zhiguo Yuan - Chinese <BR><BR> </td> </tr> Modified: trunk/doc/Manual/ManualGettingStarted.html =================================================================== --- trunk/doc/Manual/ManualGettingStarted.html 2010-09-10 19:03:24 UTC (rev 3727) +++ trunk/doc/Manual/ManualGettingStarted.html 2010-09-11 03:56:09 UTC (rev 3728) @@ -28,6 +28,8 @@ over a LAN then encrypted communications are required. The openssl and mod-ssl modules for Apache can be easily used to ensure all data is transmitted in encrypted form. +</li> +<li>For using utf-8 pdf reports in languages other than english the adobe acrobat reader with fonts installed for the necessary locales is required. PDF reports are created used the TCPDF class making use of Adobe CIF fonts - this has the advantage that the pdf reports do not need to bundle with them the large utf-8 character set fonts that would otherwise be required. </li></ul>Using Apache with mod_ssl and openssl secure sockets makes sense where there is any data transmitted over the Internet and not just over a LAN. @@ -82,13 +84,47 @@ <br> The ftp library for PHP is only required for sending order files to a Radio Beacon ftp server for remote warehouse services.<br> <br> -Assuming that a web server with PHP functionality is -operational and a MySQL database server is available either on the same machine -or on the network, a new installation consists of the following five -steps:<br> <br> +<font size="+2"><b>Using the webERP Installer</b></font><br> +<br> +Assuming that a web server with PHP functionality is operational and a MySQL database server is available either on the same machine or on the network and that the web-server is running under a user that is able to write to the webERP installation directory then a new installation can proceed. +<br> <ul> -<li>Copying all the PHP scripts and include files to a directory under the web server document root directory.</li> +<li> +An installation must first copy the scripts to a directory under the web-server's document root directory. Then from a browser enter the URL for the new webERP directory and the installer screen will display: +</li> +<p align="center"><img src="images/Installer_1.jpg"> </p> +<li>The installer checks that all the pre-requistes are met for an installation. You will note from the screen shot above that this installation does not have sufficient privileges to install webERP because the web-server is unable to write to the webERP directory. It is first necessary to change the permissions on the directory where webERP is installed to ensure that the user that the web-server runs as is able to write a new configuration file to the web space. Cpanel and Plesk have facilities to enable this change to the permissions. Any messages on this screen displayed in red need to be resolved before the installation can proceed. Do not attempt to run the installer while red messages persist. +</li> +<li> +Many of the fields required will be populated correctly based. However, it is important to check the entries are correct. The installer will not be able to determine the host (computer) where the mysql database server is installed and this must be entered. +</li> +<li>The user name and the password to the mysql database server are also required. +</li> +<p align="center"><img src="images/Installer_2.jpg"> </p> +<li>The name of the company entered in the installer screen will become the name of the mysql database created. Perhaps an abbreviated name for the company without spaces is idea. The weberpdemo is the name of the weberpdemo database that is a good place to test webERP functionality, but you will wish to change this to the name of your company in a live enviroment. +</li> +<li> +It is possible to elect to install the demo database rather than the new empty database to use for a new installation by clicking the check box. +</li> +<li> +The time-zone is important if your installation is to display the correct time on the local browsers in the country where the business is domiciled. e.g. it is possible to use a US web-server, and operate the business from France. If no entry was entered for the time-zone then the browser would display the time where the web-server was (in the USA) but it is more appropriate to display the time where the business operates from. It is possible to select from any of the PHP defined time-zones. +</li> +<li>The logo for the business used on invoices and statments, orders etc. can be uploaded to the appropriate place on the web-server by selecting it on the installer screen. The logo should be a .jpg file and just a small image no more than 170 px accross and 80 pixels high. +</li> +<li>Finally the user admin is created, and the password for this user needs to be defined from entries on the installer screen. It is also possible to specify your email address which is stored in the database. +</li> +</ul> +Hitting the install webERP button will then create the database for the company with the user admin given the password details and provide a fresh webERP installation from which to start the configuration of the company, see below. +<br> +<br> +<font size="+2"><b>Manual webERP Installation</b></font><br> +<br> +<br> +A manual installation consists of the following five steps:<br> +<br> +<ul> +<li>Copying all the PHP scripts and include files to a directory under the web server document root directory - as for the automatic installer option above</li> <li>Creating the database and populating it with initial data </li> <li>Editing config.php for the database connection information and any other requirements </li> <li>Logging into the system for the first time </li> @@ -113,11 +149,9 @@ <br> <font size="+2"><b>Creating the Database</b></font><br> <br> -The information provided assumes that you are using a MySQL -database server. An sql dump file suitable for Postgres is also -provided. However these instructions refer to the set up necessary -using MySQL.<br> +webERP works only with MySQL or MariaDB database servers. <br> +<br> You need to know the user name and password for the MySQL server. If you have not set these up the default is<br> <br> user root @@ -177,7 +211,7 @@ tables enabled, then all you need to do is to run one of the sql scripts.<br> <br> -Two scripts are provided:<br> +Two scripts are provided under the webERP/sql/mysql directory (folder):<br> <br> <ol> <li>weberp-demo.sql This has a minimal amount of demonstration data @@ -193,11 +227,11 @@ the directory with all the PHP scripts. Change to the directory where the scripts are held or use the full path and enter:<br> <br> -shell > mysql --user=weberp --password='some_pass' < /path_to_the_sql_script/weberp-demo.sql<br> +shell > mysql --user=weberp --password='some_pass' < path_to_web_server/webERP/sql/mysql/weberp-demo.sql<br> <br> or<br> <br> -shell > mysql --user=weberp --password='some_pass' < /path_to_the_sql_script/weberp-new.sql<br> +shell > mysql --user=weberp --password='some_pass' < path_to_web_server/webERP/sql/mysql/weberp-new.sql<br> <br> as required. Modify the user entered here as 'weberp' to the user you created in MySQL for the purpose, and modify the password stated here @@ -212,15 +246,24 @@ (computer name), username and password of the database connection required to connect to the database server. There is also an option to chose which type of database server is to be used. Currently there are -only options for mysql and postgres. There is no going forward without +only options for mysql and mysqli. There is no going forward without this data.<br> <br> The default contents of the config.php file are as follows and -must be edited in an editor of choice (KATE, Wordpad, etc.). Then, +must be edited in an editor of choice. Then, save config.php in the web directory where the scripts are located. Note, the system is continually evolving and may well have changed since this was written.<br> <br> +<br> +The time-zone of the business should also be specified here using a statement like: +<br> +<br> +putenv('Australia/Sydney'); +<br> +<br> +This ensures that the time-zone of the business is displayed on all browsers using the system irrespective of where the web-server is located (i.e. the timezone of the web-server) + ============================================<br> beginning of config.php<br> ============================================<br> @@ -356,11 +399,9 @@ <br> <br> This script may not work because it requires that the web-server has write permission to the scripts directory, in which case you may need to fall back to the manual method described below. -<br>In the default install above you created a database called weberp and there is a directory under webERP/companies also called weberp. To make another company you need to copy the - - - - +<br>In the default install above you created a database called weberp and there is a directory under webERP/companies also called weberp. To make another company you need to copy this directory and all the sub-directories under it to a new directory under webERP/companies/. The name of this directory needs to be identical to the name of the new database created on the same mysql server. +<br> +<br> <font size="+2"><b>Configuration Parameters</b></font><br> <br> In versions prior to version 3.0, configuration @@ -375,6 +416,7 @@ are shown along side it.<br> <br>There is additional information on installation in webERP/doc/INSTALL.txt <br> +<br> <font size="+2"><b>Themes and GUI Modification</b></font><br> <br> Often what visually appeals to one does not appeal to another. @@ -432,5 +474,35 @@ config.php must not be modified - i.e. $PageSecurity = 1 allowed only. In addition, the customer code and branch code applicable to the person logging on must be entered.<br> - -<!-- Help End: WWW_Users --></li></ol></body></html> +<br> +<br> +<font size="+2"><b>Internationalisation and Language Translations</b></font><br> +<br> +<br> +As of webERP version 3.12 all translations of the user interface use utf-8 character encoding. Inspecting the character set that your browser is using (View->Character Encoding in Firefox) will show utf-8 (perhaps not the english manual). To use a language other than english the web-server must have a locale installed for that language using the utf-8 character set. For German this would be the locale called de_DE.utf8 - most locales follow a similar naming convention e.g. en_GB.utf8 for English - Great Britain with utf-8 characters. en_GB.utf8 is the default locale for webERP. +<br> +<br> +Under the main webERP directory the locale directory contains the language specific data necessary for translations. By default there will only be one directory under locale for en_GB.utf8 - the default locale. Under the language_country.utf8 locale there is a further sub-directory for LC_MESSAGES - it is under this directory where the messages.po lives - this file contains a lits of all the strings used in the interface and their translation into the language of the locale. To use the translations the .po file needs to be "compiled" into a binary format for faster retrieval and this is what the messages.mo file is. +<br> +<br> +webERP uses the gettext library of functions for using the data under the locale files to perform the translations. The gettext libraries need to be installed on the web-server together with the locales that you wish to translate into. In addition the web-server's PHP installation must have the gettext extension configured to use the gettext library functions. Pointing the browser at http://yourdomain/webERP/phpinfo.php will show the details of the PHP installation on your web-server and you should see the gettext extension available from this page. +<br> +<br> +webERP distributes language packs for all the different languages from sourceforge - http://sourceforge.net/projects/web-erp/files/ +Browse to the language your require and download the zip archive. Transfer the file or download it to your web-server under the webERP/locale directory - then extract it. Make sure the files are readable by the web-server (and the user that the web-server runs under) - it may be necessary to change the owner or permissions of the language files. +<br> +<br> +To change the language displayed for a specific user - the user clicks on their name as shown on every screen at the top of the page. This brings up their user settings. +<p align="center"><img src="images/UserSettings.jpg"> </p> +webERP looks at all the directories available under webERP/locale to see which languages are installed and provides a convenient way for users to select their preferred language. In addition to selecting the language it is also necessary to select the fonts required for pdf support in the selected language. +<br> +<br> +PDFs are produced in utf-8 character set which has 4 bytes for each character. Unfortunately, the CID fonts used in PDFs only have 2 bytes so there is required to be some mapping of CID characters to utf-8 fonts to make everything work. In practise all this means is that the correct language needs also to be selected for the PDF language. +<br> +<br> +If you are interested in contributing a language pack to webERP - which is always very much appreciated! There are instructions for how to proceed at +http://www.weberp.org/HowToTranslate +<br> +<br> +<!-- Help End: WWW_Users --> +</body></html> Modified: trunk/doc/Manual/ManualSalesOrders.html =================================================================== --- trunk/doc/Manual/ManualSalesOrders.html 2010-09-10 19:03:24 UTC (rev 3727) +++ trunk/doc/Manual/ManualSalesOrders.html 2010-09-11 03:56:09 UTC (rev 3728) @@ -17,6 +17,7 @@ <li>User selectable inventory location to pick from. <li>Free form entry of delivery addresses - defaulting to the customer branch physical address. <li>Recurring sales orders that recurr until any chosen finish date at a defined frequency per annum +<li>Invoices for cash sales can be entered directly without first entering an order </ul> <!-- Help Begin: SelectOrderItems --> @@ -66,7 +67,12 @@ <!-- Help End: SelectOrderItems --> <br><br> - +<font size="+1"><b>Entry of Cash Sales Directly - Counter Sales</b></font> +<br><br> +In version 3.12 of webERP a new feature was introduced which allowed for cash sales to be entered directly without first entering an order and then confirming a dispatch to invoice. This feature is known as "counter sales". From the main menu->Sales tab select Enter Counter Sales. Entry is similar to entering an order, by default the quick entry screen allows entry of item codes and quantities but it is also possible to select items by the search functions in much the same way as an order. The tax is calculated and the total amount to pay is shown. This page also expects the payment to be made and entered. The payment entered is automatically allocated to the sale. +<br><br> +Behind the scenes this script produces all the database entries for an order and an invoice with sales analysis, stock movements etc etc all correctly created. The customer (and customer branch) used for the entries is derived from the user's default inventory location. webERP looks at the users default location and then looks up against the location record to find the cash sales debtor account (and branch) to use for counter sales entered this way. Obviously before the Counter Sales functionality is used the customer and branch must first be entered against the location records (Setup-> Inventory Location Maintenance) in the format customercode-branchcode in the field provided for this purpose. +<br><br> <!-- Help Begin: SelectSalesOrder --> <font size="+1"><b>Modfiying An Order</b></font> Added: trunk/doc/Manual/images/Installer_1.jpg =================================================================== (Binary files differ) Property changes on: trunk/doc/Manual/images/Installer_1.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/doc/Manual/images/Installer_2.jpg =================================================================== (Binary files differ) Property changes on: trunk/doc/Manual/images/Installer_2.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/doc/Manual/images/UserSettings.jpg =================================================================== (Binary files differ) Property changes on: trunk/doc/Manual/images/UserSettings.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/includes/UserLogin.php =================================================================== --- trunk/includes/UserLogin.php 2010-09-10 19:03:24 UTC (rev 3727) +++ trunk/includes/UserLogin.php 2010-09-11 03:56:09 UTC (rev 3728) @@ -36,23 +36,24 @@ return UL_SHOWLOGIN; } $sql = "SELECT www_users.fullaccess, - www_users.customerid, - www_users.lastvisitdate, - www_users.pagesize, - www_users.defaultlocation, - www_users.branchcode, - www_users.modulesallowed, - www_users.blocked, - www_users.realname, - www_users.theme, - www_users.displayrecordsmax, - www_users.userid, - www_users.language, - www_users.salesman - FROM www_users - WHERE www_users.userid='" . $Name . "' - AND (www_users.password='" . CryptPass($Password) . "' - OR www_users.password='" . $Password . "')"; + www_users.customerid, + www_users.lastvisitdate, + www_users.pagesize, + www_users.defaultlocation, + www_users.branchcode, + www_users.modulesallowed, + www_users.blocked, + www_users.realname, + www_users.theme, + www_users.displayrecordsmax, + www_users.userid, + www_users.language, + www_users.salesman, + www_users.pdflanguage + FROM www_users + WHERE www_users.userid='" . $Name . "' + AND (www_users.password='" . CryptPass($Password) . "' + OR www_users.password='" . $Password . "')"; $Auth_Result = DB_query($sql, $db); // Populate session variables with data base results if (DB_num_rows($Auth_Result) > 0) { @@ -74,6 +75,7 @@ // $_SESSION['UserID'] = $myrow[11]; $_SESSION['Language'] = $myrow['language']; $_SESSION['SalesmanLogin'] = $myrow['salesman']; + $_SESSION['PDFLanguage'] = $myrow['pdflanguage']; if ($myrow[10] > 0) { $_SESSION['DisplayRecordsMax'] = $myrow['displayrecordsmax']; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-11 08:38:30
|
Revision: 3730 http://web-erp.svn.sourceforge.net/web-erp/?rev=3730&view=rev Author: tim_schofield Date: 2010-09-11 08:38:23 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Correct the sql quoting Modified Paths: -------------- trunk/PO_PDFPurchOrder.php trunk/doc/Change.log.html Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2010-09-11 06:08:12 UTC (rev 3729) +++ trunk/PO_PDFPurchOrder.php 2010-09-11 08:38:23 UTC (rev 3730) @@ -1,6 +1,5 @@ <?php /* $Id$*/ -/* $Revision: 1.30 $ */ $PageSecurity = 2; include('includes/session.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -31,9 +30,9 @@ /* If we are not previewing the order then find * the order status */ if ($OrderNo != 'Preview') { - $sql='SELECT status + $sql="SELECT status FROM purchorders - WHERE orderno='.$OrderNo; + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); $OrderStatus=$myrow['status']; @@ -95,7 +94,7 @@ suppliers.currcode FROM purchorders INNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid - WHERE purchorders.orderno=" . $OrderNo; + WHERE purchorders.orderno='" . $OrderNo ."'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)==0){ /*There is no order header returned */ $title = _('Print Purchase Order Error'); @@ -190,7 +189,7 @@ ON purchorderdetails.itemcode=stockmaster.stockid LEFT JOIN unitsofmeasure ON purchorderdetails.uom=unitsofmeasure.unitid - WHERE orderno =" . $OrderNo; + WHERE orderno ='" . $OrderNo ."'"; $result=DB_query($sql,$db); } if ($OrderNo=='Preview' or DB_num_rows($result)>0){ @@ -315,11 +314,11 @@ } } if ($ViewingOnly==0 && !$failed) { - $commentsql='SELECT initiator,stat_comment FROM purchorders WHERE orderno='.$OrderNo; + $commentsql="SELECT initiator,stat_comment FROM purchorders WHERE orderno='".$OrderNo."'"; $commentresult=DB_query($commentsql,$db); $commentrow=DB_fetch_array($commentresult); $comment=$commentrow['stat_comment']; - $emailsql='SELECT email FROM www_users WHERE userid="'.$commentrow['initiator'].'"'; + $emailsql="SELECT email FROM www_users WHERE userid='".$commentrow['initiator']."'"; $emailresult=DB_query($emailsql, $db); $emailrow=DB_fetch_array($emailresult); $date = date($_SESSION['DefaultDateFormat']); @@ -333,7 +332,7 @@ status = '" . PurchOrder::STATUS_PRINTED . "', stat_comment = '" . $StatusComment . "' WHERE - purchorders.orderno = " . $OrderNo; + purchorders.orderno = '" . $OrderNo."'"; $result = DB_query($sql,$db); } } /* There was enough info to either print or email the purchase order */ @@ -377,7 +376,7 @@ suppliercontacts.email FROM suppliercontacts INNER JOIN purchorders ON suppliercontacts.supplierid=purchorders.supplierno - WHERE purchorders.orderno=$OrderNo"; + WHERE purchorders.orderno='".$OrderNo."'"; $ContactsResult=DB_query($SQL,$db, $ErrMsg); if (DB_num_rows($ContactsResult)>0){ echo '<tr><td>'. _('Email to') .':</td><td><select name="EmailTo">'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-11 06:08:12 UTC (rev 3729) +++ trunk/doc/Change.log.html 2010-09-11 08:38:23 UTC (rev 3730) @@ -1,6 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> -<p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script +<p>11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting</p> +<p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script</p> <p>10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections</p> <p>10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_Header.php - Layout improvements, and sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-11 09:47:03
|
Revision: 3731 http://web-erp.svn.sourceforge.net/web-erp/?rev=3731&view=rev Author: tim_schofield Date: 2010-09-11 09:46:57 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Correct the sql quoting Modified Paths: -------------- trunk/PO_SelectOSPurchOrder.php trunk/doc/Change.log.html Modified: trunk/PO_SelectOSPurchOrder.php =================================================================== --- trunk/PO_SelectOSPurchOrder.php 2010-09-11 08:38:23 UTC (rev 3730) +++ trunk/PO_SelectOSPurchOrder.php 2010-09-11 09:46:57 UTC (rev 3731) @@ -76,7 +76,7 @@ INNER JOIN purchorderdetails ON stockmaster.stockid=purchorderdetails.itemcode WHERE $completed - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description LIKE " . $SearchString ." AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -95,7 +95,7 @@ INNER JOIN purchorderdetails ON stockmaster.stockid=purchorderdetails.itemcode WHERE $completed - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.stockid LIKE '%" . $_POST['StockCode'] . "%' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -153,7 +153,7 @@ echo '</select> <input type=submit name="SearchOrders" value="' . _('Search Purchase Orders') . '"></td></tr></table>'; } -$SQL='SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription'; +$SQL="SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); echo "<br><font size=1><div class='page_help_text'>" ._('To search for purchase orders for a specific part use the part selection facilities below') @@ -231,7 +231,7 @@ //figure out the SQL required from the inputs available $completed = " AND purchorderdetails.completed=0"; if (isset($OrderNumber) && $OrderNumber !='') { - $SQL = 'SELECT purchorders.orderno, + $SQL = "SELECT purchorders.orderno, suppliers.suppname, purchorders.orddate, purchorders.initiator, @@ -244,9 +244,9 @@ purchorderdetails, suppliers WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid '. + AND purchorders.supplierno = suppliers.supplierid ". $completed - .' AND purchorders.orderno="'. $OrderNumber .'" + ." AND purchorders.orderno='". $OrderNumber ."' GROUP BY purchorders.orderno ASC, suppliers.suppname, purchorders.orddate, @@ -254,7 +254,7 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode'; + suppliers.currcode"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-11 08:38:23 UTC (rev 3730) +++ trunk/doc/Change.log.html 2010-09-11 09:46:57 UTC (rev 3731) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting</p> <p>11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting</p> <p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script</p> <p>10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-11 10:05:28
|
Revision: 3732 http://web-erp.svn.sourceforge.net/web-erp/?rev=3732&view=rev Author: tim_schofield Date: 2010-09-11 10:05:22 +0000 (Sat, 11 Sep 2010) Log Message: ----------- Correct the sql quoting, and various layout improvements Modified Paths: -------------- trunk/PO_SelectPurchOrder.php trunk/doc/Change.log.html Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2010-09-11 09:46:57 UTC (rev 3731) +++ trunk/PO_SelectPurchOrder.php 2010-09-11 10:05:22 UTC (rev 3732) @@ -53,7 +53,7 @@ ON stockmaster.stockid = locstock.stockid INNER JOIN purchorderdetails ON stockmaster.stockid=purchorderdetails.itemcode WHERE purchorderdetails.completed=1 - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description LIKE '" . $SearchString ."' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -69,7 +69,7 @@ ON stockmaster.stockid = locstock.stockid INNER JOIN purchorderdetails ON stockmaster.stockid=purchorderdetails.itemcode WHERE purchorderdetails.completed=1 - AND stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%' + AND stockmaster.stockid LIKE '%" . $_POST['StockCode'] . "%' AND stockmaster.categoryid='" . $_POST['StockCat'] . "' GROUP BY stockmaster.stockid, stockmaster.description, @@ -125,8 +125,6 @@ $result1 = DB_query($SQL, $db); echo '<br><br><table class=selection><tr><td>'; echo '<font size=1>' . _('To search for purchase orders for a specific part use the part selection facilities below') . '</font>'; -echo '<input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; -echo '<input type=submit name="ResetPart" value="' . _('Show All') . '">'; echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { @@ -138,9 +136,12 @@ echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr><tr><td></td>'; echo '<td><font size=3><b>' . _('OR') . ' </b></font><font size=1>' . _('Enter extract of the') . '<b>' . _('Stock Code') . '</b>:</font></td>'; -echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td></tr></table><br><br>'; +echo '<td><input type="text" name="StockCode" size=15 maxlength=18></td></tr>'; +echo '<tr><td colspan=3><div class=centre><input type=submit name="SearchParts" value="' . _('Search Parts Now') . '">'; +echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div></td></tr>'; +echo '</table><br><br>'; if (isset($StockItemsResult)) { - echo '<table cellpadding=2 colspan=7 border=2>'; + echo '<table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><td class="tableheader">' . _('Code') . '</td> <td class="tableheader">' . _('Description') . '</td> <td class="tableheader">' . _('On Hand') . '</td> @@ -192,7 +193,7 @@ suppliers WHERE purchorders.orderno = purchorderdetails.orderno AND purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno=" . $OrderNumber . " + AND purchorders.orderno='" . $OrderNumber . "' GROUP BY purchorders.orderno"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ @@ -302,14 +303,14 @@ $PurchOrdersResult = DB_query($SQL, $db, $ErrMsg); if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ - echo '<table cellpadding=2 colspan=7 WIDTH=90%>'; - $TableHeader = '<tr><td class="tableheader">' . _('View') . '</td> - <td class="tableheader">' . _('Supplier') . '</td> - <td class="tableheader">' . _('Currency') . '</td> - <td class="tableheader">' . _('Requisition') . '</td> - <td class="tableheader">' . _('Order Date') . '</td> - <td class="tableheader">' . _('Initiator') . '</td> - <td class="tableheader">' . _('Order Total') . '</td> + echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; + $TableHeader = '<tr><th>' . _('View') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Requisition') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiator') . '</th> + <th>' . _('Order Total') . '</th> </tr>'; echo $TableHeader; $j = 1; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-11 09:46:57 UTC (rev 3731) +++ trunk/doc/Change.log.html 2010-09-11 10:05:22 UTC (rev 3732) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various layout improvements</p> <p>11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting</p> <p>11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting</p> <p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 11:35:39
|
Revision: 3733 http://web-erp.svn.sourceforge.net/web-erp/?rev=3733&view=rev Author: tim_schofield Date: 2010-09-13 11:35:31 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Format correctly for screen and add in option to export as a csv file Modified Paths: -------------- trunk/POReport.php trunk/doc/Change.log.html Modified: trunk/POReport.php =================================================================== --- trunk/POReport.php 2010-09-11 10:05:22 UTC (rev 3732) +++ trunk/POReport.php 2010-09-13 11:35:31 UTC (rev 3733) @@ -20,50 +20,60 @@ $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); } -if (isset($_POST['PartNumber'])){ - $PartNumber = trim(strtoupper($_POST['PartNumber'])); -} elseif (isset($_GET['PartNumber'])){ - $PartNumber = trim(strtoupper($_GET['PartNumber'])); -} +if (isset($_POST['submit']) or isset($_POST['submitcsv'])) { + if (isset($_POST['PartNumber'])){ + $PartNumber = trim(strtoupper($_POST['PartNumber'])); + } elseif (isset($_GET['PartNumber'])){ + $PartNumber = trim(strtoupper($_GET['PartNumber'])); + } -# Part Number operator - either LIKE or = -$PartNumberOp = $_POST['PartNumberOp']; + # Part Number operator - either LIKE or = + $PartNumberOp = $_POST['PartNumberOp']; -if (isset($_POST['SupplierId'])){ - $SupplierId = trim(strtoupper($_POST['SupplierId'])); -} elseif (isset($_GET['SupplierId'])){ - $SupplierId = trim(strtoupper($_GET['SupplierId'])); + if (isset($_POST['SupplierId'])){ + $SupplierId = trim(strtoupper($_POST['SupplierId'])); + } elseif (isset($_GET['SupplierId'])){ + $SupplierId = trim(strtoupper($_GET['SupplierId'])); + } + + $SupplierIdOp = $_POST['SupplierIdOp']; + + $SupplierNameOp = $_POST['SupplierNameOp']; + + // Save $_POST['SummaryType'] in $savesummarytype because change $_POST['SummaryType'] when + // create $sql + $savesummarytype = $_POST['SummaryType']; } -$SupplierIdOp = $_POST['SupplierIdOp']; - if (isset($_POST['SupplierName'])){ $SupplierName = trim(strtoupper($_POST['SupplierName'])); } elseif (isset($_GET['SupplierName'])){ $SupplierName = trim(strtoupper($_GET['SupplierName'])); } -$SupplierNameOp = $_POST['SupplierNameOp']; - -// Save $_POST['SummaryType'] in $savesummarytype because change $_POST['SummaryType'] when -// create $sql -$savesummarytype = $_POST['SummaryType']; - // Had to add supplierid to SummaryType when do summary by name because there could be several accounts // with the same name. Tried passing 'suppname,supplierid' in form, but it only read 'suppname' -if ($_POST['SummaryType'] == 'suppname') { - $_POST['SummaryType'] = 'suppname,suppliers.supplierid'; +if (isset($_POST['SummaryType']) and $_POST['SummaryType'] == 'suppname') { + $_POST['SummaryType'] = 'suppname,suppliers.supplierid'; } if (isset($_POST['submit'])) { - submit($db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="">' . ' ' . $title.'</p>'; + submit($db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype); +} else if (isset($_POST['submitcsv'])) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="">' . ' ' . $title.'</p>'; + submitcsv($db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype); } else { - display($db); + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="">' . '</img>' . $title.'</p>'; + display($db); } //####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### -function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype) +function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype) { //initialize no input errors @@ -77,72 +87,80 @@ if (!Is_Date($_POST['FromDate'])) { $InputError = 1; prnMsg(_('Invalid From Date'),'error'); - } + } if (!Is_Date($_POST['ToDate'])) { $InputError = 1; prnMsg(_('Invalid To Date'),'error'); } - + # Add more to WHERE statement, if user entered something for the part number,supplierid, name $wherepart = ' '; if (strlen($PartNumber) > 0 && $PartNumberOp == 'LIKE') { - $PartNumber = $PartNumber . '%'; + $PartNumber = $PartNumber . '%'; } else { - $PartNumberOp = '='; + $PartNumberOp = '='; } if (strlen($PartNumber) > 0) { - $wherepart = " AND purchorderdetails.itemcode " . $PartNumberOp . " '" . $PartNumber . "' "; + $wherepart = " AND purchorderdetails.itemcode " . $PartNumberOp . " '" . $PartNumber . "' "; + } else { + $wherepart=' '; } $wheresupplierid = ' '; if ($SupplierIdOp == 'LIKE') { - $SupplierId = $SupplierId . '%'; + $SupplierId = $SupplierId . '%'; } else { - $SupplierIdOp = '='; + $SupplierIdOp = '='; } if (strlen($SupplierId) > 0) { - $wheresupplierid = " AND purchorders.supplierno " . $SupplierIdOp . " '" . $SupplierId . "' "; + $wheresupplierid = " AND purchorders.supplierno " . $SupplierIdOp . " '" . $SupplierId . "' "; + } else { + $wheresupplierid=' '; } $wheresuppliername = ' '; if (strlen($SupplierName) > 0 && $SupplierNameOp == 'LIKE') { - $SupplierName = $SupplierName . '%'; + $SupplierName = $SupplierName . '%'; } else { - $SupplierNameOp = '='; + $SupplierNameOp = '='; } if (strlen($SupplierName) > 0) { - $wheresuppliername = " AND suppliers.suppname " . $SupplierNameOp . " '" . $SupplierName . "' "; + $wheresuppliername = " AND suppliers.suppname " . $SupplierNameOp . " '" . $SupplierName . "' "; + } else { + $wheresuppliername=' '; } if (strlen($_POST['OrderNo']) > 0) { - $whereorderno = ' AND purchorderdetails.orderno = ' . " '" . $_POST['OrderNo'] . "' "; + $whereorderno = ' AND purchorderdetails.orderno = ' . " '" . $_POST['OrderNo'] . "' "; + } else { + $whereorderno=' '; } - $wherelinestatus = ' '; - # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] - #in WHERE clause because the WHERE clause didn't recognize - # that had used the IF statement to create a field called linestatus - if ($_POST['LineStatus'] != 'All') { - if ($_POST['DateType'] == 'Order') { + $wherelinestatus = ' '; + # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] + #in WHERE clause because the WHERE clause didn't recognize + # that had used the IF statement to create a field called linestatus + if ($_POST['LineStatus'] != 'All') { + if ($_POST['DateType'] == 'Order') { $wherelinestatus = " AND IF(purchorderdetails.quantityord = purchorderdetails.qtyinvoiced || purchorderdetails.completed = 1,'Completed','Open') = '" . $_POST['LineStatus'] . "'"; } else { - $wherelinestatus = " AND IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') = '" - . $_POST['LineStatus'] . "'"; + $wherelinestatus = " AND IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') = '" + . $_POST['LineStatus'] . "'"; } - } + } - - $wherecategory = ' '; - if ($_POST['Category'] != 'All') { - $wherecategory = " AND stockmaster.categoryid = '" . $_POST['Category'] . "'"; - } - - if ($inputerror !=1) { + + $wherecategory = ' '; + if ($_POST['Category'] != 'All') { + $wherecategory = " AND stockmaster.categoryid = '" . $_POST['Category'] . "'"; + } + + if ($InputError !=1) { $fromdate = FormatDateForSQL($_POST['FromDate']); $todate = FormatDateForSQL($_POST['ToDate']); if ($_POST['ReportType'] == 'Detail') { - if ($_POST['DateType'] == 'Order') { + if ($_POST['DateType'] == 'Order') { $sql = "SELECT purchorderdetails.orderno, purchorderdetails.itemcode, purchorderdetails.deliverydate, @@ -157,7 +175,7 @@ suppliers.suppname, stockmaster.decimalplaces, stockmaster.description - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -199,6 +217,695 @@ $wherelinestatus $wherecategory ORDER BY " . $_POST['SortBy']; + } + } else { + // sql for Summary report + $orderby = $_POST['SummaryType']; + // The following is because the 'extprice' summary is a special case - with the other + // summaries, you group and order on the same field; with 'extprice', you are actually + // grouping on the stkcode and ordering by extprice descending + if ($_POST['SummaryType'] == 'extprice') { + $_POST['SummaryType'] = 'itemcode'; + $orderby = 'extprice DESC'; + } + if ($_POST['DateType'] == 'Order') { + if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { + $sql = "SELECT purchorderdetails.itemcode, + SUM(purchorderdetails.quantityord) as quantityord, + SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, + SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, + stockmaster.decimalplaces, + stockmaster.description + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ',stockmaster.decimalplaces, + stockmaster.description + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'orderno') { + $sql = "SELECT purchorderdetails.orderno, + purchorders.supplierno, + SUM(purchorderdetails.quantityord) as quantityord, + SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, + SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, + suppliers.suppname + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ',purchorders.supplierno, + suppliers.suppname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'supplierno' || $_POST['SummaryType'] == 'suppname,suppliers.supplierid') { + $sql = "SELECT purchorders.supplierno, + SUM(purchorderdetails.quantityord) as quantityord, + SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, + SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, + suppliers.suppname + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ',purchorders.supplierno, + suppliers.suppname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'month') { + $sql = "SELECT EXTRACT(YEAR_MONTH from purchorders.orddate) as month, + CONCAT(MONTHNAME(purchorders.orddate),' ',YEAR(purchorders.orddate)) as monthname, + SUM(purchorderdetails.quantityord) as quantityord, + SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, + SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ', monthname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'categoryid') { + $sql = "SELECT SUM(purchorderdetails.quantityord) as quantityord, + SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, + SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, + stockmaster.categoryid, + stockcategory.categorydescription + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ', categorydescription + ORDER BY ' . $orderby; + } + } else { + // Selects by delivery date from grns + if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { + $sql = "SELECT purchorderdetails.itemcode, + SUM(grns.qtyrecd) as quantityord, + SUM(grns.quantityinv) as qtyinvoiced, + SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, + SUM(grns.qtyrecd * grns.stdcostunit) as extcost, + stockmaster.description + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ', stockmaster.description + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'orderno') { + $sql = "SELECT purchorderdetails.orderno, + purchorders.supplierno, + SUM(grns.qtyrecd) as quantityord, + SUM(grns.quantityinv) as qtyinvoiced, + SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, + SUM(grns.qtyrecd * grns.stdcostunit) as extcost, + suppliers.suppname + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ', purchorders.supplierno, + suppliers.suppname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'supplierno' || $_POST['SummaryType'] == 'suppname,suppliers.supplierid') { + $sql = "SELECT purchorders.supplierno, + SUM(grns.qtyrecd) as quantityord, + SUM(grns.quantityinv) as qtyinvoiced, + SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, + SUM(grns.qtyrecd * grns.stdcostunit) as extcost, + suppliers.suppname + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ', purchorders.supplierno, + suppliers.suppname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'month') { + $sql = "SELECT EXTRACT(YEAR_MONTH from purchorders.orddate) as month, + CONCAT(MONTHNAME(purchorders.orddate),' ',YEAR(purchorders.orddate)) as monthname, + SUM(grns.qtyrecd) as quantityord, + SUM(grns.quantityinv) as qtyinvoiced, + SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, + SUM(grns.qtyrecd * grns.stdcostunit) as extcost + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ',monthname + ORDER BY ' . $orderby; + } elseif ($_POST['SummaryType'] == 'categoryid') { + $sql = "SELECT stockmaster.categoryid, + stockcategory.categorydescription, + SUM(grns.qtyrecd) as quantityord, + SUM(grns.quantityinv) as qtyinvoiced, + SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, + SUM(grns.qtyrecd * grns.stdcostunit) as extcost + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + LEFT JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + GROUP BY " . $_POST['SummaryType'] . + ',categorydescription + ORDER BY ' . $orderby; + } + } + } // End of if ($_POST['ReportType'] + //echo "<br/>$sql<br/>"; + $ErrMsg = _('The SQL to find the parts selected failed with the message'); + $result = DB_query($sql,$db,$ErrMsg); + $ctr = 0; + $totalqty = 0; + $totalextcost = 0; + $totalextprice = 0; + $totalinvqty = 0; + + // Create array for summary type to display in header. Access it with $savesummarytype + $summary_array["orderno"] = _('Order Number'); + $summary_array["itemcode"] = _('Part Number'); + $summary_array["extprice"] = _('Extended Price'); + $summary_array["supplierno"] = _('Customer Number'); + $summary_array["suppname"] = _('Customer Name'); + $summary_array["month"] = _('Month'); + $summary_array["categoryid"] = _('Stock Category'); + + // Create array for sort for detail report to display in header + $detail_array['purchorderdetails.orderno'] = _('Order Number'); + $detail_array['purchorderdetails.itemcode'] = _('Part Number'); + $detail_array['suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Number'); + $detail_array['suppliers.suppname,suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Name'); + + // Display Header info + echo '<table class=selection>'; + if ($_POST['ReportType'] == 'Summary') { + $sortby_display = $summary_array[$savesummarytype]; + } else { + $sortby_display = $detail_array[$_POST['SortBy']]; + } + echo '<tr><th colspan=2><font size=3 color=navy>'._('Header Details').'</font></th></tr>'; + echo '<tr><td>' . _('Purchase Order Report') . '</td><td>' . $_POST['ReportType'] . ' By '.$sortby_display .'</td></tr>'; + echo '<tr><td>' . _('Date Type') . '</td><td>' . $_POST['DateType'] . '</tr>'; + echo '<tr><td>' . _('Date Range') . '</td><td>' . $_POST['FromDate'] . _(' To ') . $_POST['ToDate'] . '</td></tr>'; + if (strlen(trim($PartNumber)) > 0) { + echo '<tr><td>' . _('Part Number') . '</td><td>' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '</td></tr>'; + } + if (strlen(trim($_POST['SupplierId'])) > 0) { + echo '<tr><td>' . _('Supplier Number') . '</td><td>' . $_POST['SupplierIdOp'] . ' ' . $_POST['SupplierId'] . '</td></tr>'; + } + if (strlen(trim($_POST['SupplierName'])) > 0) { + echo '<tr><td>' . _('Supplier Name') . '</td><td>' . $_POST['SupplierNameOp'] . ' ' . $_POST['SupplierName'] . '</td></tr>'; + } + echo '<tr><td>' . _('Line Item Status') . '</td><td>' . $_POST['LineStatus'] . '</tr>'; + echo '<tr><td>' . _('Stock Category') . '</td><td>' . $_POST['Category'] . '</tr></table>'; + + if ($_POST['ReportType'] == 'Detail') { + echo '<br><table class=selection width=98%>'; + if ($_POST['DateType'] == 'Order') { + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%-s</th><th>%s", + _('Order No'), + _('Part Number'), + _('Order Date'), + _('Supplier No'), + _('Supplier Name'), + _('Order Qty'), + _('Extended Cost'), + _('Extended Price'), + _('Invoiced Qty'), + _('Line Status'), + _('Item Due'), + _('Part Description')); + $linectr = 0; + $k = 0; + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + $linectr++; + // Detail for both DateType of Order + printf("<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td> + <td class=number>%s</td><td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", + $myrow['orderno'], + $myrow['itemcode'], + ConvertSQLDate($myrow['orddate']), + $myrow['supplierno'], + $myrow['suppname'], + number_format($myrow['quantityord'],$myrow['decimalplaces']), + number_format($myrow['extcost'],2), + number_format($myrow['extprice'],2), + number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']), + $myrow['linestatus'], + ConvertSQLDate($myrow['deliverydate']), + $myrow['description']); + $lastdecimalplaces = $myrow['decimalplaces']; + $totalqty += $myrow['quantityord']; + $totalextcost += $myrow['extcost']; + $totalextprice += $myrow['extprice']; + $totalinvqty += $myrow['qtyinvoiced']; + } //END WHILE LIST LOOP + // Print totals + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td><td class=number>%s</td> + <td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td></tr>", + 'Totals', + _('Lines - ') . $linectr, + ' ', + ' ', + ' ', + number_format($totalqty,2), + number_format($totalextcost,2), + number_format($totalextprice,2), + number_format($totalinvqty,2), + ' ', + ' '); + } else { + // Header for Date Type of Delivery Date + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", + _('Order No'), + _('Part Number'), + _('Order Date'), + _('Supplier No'), + _('Supplier Name'), + _('Received'), + _('Extended Cost'), + _('Extended Price'), + _('Invoiced Qty'), + _('Line Status'), + _('Delivered'), + _('Part Description')); + $linectr = 0; + $k = 0; + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + $linectr++; + // Detail for both DateType of Ship + // In sql, had to alias grns.qtyrecd as quantityord so could use same name here + printf("<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td><td class=number> + %s</td><td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>", + $myrow['orderno'], + $myrow['itemcode'], + ConvertSQLDate($myrow['orddate']), + $myrow['supplierno'], + $myrow['suppname'], + number_format($myrow['quantityord'],$myrow['decimalplaces']), + number_format($myrow['extcost'],2), + number_format($myrow['extprice'],2), + number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']), + $myrow['linestatus'], + ConvertSQLDate($myrow['deliverydate']), + $myrow['description']); + $lastdecimalplaces = $myrow['decimalplaces']; + $totalqty += $myrow['quantityord']; + $totalextcost += $myrow['extcost']; + $totalextprice += $myrow['extprice']; + $totalinvqty += $myrow['qtyinvoiced']; + } //END WHILE LIST LOOP + // Print totals + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class=number>%s</td><td class=number> + %s</td><td class=number>%s</td><td class=number>%s</td><td>%s</td><td>%s</td></tr>", + 'Totals', + _('Lines - ') . $linectr, + ' ', + ' ', + ' ', + number_format($totalqty,$lastdecimalplaces), + number_format($totalextcost,2), + number_format($totalextprice,2), + number_format($totalinvqty,$lastdecimalplaces), + ' ', + ' '); + } + echo '</table>'; + } else { + // Print summary stuff + echo '<br><table class=selection width=98%>'; + $summarytype = $_POST['SummaryType']; + // For SummaryType 'suppname' had to add supplierid to it for the GROUP BY in the sql, + // but have to take it away for $myrow[$summarytype] to be valid + // Set up description based on the Summary Type + if ($summarytype == 'suppname,suppliers.supplierid') { + $summarytype = 'suppname'; + $description = 'supplierno'; + $summaryheader = _('Supplier Name'); + $descriptionheader = _('Supplier Number'); + } + if ($summarytype == 'itemcode' || $summarytype == 'extprice') { + $description = 'description'; + $summaryheader = _('Part Number'); + $descriptionheader = _('Part Description'); + } + if ($summarytype == 'supplierno') { + $description = 'suppname'; + $summaryheader = _('Supplier Number'); + $descriptionheader = _('Supplier Name'); + } + if ($summarytype == 'orderno') { + $description = 'supplierno'; + $summaryheader = _('Order Number'); + $descriptionheader = _('Supplier Number'); + } + if ($summarytype == 'categoryid') { + $description = 'categorydescription'; + $summaryheader = _('Stock Category'); + $descriptionheader = _('Category Description'); + } + $summarydesc = $summaryheader; + if ($orderby == 'extprice DESC') { + $summarydesc = _('Extended Price'); + } + if ($summarytype == 'month') { + $description = 'monthname'; + $summaryheader = _('Month'); + $descriptionheader = _('Month'); + } + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>", + _($summaryheader), + _($descriptionheader), + _('Quantity'), + _('Extended Cost'), + _('Extended Price'), + _('Invoiced Qty')); + + $suppname = ' '; + $linectr = 0; + $k=0; + while ($myrow = DB_fetch_array($result)) { + $linectr++; + if ($summarytype == 'orderno') { + $suppname = $myrow['suppname']; + } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + printf("<td>%s</td><td>%s</td><td class=number>%s</td><td class=number>%s</td><td class=number>%s</td><td class=number>%s</td></tr>", + $myrow[$summarytype], + $myrow[$description], + $myrow['quantityord'], + number_format($myrow['extcost'],2), + number_format($myrow['extprice'],2), + $myrow['qtyinvoiced'], + $suppname); + $totalqty += $myrow['quantityord']; + $totalextcost += $myrow['extcost']; + $totalextprice += $myrow['extprice']; + $totalinvqty += $myrow['qtyinvoiced']; + } //END WHILE LIST LOOP + // Print totals + printf("<tr><td>%s</td><td>%s</td><td class=number>%s</td><td class=number>%s</td><td class=number>%s</td><td class=number>%s</td></tr>", + 'Totals', + _('Lines - ') . $linectr, + $totalqty, + number_format($totalextcost,2), + number_format($totalextprice,2), + $totalinvqty, + ' '); + } // End of if ($_POST['ReportType'] + echo '</table>'; + echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>"; + echo "<input type=hidden name='ReportType' value=".$_POST['ReportType'].">"; + echo "<input type=hidden name='DateType' value=".$_POST['DateType'].">"; + echo "<input type=hidden name='FromDate' value=".$_POST['FromDate'].">"; + echo "<input type=hidden name='ToDate' value=".$_POST['ToDate'].">"; + echo "<input type=hidden name='PartNumberOp' value=".$_POST['PartNumberOp'].">"; + echo "<input type=hidden name='PartNumber' value=".$_POST['PartNumber'].">"; + echo "<input type=hidden name='SupplierIdOp' value=".$_POST['SupplierIdOp'].">"; + echo "<input type=hidden name='SupplierId' value=".$_POST['SupplierId'].">"; + echo "<input type=hidden name='SupplierNameOp' value=".$_POST['SupplierNameOp'].">"; + echo "<input type=hidden name='SupplierName' value=".$_POST['SupplierName'].">"; + echo "<input type=hidden name='OrderNo' value=".$_POST['OrderNo'].">"; + echo "<input type=hidden name='LineStatus' value=".$_POST['LineStatus'].">"; + echo "<input type=hidden name='Category' value=".$_POST['Category'].">"; + echo "<input type=hidden name='SortBy' value=".$_POST['SortBy'].">"; + echo "<input type=hidden name='SummaryType' value=".$_POST['SummaryType'].">"; + echo "<br><div class=centre><input type='submit' name='submitcsv' value='" . _('Export as csv file') . "'></div></td>"; + echo "</form>"; + } // End of if inputerror != 1 +} // End of function submit() + +//####_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT_SUBMIT#### +function submitcsv(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$SupplierName,$SupplierNameOp,$savesummarytype) +{ + + //initialize no input errors + $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 (!Is_Date($_POST['FromDate'])) { + $InputError = 1; + prnMsg(_('Invalid From Date'),'error'); + } + if (!Is_Date($_POST['ToDate'])) { + $InputError = 1; + prnMsg(_('Invalid To Date'),'error'); + } + + # Add more to WHERE statement, if user entered something for the part number,supplierid, name + $wherepart = ' '; + if (strlen($PartNumber) > 0 && $PartNumberOp == 'LIKE') { + $PartNumber = $PartNumber . '%'; + } else { + $PartNumberOp = '='; + } + if (strlen($PartNumber) > 0) { + $wherepart = " AND purchorderdetails.itemcode " . $PartNumberOp . " '" . $PartNumber . "' "; + } else { + $wherepart=' '; + } + + $wheresupplierid = ' '; + if ($SupplierIdOp == 'LIKE') { + $SupplierId = $SupplierId . '%'; + } else { + $SupplierIdOp = '='; + } + if (strlen($SupplierId) > 0) { + $wheresupplierid = " AND purchorders.supplierno " . $SupplierIdOp . " '" . $SupplierId . "' "; + } else { + $wheresupplierid=' '; + } + + $wheresuppliername = ' '; + if (strlen($SupplierName) > 0 && $SupplierNameOp == 'LIKE') { + $SupplierName = $SupplierName . '%'; + } else { + $SupplierNameOp = '='; + } + if (strlen($SupplierName) > 0) { + $wheresuppliername = " AND suppliers.suppname " . $SupplierNameOp . " '" . $SupplierName . "' "; + } else { + $wheresuppliername=' '; + } + + if (strlen($_POST['OrderNo']) > 0) { + $whereorderno = ' AND purchorderdetails.orderno = ' . " '" . $_POST['OrderNo'] . "' "; + } else { + $whereorderno=' '; + } + + $wherelinestatus = ' '; + # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus'] + #in WHERE clause because the WHERE clause didn't recognize + # that had used the IF statement to create a field called linestatus + if ($_POST['LineStatus'] != 'All') { + if ($_POST['DateType'] == 'Order') { + $wherelinestatus = " AND IF(purchorderdetails.quantityord = purchorderdetails.qtyinvoiced || + purchorderdetails.completed = 1,'Completed','Open') = '" . $_POST['LineStatus'] . "'"; + } else { + $wherelinestatus = " AND IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') = '" + . $_POST['LineStatus'] . "'"; + } + } + + + $wherecategory = ' '; + if ($_POST['Category'] != 'All') { + $wherecategory = " AND stockmaster.categoryid = '" . $_POST['Category'] . "'"; + } + + if ($InputError !=1) { + $fromdate = FormatDateForSQL($_POST['FromDate']); + $todate = FormatDateForSQL($_POST['ToDate']); + if ($_POST['ReportType'] == 'Detail') { + if ($_POST['DateType'] == 'Order') { + $sql = "SELECT purchorderdetails.orderno, + purchorderdetails.itemcode, + purchorderdetails.deliverydate, + purchorders.supplierno, + purchorders.orddate, + purchorderdetails.quantityord, + purchorderdetails.qtyinvoiced, + (purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, + (purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, + IF(purchorderdetails.quantityord = purchorderdetails.qtyinvoiced || + purchorderdetails.completed = 1,'Completed','Open') as linestatus, + suppliers.suppname, + stockmaster.decimalplaces, + stockmaster.description + FROM purchorderdetails + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + WHERE purchorders.orddate >='$fromdate' + AND purchorders.orddate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + ORDER BY " . $_POST['SortBy']; + } else { + // Selects by delivery date from grns + $sql = "SELECT purchorderdetails.orderno, + purchorderdetails.itemcode, + grns.deliverydate, + purchorders.supplierno, + purchorders.orddate, + grns.qtyrecd as quantityord, + grns.quantityinv as qtyinvoiced, + (grns.qtyrecd * purchorderdetails.unitprice) as extprice, + (grns.qtyrecd * grns.stdcostunit) as extcost, + IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') as linestatus, + suppliers.suppname, + stockmaster.decimalplaces, + stockmaster.description + FROM grns + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid + LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid + WHERE grns.deliverydate >='$fromdate' + AND grns.deliverydate <='$todate' + $wherepart + $wheresupplierid + $wheresuppliername + $whereorderno + $wherelinestatus + $wherecategory + ORDER BY " . $_POST['SortBy']; } } else { // sql for Summary report @@ -207,11 +914,11 @@ // summaries, you group and order on the same field; with 'extprice', you are actually // grouping on the stkcode and ordering by extprice descending if ($_POST['SummaryType'] == 'extprice') { - $_POST['SummaryType'] = 'itemcode'; - $orderby = 'extprice DESC'; + $_POST['SummaryType'] = 'itemcode'; + $orderby = 'extprice DESC'; } - if ($_POST['DateType'] == 'Order') { - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { + if ($_POST['DateType'] == 'Order') { + if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { $sql = "SELECT purchorderdetails.itemcode, SUM(purchorderdetails.quantityord) as quantityord, SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, @@ -219,7 +926,7 @@ SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, stockmaster.decimalplaces, stockmaster.description - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -234,7 +941,7 @@ $wherecategory GROUP BY " . $_POST['SummaryType'] . ',stockmaster.decimalplaces, - stockmaster.description + stockmaster.description ORDER BY ' . $orderby; } elseif ($_POST['SummaryType'] == 'orderno') { $sql = "SELECT purchorderdetails.orderno, @@ -244,7 +951,7 @@ SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, suppliers.suppname - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -268,7 +975,7 @@ SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, suppliers.suppname - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -292,7 +999,7 @@ SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced, SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice, SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -315,7 +1022,7 @@ SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost, stockmaster.categoryid, stockcategory.categorydescription - FROM purchorderdetails + FROM purchorderdetails LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -334,7 +1041,7 @@ } } else { // Selects by delivery date from grns - if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { + if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') { $sql = "SELECT purchorderdetails.itemcode, SUM(grns.qtyrecd) as quantityord, SUM(grns.quantityinv) as qtyinvoiced, @@ -342,7 +1049,7 @@ SUM(grns.qtyrecd * grns.stdcostunit) as extcost, stockmaster.description FROM grns - LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -358,7 +1065,7 @@ GROUP BY " . $_POST['SummaryType'] . ', stockmaster.description ORDER BY ' . $orderby; - } elseif ($_POST['SummaryType'] == 'orderno') { + } elseif ($_POST['SummaryType'] == 'orderno') { $sql = "SELECT purchorderdetails.orderno, purchorders.supplierno, SUM(grns.qtyrecd) as quantityord, @@ -367,7 +1074,7 @@ SUM(grns.qtyrecd * grns.stdcostunit) as extcost, suppliers.suppname FROM grns - LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -392,7 +1099,7 @@ SUM(grns.qtyrecd * grns.stdcostunit) as extcost, suppliers.suppname FROM grns - LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -409,7 +1116,7 @@ ', purchorders.supplierno, suppliers.suppname ORDER BY ' . $orderby; - } elseif ($_POST['SummaryType'] == 'month') { + } elseif ($_POST['SummaryType'] == 'month') { $sql = "SELECT EXTRACT(YEAR_MONTH from purchorders.orddate) as month, CONCAT(MONTHNAME(purchorders.orddate),' ',YEAR(purchorders.orddate)) as monthname, SUM(grns.qtyrecd) as quantityord, @@ -417,7 +1124,7 @@ SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, SUM(grns.qtyrecd * grns.stdcostunit) as extcost FROM grns - LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -433,7 +1140,7 @@ GROUP BY " . $_POST['SummaryType'] . ',monthname ORDER BY ' . $orderby; - } elseif ($_POST['SummaryType'] == 'categoryid') { + } elseif ($_POST['SummaryType'] == 'categoryid') { $sql = "SELECT stockmaster.categoryid, stockcategory.categorydescription, SUM(grns.qtyrecd) as quantityord, @@ -441,7 +1148,7 @@ SUM(grns.qtyrecd * purchorderdetails.unitprice) as extprice, SUM(grns.qtyrecd * grns.stdcostunit) as extcost FROM grns - LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem + LEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem LEFT JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno LEFT JOIN suppliers ON purchorders.supplierno = suppliers.supplierid LEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid @@ -457,58 +1164,58 @@ GROUP BY " . $_POST['SummaryType'] . ',categorydescription ORDER BY ' . $orderby; - } + } } } // End of if ($_POST['ReportType'] //echo "<br/>$sql<br/>"; $ErrMsg = _('The SQL to find the parts selected failed with the message'); $result = DB_query($sql,$db,$ErrMsg); $ctr = 0; - echo '<pre>'; $totalqty = 0; $totalextcost = 0; $totalextprice = 0; $totalinvqty = 0; - - // Create array for summary type to display in header. Access it with $savesummarytype - $summary_array["orderno"] = _('Order Number'); - $summary_array["itemcode"] = _('Part Number'); - $summary_array["extprice"] = _('Extended Price'); - $summary_array["supplierno"] = _('Customer Number'); - $summary_array["suppname"] = _('Customer Name'); - $summary_array["month"] = _('Month'); - $summary_array["categoryid"] = _('Stock Category'); + $FileName = $_SESSION['reports_dir'] .'/POReport.csv'; + $FileHandle = fopen($FileName, 'w'); + // Create array for summary type to display in header. Access it with $savesummarytype + $summary_array["orderno"] = _('Order Number'); + $summary_array["itemcode"] = _('Part Number'); + $summary_array["extprice"] = _('Extended Price'); + $summary_array["supplierno"] = _('Customer Number'); + $summary_array["suppname"] = _('Customer Name'); + $summary_array["month"] = _('Month'); + $summary_array["categoryid"] = _('Stock Category'); - // Create array for sort for detail report to display in header - $detail_array['purchorderdetails.orderno'] = _('Order Number'); - $detail_array['purchorderdetails.itemcode'] = _('Part Number'); - $detail_array['suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Number'); - $detail_array['suppliers.suppname,suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Name'); + // Create array for sort for detail report to display in header + $detail_array['purchorderdetails.orderno'] = _('Order Number'); + $detail_array['purchorderdetails.itemcode'] = _('Part Number'); + $detail_array['suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Number'); + $detail_array['suppliers.suppname,suppliers.supplierid,purchorderdetails.orderno'] = _('Supplier Name'); // Display Header info if ($_POST['ReportType'] == 'Summary') { - $sortby_display = $summary_array[$savesummarytype]; + $sortby_display = $summary_array[$savesummarytype]; } else { - $sortby_display = $detail_array[$_POST['SortBy']]; - } echo ' ' . _('Purchase Order Report') . ' - ' . $_POST['ReportType'] . " By $sortby_display <br/>"; - echo ' ' . _('Date Type') . ' - ' . $_POST['DateType'] . '<br/>'; - echo ' ' . _('Date Range') . ' - ' . $_POST['FromDate'] . _(' To ') . $_POST['ToDate'] . '<br/>'; + $sortby_display = $detail_array[$_POST['SortBy']]; + } + fprintf($FileHandle, '"'. _('Purchase Order Report') . '","' . $_POST['ReportType'] . ' '._('By').' '.$sortby_display ."\n"); + fprintf($FileHandle, '"'. _('Date Type') . '","' . $_POST['DateType'] . '"'. "\n"); + fprintf($FileHandle, '"'. _('Date Range') . '","' . $_POST['FromDate'] . _(' To ') . $_POST['ToDate'] . '"'."\n"); if (strlen(trim($PartNumber)) > 0) { - echo ' ' . _('Part Number') . ' - ' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '<br/>'; + fprintf($FileHandle, '"'. _('Part Number') . '","' . $_POST['PartNumberOp'] . ' ' . $_POST['PartNumber'] . '"'."\n"); } if (strlen(trim($_POST['SupplierId'])) > 0) { - echo ' ' . _('Supplier Number') . ' - ' . $_POST['SupplierIdOp'] . ' ' . $_POST['SupplierId'] . '<br/>'; + fprintf($FileHandle, '"'. _('Supplier Number') . '","' . $_POST['SupplierIdOp'] . ' ' . $_POST['SupplierId'] . '"'."\n"); } if (strlen(trim($_POST['SupplierName'])) > 0) { - echo ' ' . _('Supplier Name') . ' - ' . $_POST['SupplierNameOp'] . ' ' . $_POST['SupplierName'] . '<br/>'; + fprintf($FileHandle, '"'. _('Supplier Name') . '","' . $_POST['SupplierNameOp'] . ' ' . $_POST['SupplierName'] . '"'."\n"); } - echo ' ' . _('Line Item Status') . ' - ' . $_POST['LineStatus'] . '<br/>'; - echo ' ' . _('Stock Category') . ' - ' . $_POST['Category'] . '<br/>'; + fprintf($FileHandle, '"'._('Line Item Status') . '","' . $_POST['LineStatus'] . '"'."\n"); + fprintf($FileHandle, '"'. _('Stock Category') . '","' . $_POST['Category'] . '"'."\n"); if ($_POST['ReportType'] == 'Detail') { - echo '<br/><br/>'; - if ($_POST['DateType'] == 'Order') { - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s| %14s | %14s | %14s | %12s | %-10s | %-40s ", + if ($_POST['DateType'] == 'Order') { + fprintf($FileHandle, '"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"'."\n", _('Order No'), _('Part Number'), _('Order Date'), @@ -521,12 +1228,11 @@ _('Line Status'), _('Item Due'), _('Part Description')); - print '<br/><br/>'; $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; - // Detail for both DateType of Order - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s | %14s | %14s | %14s | %12s | %-10s | %-40s ", + // Detail for both DateType of Order + fprintf($FileHandle, '"%s","%s","%s","%s","%s",%s,%s,%s,%s,"%s","%s","%s"'."\n", $myrow['orderno'], $myrow['itemcode'], ConvertSQLDate($myrow['orddate']), @@ -539,7 +1245,6 @@ $myrow['linestatus'], ConvertSQLDate($myrow['deliverydate']), $myrow['description']); - print '<br/>'; $lastdecimalplaces = $myrow['decimalplaces']; $totalqty += $myrow['quantityord']; $totalextcost += $myrow['extcost']; @@ -547,7 +1252,7 @@ $totalinvqty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s | %14s | %14s | %14s | %12s | %-40s ", + fprintf($FileHandle, '"%s","%s","%s","%s","%s",%s,%s,%s,%s,"%s","%s"'."\n", 'Totals', _('Lines - ') . $linectr, ' ', @@ -559,10 +1264,9 @@ number_format($totalinvqty,2), ' ', ' '); - echo '</pre>'; } else { // Header for Date Type of Delivery Date - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s | %-14s | %14s | %14s | %12s | %-10s | %-40s ", + fprintf($FileHandle, '"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"'."\n", _('Order No'), _('Part Number'), _('Order Date'), @@ -574,14 +1278,13 @@ _('Invoiced Qty'), _('Line Status'), _('Delivered'), - _('Part Description')); - print '<br/><br/>'; + _('Part Description')); $linectr = 0; while ($myrow = DB_fetch_array($result)) { $linectr++; // Detail for both DateType of Ship - // In sql, had to alias grns.qtyrecd as quantityord so could use same name here - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s | %14s | %14s | %14s | %12s | %-10s | %-40s ", + // In sql, had to alias grns.qtyrecd as quantityord so could use same name here + fprintf($FileHandle, '"%s","%s","%s","%s","%s",%s,%s,%s,%s,"%s","%s","%s"'."\n", $myrow['orderno'], $myrow['itemcode'], ConvertSQLDate($myrow['orddate']), @@ -594,7 +1297,6 @@ $myrow['linestatus'], ConvertSQLDate($myrow['deliverydate']), $myrow['description']); - print '<br/>'; $lastdecimalplaces = $myrow['decimalplaces']; $totalqty += $myrow['quantityord']; $totalextcost += $myrow['extcost']; @@ -602,7 +1304,7 @@ $totalinvqty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - printf("%10s | %-20s | %10s | %-12s | %-40s | %12s | %14s | %14s | %14s | %12s | %-40s ", + fprintf($FileHandle, '"%s","%s","%s","%s","%s",%s,%s,%s,%s,"%s","%s"'."\n", 'Totals', _('Lines - ') . $linectr, ' ', @@ -612,14 +1314,13 @@ number_format($totalextcost,2), number_format($totalextprice,2), number_format($totalinvqty,$lastdecimalplaces), - ' ', - ' '); - echo '</pre>'; + " ", + " "); } } else { // Print summary stuff $summarytype = $_POST['SummaryType']; - // For SummaryType 'suppname' had to add supplierid to it for the GROUP BY in the sql, + // For SummaryType 'suppname' had to add supplierid to it for the GROUP BY in the sql, // but have to take it away for $myrow[$summarytype] to be valid // Set up description based on the Summary Type if ($summarytype == 'suppname,suppliers.supplierid') { @@ -642,7 +1343,7 @@ $description = 'supplierno'; $summaryheader = _('Order Number'); $descriptionheader = _('Supplier Number'); - } + } if ($summarytype == 'categoryid') { $description = 'categorydescription'; $summaryheader = _('Stock Category'); @@ -657,24 +1358,22 @@ $summaryheader = _('Month'); $descriptionheader = _('Month'); } - echo '<br/><br/>'; - printf(" %-40s | %-40s | %12s | %14s | %14s | %14s", + fprintf($FileHandle, '"%s","%s","%s","%s","%s","%s"'."\n", _($summaryheader), _($descriptionheader), _('Quantity'), _('Extended Cost'), _('Extended Price'), _('Invoiced Qty')); - print '<br/><br/>'; $suppname = ' '; $linectr = 0; while ($myrow = DB_fetch_array($result)) { - $linectr++; + $linectr++; if ($summarytype == 'orderno') { - $suppname = $myrow['suppname']; - } - printf(" %-40s | %-40s | %12s | %14s | %14s | %14s | %-40s", + $suppname = $myrow['suppname']; + } + fprintf($FileHandle, '"%s","%s",%s,%s,%s,%s,"%s"'."\n", $myrow[$summarytype], $myrow[$description], number_format($myrow['quantityord'],$myrow['decimalplaces']), @@ -690,7 +1389,7 @@ $totalinvqty += $myrow['qtyinvoiced']; } //END WHILE LIST LOOP // Print totals - printf(" %-40s | %-40s | %12s | %14s | %14s | %14s", + fprintf($FileHandle, '"%s","%s",%s,%s,%s,%s,"%s"'."\n", 'Totals', _('Lines - ') . $linectr, number_format($totalqty,$lastdecimalplaces), @@ -698,72 +1397,90 @@ number_format($totalextprice,2), number_format($totalinvqty,$lastdecimalplaces), ' '); - echo '</pre>'; } // End of if ($_POST['ReportType'] - - } // End of if inputerror != 1 -} // End of function submit() + fclose($FileHandle); + echo '<div class=centre><p>'._('The report has been exported as a csv file.').'</p>'; + echo '<p><a href="' . $FileName . '">' . _('click here') . '</a> ' . _('to view the file') . '</div></p>'; + } // End of if inputerror != 1 +} // End of function submitcvs() + function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### { // Display form fields. This function is called the first time // the page is called. - echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post><br/><br/>"; + echo "<form action=" . $_SERVER['PHP_SELF'] . "?" . SID ." method=post>"; - echo '<table>'; + echo '<table class=selection>'; - echo '<tr><td>' . _('Report Type') . ':</td>'; - echo "<td><select name='ReportType'>"; + echo '<tr><td>' . _('Report Type') . ':</td>'; + echo "<td><select name='ReportType'>"; echo "<option selected value='Detail'>" . _('Detail'); echo "<option value='Summary'>" . _('Summary'); echo '</select></td><td> </td></tr>'; - echo '<tr><td>' . _('Date Type') . ':</td>'; - echo "<td><select name='DateType'>"; + echo '<tr><td>' . _('Date Type') . ':</td>'; + echo "<td><select name='DateType'>"; echo "<option selected value='Order'>" . _('Order Date'); echo "<option value='Delivery'>" . _('Delivery Date'); echo '</select></td><td> </td></tr>'; - echo '<tr> - <td>' . _('Date Range') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' size=10 maxlength=10 value=" . $_POST['FromDate'] . '></td> - <td>' . _('To') . ":</td> - <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size=10 maxlength=10 value=" . $_POST['ToDate'] . "></td> + echo '<tr> + <td>' . _('Date Range') . ":</td> + <td><input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='FromDate' size=10 maxlength=10 value=" . $_POST['FromDate'] . + '> ' . _('To') . ":   + <input type='Text' class=date alt='".$_SESSION['DefaultDateFormat']."' name='ToDate' size=10 maxlength=10 value=" . $_POST['ToDate'] . "></td> </tr>"; - echo '<tr><td>' . _('Part Number') . ':</td>'; - echo "<td><select name='PartNumberOp'>"; + echo '<tr><td>' . _('Part Number') . ':</td>'; + echo "<td><select name='PartNumberOp'>"; echo "<option selected value='Equals'>" . _('Equals'); echo "<option value='LIKE'>" . _('Begins With'); - echo '</select></td><td> </td>'; - echo "<td><input type='Text' name='PartNumber' size=20 maxlength=20 value=" - . $_POST['PartNumber'] . "></td></tr>"; - - echo '<tr><td>' . _('Supplier Number') . ':</td>'; - echo "<td><select name='SupplierIdOp'>"; + echo '</select>'; + echo "  <input type='Text' name='PartNumber' size=20 maxlength=20 value="; + if (isset($_POST['PartNumber'])) { + echo $_POST['PartNumber'] . "></td></tr>"; + } else { + echo "></td></tr>"; + } + + echo '<tr><td>' . _('Supplier Number') . ':</td>'; + echo "<td><select name='SupplierIdOp'>"; echo "<option selected value='Equals'>" . _('Equals'); echo "<option value='LIKE'>" . _('Begins With'); - echo '</select></td><td> </td>'; - echo "<td><input type='Text' name='SupplierId' size=10 maxlength=10 value=" - . $_POST['SupplierId'] . "></td></tr>"; + echo '</select>'; + echo "  <input type='Text' name='SupplierId' size=10 maxlength=10 value="; + if (isset($_POST['SupplierId'])) { + echo $_POST['SupplierId'] . "></td></tr>"; + } else { + echo "></td></tr>"; + } - echo '<tr><td>' . _('S... [truncated message content] |
From: <tim...@us...> - 2010-09-13 15:03:17
|
Revision: 3734 http://web-erp.svn.sourceforge.net/web-erp/?rev=3734&view=rev Author: tim_schofield Date: 2010-09-13 15:03:10 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Correct the sql quoting, and various layout improvements and bug fixes Modified Paths: -------------- trunk/Prices.php trunk/doc/Change.log.html Modified: trunk/Prices.php =================================================================== --- trunk/Prices.php 2010-09-13 11:35:31 UTC (rev 3733) +++ trunk/Prices.php 2010-09-13 15:03:10 UTC (rev 3734) @@ -29,14 +29,16 @@ $_POST['CurrAbrev'] = $_SESSION['CompanyRecord']['currencydefault']; } +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . + '" alt="">' . '</img>' . $title.'</p>'; echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br>'; -$result = DB_query("SELECT stockmaster.description, - stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='$Item'",$db); +$result = DB_query("SELECT stockmaster.description, + stockmaster.mbflag + FROM stockmaster + WHERE stockmaster.stockid='".$Item."'",$db); $myrow = DB_fetch_row($result); if (DB_num_rows($result)==0){ @@ -52,12 +54,8 @@ exit; } -echo '<br><font color=BLUE size=3><b>' . $Item . ' - ' . $myrow[0] . '</b></font> '; +$PartDescription = $myrow[0]; -echo '<form method="post" action=' . $_SERVER['PHP_SELF'] . '?' . SID . '>'; -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'){ 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; @@ -70,7 +68,7 @@ //first off validate inputs sensible // This gives some date in 1999?? $ZeroDate = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,0,0,0)); - + if (!is_double((double) trim($_POST['Price'])) OR $_POST['Price']=="") { $InputError = 1; prnMsg( _('The price entered must be numeric'),'error'); @@ -79,7 +77,7 @@ $InputError =1; prnMsg (_('The date this price is to take effect from 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; @@ -102,16 +100,16 @@ if (isset($_POST['OldTypeAbbrev']) AND isset($_POST['OldCurrAbrev']) AND strlen($Item)>1 AND $InputError !=1) { /* Need to see if there is also a price entered that has an end date after the start date of this price and if so we will need to update it so there is no ambiguity as to which price will be used*/ - - + + //editing an existing price $sql = "UPDATE prices SET typeabbrev='" . $_POST['TypeAbbrev'] . "', currabrev='" . $_POST['CurrAbrev'] . "', - price=" . $_POST['Price'] . ", + price='" . $_POST['Price'] . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . $SQLEndDate . "' - WHERE prices.stockid='$Item' + WHERE prices.stockid='".$Item."' AND startdate='" .$_POST['OldStartDate'] . "' AND enddate ='" . $_POST['OldEndDate'] . "' AND prices.typeabbrev='" . $_POST['OldTypeAbbrev'] . "' @@ -120,9 +118,9 @@ $ErrMsg = _('Could not be update the existing prices'); $result = DB_query($sql,$db,$ErrMsg); - + ReSequenceEffectiveDates ($Item, $_POST['TypeAbbrev'], $_POST['CurrAbrev'], $db) ; - + prnMsg(_('The price has been updated'),'success'); } elseif ($InputError !=1) { @@ -140,10 +138,10 @@ '" . $_POST['CurrAbrev'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . $SQLEndDate. "', - " . $_POST['Price'] . ")"; + '" . $_POST['Price'] . "')"; $ErrMsg = _('The new price could not be added'); $result = DB_query($sql,$db,$ErrMsg); - + ReSequenceEffectiveDates ($Item, $_POST['TypeAbbrev'], $_POST['CurrAbrev'], $db) ; prnMsg(_('The new price has been inserted'),'success'); } @@ -182,7 +180,7 @@ currencies WHERE prices.currabrev=currencies.currabrev AND prices.typeabbrev = salestypes.typeabbrev - AND prices.stockid='$Item' + AND prices.stockid='".$Item."' AND prices.debtorno='' ORDER BY prices.currabrev, prices.typeabbrev, @@ -190,32 +188,37 @@ $result = DB_query($sql,$db); - echo '<table>'; - echo '<tr><th>' . _('Currency') . - '</th><th>' . _('Sales Type') . + if (DB_num_rows($result) > 0) { + echo '<table class=selection>'; + echo '<tr><th colspan=7><form method="post" action=' . $_SERVER['PHP_SELF'] . '?' . SID . '>'; + echo _('Pricing for part') . ':<input type=text name="Item" MAXSIZEe=22 VALUE="' . $Item . '" maxlength=20><input type=submit name=NewPart Value="' . _('Review Prices') . '">'; + echo '</th></tr></form>'; + + echo '<tr><th>' . _('Currency') . + '</th><th>' . _('Sales Type') . '</th><th>' . _('Price') . '</th><th>' . _('Start Date') . ' </th> <th>' . _('End Date') . '</th></tr>'; - $k=0; //row colour counter + $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - if ($myrow['enddate']=='0000-00-00'){ - $EndDateDisplay = _('No End Date'); - } else { - $EndDateDisplay = ConvertSQLDate($myrow['enddate']); - } - /*Only allow access to modify prices if securiy token 5 is allowed */ - if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + if ($myrow['enddate']=='0000-00-00'){ + $EndDateDisplay = _('No End Date'); + } else { + $EndDateDisplay = ConvertSQLDate($myrow['enddate']); + } + /*Only allow access to modify prices if securiy token 5 is allowed */ + if (in_array(5,$_SESSION['AllowedPageSecurityTokens'])) { - printf("<td>%s</td> + printf("<td>%s</td> <td>%s</td> <td class=number>%0.2f</td> <td>%s</td> @@ -242,28 +245,28 @@ $myrow['currabrev'], $myrow['startdate'], $myrow['enddate']); - } else { - printf("<td>%s</td> - <td>%s</td> - <td class=number>%0.2f</td> - <td>%s</td> - <td>%s</td> - </tr>", - $myrow['currency'], - $myrow['sales_type'], - $myrow['price'], - ConvertSQLDate($myrow['startdate']), - $EndDateDisplay); + } else { + printf("<td>%s</td> + <td>%s</td> + <td class=number>%0.2f</td> + <td>%s</td> + <td>%s</td> + </tr>", + $myrow['currency'], + $myrow['sales_type'], + $myrow['price'], + ConvertSQLDate($myrow['startdate']), + $EndDateDisplay); + } + } - - } - //END WHILE LIST LOOP - echo '</table><p>'; - - if (DB_num_rows($result) == 0) { + //END WHILE LIST LOOP + echo '</table><p>'; + } else { prnMsg(_('There are no prices set up for this part'),'warn'); } + echo '<form method="post" action=' . $_SERVER['PHP_SELF'] . '?' . SID . '>'; if (isset($_GET['Edit'])){ echo '<input type=hidden name="OldTypeAbbrev" VALUE="' . $_GET['TypeAbbrev'] .'">'; echo '<input type=hidden name="OldCurrAbrev" VALUE="' . $_GET['CurrAbrev'] . '">'; @@ -276,14 +279,16 @@ if ($_GET['EndDate']=='' OR $_GET['EndDate']=='0000-00-00'){ $_POST['EndDate'] = ''; } else { - $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']); + $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']); } } $SQL = 'SELECT currabrev, currency FROM currencies'; $result = DB_query($SQL,$db); - echo '<table><tr><td>' . _('Currency') . ':</td><td><select name="CurrAbrev">'; + echo '<br><table class=selection>'; + echo '<tr><th colspan=5><font color=BLUE size=3><b>' . $Item . ' - ' . $PartDescription . '</b></font></th></tr>'; + echo '<tr><td>' . _('Currency') . ':</td><td><select name="CurrAbrev">'; while ($myrow = DB_fetch_array($result)) { if ($myrow['currabrev']==$_POST['CurrAbrev']) { echo '<option selected VALUE="'; @@ -311,19 +316,19 @@ } //end while loop DB_free_result($result); - + if (!isset($_POST['StartDate'])){ $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); } - + if (!isset($_POST['EndDate'])){ - $_POST['EndDate'] = ''; + $_POST['EndDate'] = DateAdd(date($_SESSION['DefaultDateFormat']),'y',1); } echo '<tr><td>' . _('Price Effective From Date') . ':</td> - <td><input type=text name="StartDate" value="' . $_POST['StartDate'] . '"></td></tr>'; + <td><input type="Text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=10 maxlength=10 value="' . $_POST['StartDate'] . '"></td></tr>'; echo '<tr><td>' . _('Price Effective To Date') . ':</td> - <td><input type=text name="EndDate" value="' . $_POST['EndDate'] . '">'; - + <td><input type="Text" class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="EndDate" size=10 maxlength=10 value="' . $_POST['EndDate'] . '"></td></tr>'; + echo '<input type=hidden name=Item value='.$Item.'>'; ?> </select> @@ -339,7 +344,7 @@ </td></tr> </table> - <div class="centre"> + <br><div class="centre"> <input type="Submit" name="submit" value="<?php echo _('Enter') . '/' . _('Amend Price'); ?>"> </div> @@ -351,16 +356,16 @@ function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $db) { - - /*This is quite complicated - the idea is that prices set up should be unique and there is no way two prices could be returned as valid - when getting a price in includes/GetPrice.inc the logic is to first look for a price of the salestype/currency within the effective start and end dates - then if not get the price with a start date prior but a blank end date (the default price). We would not want two prices where one price falls inside another effective date range except in the case of a blank end date - ie no end date - the default price for the currency/salestype. + + /*This is quite complicated - the idea is that prices set up should be unique and there is no way two prices could be returned as valid - when getting a price in includes/GetPrice.inc the logic is to first look for a price of the salestype/currency within the effective start and end dates - then if not get the price with a start date prior but a blank end date (the default price). We would not want two prices where one price falls inside another effective date range except in the case of a blank end date - ie no end date - the default price for the currency/salestype. I first thought that we would need to update the previous default price (blank end date), when a new default price is entered, to have an end date of the startdate of this new default price less 1 day - but this is converting a default price into a special price which could result in having two special prices over the same date range - best to leave it unchanged and use logic in the GetPrice.inc to ensure the correct default price is returned - */ + */ //this is just the case where debtorno='' - see the Prices_Customer.php script for customer special prices - $SQL = "SELECT price, + $SQL = "SELECT price, startdate, - enddate - FROM prices - WHERE debtorno='' + enddate + FROM prices + WHERE debtorno='' AND stockid='" . $Item . "' AND currabrev='" . $CurrAbbrev . "' AND typeabbrev='" . $PriceList . "' @@ -370,7 +375,7 @@ $NextStartDate = Date($_SESSION['DefaultDateFormat']); unset($EndDate); unset($NextStartDate); - while ($myrow = DB_fetch_array($result)){ + while ($myrow = DB_fetch_array($result)){ if (isset($NextStartDate)){ if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']),$NextStartDate)){ $NextStartDate = ConvertSQLDate($myrow['startdate']); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 11:35:31 UTC (rev 3733) +++ trunk/doc/Change.log.html 2010-09-13 15:03:10 UTC (rev 3734) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: POReport.php - Format correctly for screen and add in option to export as a csv file</p> <p>11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various layout improvements</p> <p>11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 15:07:22
|
Revision: 3735 http://web-erp.svn.sourceforge.net/web-erp/?rev=3735&view=rev Author: tim_schofield Date: 2010-09-13 15:07:16 +0000 (Mon, 13 Sep 2010) Log Message: ----------- ChenJohn: ConnectDB_mysql.inc ConnectDB_mysqli.inc fix utf-8 data being encoded/stored incorrectly in db server Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 15:03:10 UTC (rev 3734) +++ trunk/doc/Change.log.html 2010-09-13 15:07:16 UTC (rev 3735) @@ -12,6 +12,7 @@ <p>10/09/10 Tim: PO_AuthoriseMyOrders.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PO_AuthorisationLevels.php - Layout improvements, and sql quoting corrections</p> <p>10/09/10 Tim: PeriodsInquiry.php - Layout improvements</p> +<p>10/09/10 ChenJohn: ConnectDB_mysql.inc ConnectDB_mysqli.inc fix utf-8 data being encoded/stored incorrectly in db server</p> <p>08/09/10 Tim: PDFTopItems.php - Correct the sql quoting</p> <p>08/09/10 Tim: PDFSuppTransListing.php - Screen layout improvements. Correct the sql quoting</p> <p>08/09/10 Tim: PDFStockTransfer.php - Correct the sql quoting</p> Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2010-09-13 15:03:10 UTC (rev 3734) +++ trunk/includes/ConnectDB_mysql.inc 2010-09-13 15:07:16 UTC (rev 3735) @@ -7,6 +7,18 @@ global $db; // Make sure it IS global, regardless of our context $db = mysql_connect($host.':'.$mysqlport , $dbuser, $dbpassword); +//printf("tried making mysql Connection.\n"); +//$varabc = mysql_client_encoding($db); +//printf("client encoding is %s\n", $varabc); + +//this statement sets the charset to be used for sending data to and from the db server +//if not set, both mysql server and mysql client/library may assume otherwise +mysql_set_charset("utf8", $db); + +//$varabc = mysql_client_encoding($db); +//printf("client encoding is %s\n", $varabc); + + if ( !$db ) { echo '<BR>' . _('The configuration in the file config.php for the database user name and password do not provide the information required to connect to the database server'); exit; Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2010-09-13 15:03:10 UTC (rev 3734) +++ trunk/includes/ConnectDB_mysqli.inc 2010-09-13 15:07:16 UTC (rev 3735) @@ -12,6 +12,18 @@ global $db; // Make sure it IS global, regardless of our context $db = mysqli_connect($host , $dbuser, $dbpassword,$_SESSION['DatabaseName'], $mysqlport); +//printf("tried making mysql-i Connection.\n"); +//$varabc = mysqli_client_encoding($db); +//printf("client encoding is %s\n", $varabc); + +//this statement sets the charset to be used for sending data to and from the db server +//if not set, both mysqli server and mysqli client/library may assume otherwise +mysqli_set_charset($db, "utf8"); + +//$varabc = mysqli_client_encoding($db); +//printf("client encoding is %s\n", $varabc); + + /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 15:18:32
|
Revision: 3736 http://web-erp.svn.sourceforge.net/web-erp/?rev=3736&view=rev Author: tim_schofield Date: 2010-09-13 15:18:25 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Otandeka: PDFPriceList.php - Corrected undefined offset error Modified Paths: -------------- trunk/DailySalesInquiry.php trunk/PDFPriceList.php trunk/doc/Change.log.html trunk/includes/MiscFunctions.php Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2010-09-13 15:07:16 UTC (rev 3735) +++ trunk/DailySalesInquiry.php 2010-09-13 15:18:25 UTC (rev 3736) @@ -8,6 +8,7 @@ include('includes/session.inc'); $title = _('Daily Sales Inquiry'); include('includes/header.inc'); +include('includes/DefineCartClass.php'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="">' . ' ' . _('Daily Sales') . '</p>'; echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div><br>'; @@ -88,9 +89,8 @@ } $sql .= " GROUP BY stockmoves.trandate ORDER BY stockmoves.trandate"; - $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); -$SalesResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); +$SalesResult = DB_query($sql, $db,$ErrMsg); echo '<table cellpadding=2>'; @@ -104,11 +104,18 @@ <th>' . _('Saturday') . '</th></tr>'; $CumulativeTotalSales = 0; +$CumulativeTotalCost = 0; $BilledDays = 0; $DaySalesArray = array(); while ($DaySalesRow=DB_fetch_array($SalesResult)) { + if (isset($DaySalesRow['salesvalue'])) { $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->Sales = $DaySalesRow['salesvalue']; + } + if ($DaySalesRow['salesvalue'] > 0 ) { $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->GPPercent = ($DaySalesRow['salesvalue']-$DaySalesRow['cost'])/$DaySalesRow['salesvalue']; + } else { + $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->GPPercent = 0; + } $BilledDays++; $CumulativeTotalSales += $DaySalesRow['salesvalue']; $CumulativeTotalCost += $DaySalesRow['cost']; @@ -131,14 +138,15 @@ } $LastDayOfMonth = DayOfMonthFromSQLDate($EndDateSQL); - for ($i=1;$i<=$LastDayOfMonth;$i++){ - echo '<td class="number">' . number_format($DaySalesArray[$i]->Sales,0) . '<br />' . number_format($DaySalesArray[$i]->GPPercent*100,1) . '%</td>'; $ColumnCounter++; + if(isset($DaySalesArray[$i])) { + echo '<td class="number">' . number_format($DaySalesArray[$i]->Sales,0) . '<br />' . number_format($DaySalesArray[$i]->GPPercent*100,1) . '</td>'; + } if ($ColumnCounter==7){ echo '</tr><tr>'; for ($j=1;$j<=7;$j++){ - echo '<th>' . $DayNumber . '</th>'; + echo '<th>' . $DayNumber. '</th>'; $DayNumber++; if($DayNumber>$LastDayOfMonth){ break; @@ -147,6 +155,8 @@ echo '</tr><tr>'; $ColumnCounter=0; } + + } if ($ColumnCounter!=0) { echo '</tr><tr>'; @@ -165,4 +175,4 @@ echo '</table>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/PDFPriceList.php =================================================================== --- trunk/PDFPriceList.php 2010-09-13 15:07:16 UTC (rev 3735) +++ trunk/PDFPriceList.php 2010-09-13 15:18:25 UTC (rev 3736) @@ -238,6 +238,7 @@ /*Print out the category totals */ $FileName=$_SESSION['DatabaseName']. '_' . _('Price_List') . '_' . date('Y-m-d').'.pdf'; + ob_clean(); $pdf->OutputD($FileName); $pdf->__destruct(); @@ -366,4 +367,4 @@ $PageNumber++; } -?> \ No newline at end of file +?> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 15:07:16 UTC (rev 3735) +++ trunk/doc/Change.log.html 2010-09-13 15:18:25 UTC (rev 3736) @@ -5,6 +5,7 @@ <p>11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various layout improvements</p> <p>11/09/10 Tim: PO_SelectOSPurchOrder.php - Correct the sql quoting</p> <p>11/09/10 Tim: PO_PDFPurchOrder.php - Correct the sql quoting</p> +<p>11/09/10 Otandeka: PDFPriceList.php - Corrected undefined offset error </p> <p>11/09/10 Phil: Manual changes - for utf-8 - language and PDFlanguage selection, also the installer and the new CounterSales.php script</p> <p>10/09/10 Tim: PO_OrderDetails.php - Layout improvements, links to SelectSuppliers.php and sql quoting corrections</p> <p>10/09/10 Tim: PO_Items.php - Layout improvements, and sql quoting corrections</p> Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2010-09-13 15:07:16 UTC (rev 3735) +++ trunk/includes/MiscFunctions.php 2010-09-13 15:18:25 UTC (rev 3736) @@ -315,6 +315,7 @@ } function http_file_exists($url) { + return false; $f=@fopen($url,"r"); if($f) { fclose($f); @@ -323,4 +324,4 @@ return false; } -?> \ 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-09-13 16:30:08
|
Revision: 3737 http://web-erp.svn.sourceforge.net/web-erp/?rev=3737&view=rev Author: tim_schofield Date: 2010-09-13 16:30:01 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Correct the sql quoting, and various layout improvements and bug fixes Modified Paths: -------------- trunk/Prices_Customer.php trunk/doc/Change.log.html Modified: trunk/Prices_Customer.php =================================================================== --- trunk/Prices_Customer.php 2010-09-13 15:18:25 UTC (rev 3736) +++ trunk/Prices_Customer.php 2010-09-13 16:30:01 UTC (rev 3737) @@ -5,8 +5,17 @@ include('includes/session.inc'); -$title = _('Special Prices for') . ' '. $_SESSION['CustomerID']; +$result = DB_query("SELECT debtorsmaster.name, + debtorsmaster.currcode, + debtorsmaster.salestype + FROM + debtorsmaster + WHERE + debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); +$myrow = DB_fetch_row($result); +$title = _('Special Prices for') . ' '. $myrow[0]; + include('includes/header.inc'); if (isset($_GET['Item'])){ @@ -17,8 +26,9 @@ if (!isset($Item) OR !isset($_SESSION['CustomerID']) OR $_SESSION['CustomerID']==""){ - echo '<br><hr>'; - prnMsg( _('A customer must be selected from the customer selection screen') . ', ' . _('then an item must be selected before this page is called') . '. ' . _('The product selection page should call this page with a valid product code'),'info'); + prnMsg( _('A customer must be selected from the customer selection screen') . ', ' + . _('then an item must be selected before this page is called') . '. ' + . _('The product selection page should call this page with a valid product code'),'info'); echo '<hr>'; include('includes/footer.inc'); exit; @@ -32,14 +42,16 @@ WHERE debtorsmaster.debtorno='" . $_SESSION['CustomerID'] . "'",$db); $myrow = DB_fetch_row($result); +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . + '" alt="">' . '</img>' . _('Special Customer Prices').'<br>'; echo '<font color=BLUE><b>' . $myrow[0] . ' ' . _('in') . ' ' . $myrow[1] . '<br>' . ' ' . _('for') . ' '; $CurrCode = $myrow[1]; $SalesType = $myrow[2]; -$result = DB_query("SELECT stockmaster.description, +$result = DB_query("SELECT stockmaster.description, stockmaster.mbflag - FROM stockmaster + FROM stockmaster WHERE stockmaster.stockid='" . $Item . "'",$db); $myrow = DB_fetch_row($result); @@ -52,7 +64,7 @@ exit; } -echo $Item . ' - ' . $myrow[0] . '</b></font><hr>'; +echo $Item . ' - ' . $myrow[0] . '</b></font></p>'; if (isset($_POST['submit'])) { @@ -81,7 +93,7 @@ $msg = _('The branch code entered is not currently defined'); } } - + if (! Is_Date($_POST['StartDate'])){ $InputError =1; $msg = _('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat']; @@ -98,14 +110,14 @@ $InputError =1; $msg = _('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!'); } - + if ((isset($_POST['Editing']) and $_POST['Editing']=='Yes') AND strlen($Item)>1 AND $InputError !=1) { //editing an existing price $sql = "UPDATE prices SET typeabbrev='" . $SalesType . "', currabrev='" . $CurrCode . "', - price=" . $_POST['Price'] . ", + price='" . $_POST['Price'] . "', branchcode='" . $_POST['Branch'] . "', startdate='" . FormatDateForSQL($_POST['StartDate']) . "', enddate='" . FormatDateForSQL($_POST['EndDate']) . "' @@ -115,7 +127,7 @@ AND prices.startdate='" . $_POST['OldStartDate'] . "' AND prices.enddate='" . $_POST['OldEndDate'] . "' AND prices.debtorno='" . $_SESSION['CustomerID'] . "'"; - + $msg = _('Price Updated'); } elseif ($InputError !=1) { @@ -128,11 +140,11 @@ branchcode, startdate, enddate) - VALUES ('$Item', - '$SalesType', - '$CurrCode', + VALUES ('".$Item."', + '".$SalesType."', + '".$CurrCode."', '" . $_SESSION['CustomerID'] . "', - " . $_POST['Price'] . ", + '" . $_POST['Price'] . "', '" . $_POST['Branch'] . "', '" . FormatDateForSQL($_POST['StartDate']) . "', '" . FormatDateForSQL($_POST['EndDate']) . "' @@ -169,7 +181,7 @@ AND prices.branchcode='" . $_GET['Branch'] . "' AND prices.startdate='" . $_GET['StartDate'] . "' AND prices.enddate='" . $_GET['EndDate'] . "'"; - + $result = DB_query($sql,$db); prnMsg( _('This price has been deleted') . '!','success'); } @@ -191,13 +203,13 @@ ORDER BY currabrev, typeabbrev, startdate"; - + $ErrMsg = _('Could not retrieve the normal prices set up because'); $DbgMsg = _('The SQL used to retrieve these records was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); -echo '<table border=1><tr><td valign=top>'; -echo '<table>'; +echo '<table><tr><td valign=top>'; +echo '<table class=selection>'; if (DB_num_rows($result) == 0) { echo '<tr><td>' . _('There are no default prices set up for this part') . '</td></tr>'; @@ -212,14 +224,14 @@ printf('<tr class="EvenTableRows"> <td class=number>%0.2f</td> <td class=date>%s</td> - <td class=date>%s</td></tr>', + <td class=date>%s</td></tr>', $myrow['price'], ConvertSQLDate($myrow['startdate']), $EndDateDisplay); } } -echo '</table></td><td VALIGN=TOp>'; +echo '</table></td><td valign=top>'; //now get the prices for the customer selected @@ -229,10 +241,10 @@ prices.startdate, prices.enddate FROM prices LEFT JOIN custbranch ON prices.branchcode= custbranch.branchcode - WHERE prices.typeabbrev = '$SalesType' - AND prices.stockid='$Item' + WHERE prices.typeabbrev = '".$SalesType."' + AND prices.stockid='".$Item."' AND prices.debtorno='" . $_SESSION['CustomerID'] . "' - AND prices.currabrev='$CurrCode' + AND prices.currabrev='".$CurrCode."' AND (custbranch.debtorno='" . $_SESSION['CustomerID'] . "' OR custbranch.debtorno IS NULL) ORDER BY prices.branchcode, @@ -242,7 +254,7 @@ $DbgMsg = _('The SQL used to retrieve these records was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); -echo '<table>'; +echo '<table class=selection>'; if (DB_num_rows($result) == 0) { echo '<tr><td>' . _('There are no special prices set up for this part') . '</td></tr>'; @@ -312,73 +324,88 @@ $_POST['EndDate']=''; } } - if (!isset($_POST['Branch'])) { $_POST['Branch']=''; } if (!isset($_POST['Price'])) { $_POST['Price']=0; } - + if (!isset($_POST['StartDate'])){ $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); } - + if (!isset($_POST['EndDate'])){ - $_POST['EndDate'] = ''; + $_POST['EndDate'] = DateAdd(Date($_SESSION['DefaultDateFormat']), 'y', 1); } - - echo '<table><tr><td>' . _('Branch') . ':</td> - <td><input type="Text" name="Branch" size=11 maxlength=10 value=' . $_POST['Branch'] . '></td></tr>'; + $sql = "SELECT + branchcode, + brname + FROM custbranch + WHERE debtorno='".$_SESSION['CustomerID'] ."'"; + $result = DB_query($sql, $db); + echo '<table class=selection>'; + echo '<tr><td>' . _('Branch') . ':</td>'; + echo '<td><select name="Branch"'; + while ($myrow=DB_fetch_array($result)) { + if ($myrow['branchcode']==$_POST['branch']) { + echo '<option selected value='.$myrow['branchcode'].'>'.$myrow['brname'].'</option>'; + } else { + echo '<option value='.$myrow['branchcode'].'>'.$myrow['brname'].'</option>'; + } + } + echo '></td></tr>'; echo '<tr><td>' . _('Start Date') . ':</td> - <td><input type="Text" name="StartDate" size=11 maxlength=10 value=' . $_POST['StartDate'] . '></td></tr>'; + <td><input type="Text" name="StartDate" class=date alt='.$_SESSION['DefaultDateFormat']. + ' size=11 maxlength=10 value=' . $_POST['StartDate'] . '></td></tr>'; echo '<tr><td>' . _('End Date') . ':</td> - <td><input type="Text" name="EndDate" size=11 maxlength=10 value=' . $_POST['EndDate'] . '></td></tr>'; - + <td><input type="Text" name="EndDate" class=date alt='.$_SESSION['DefaultDateFormat']. + ' size=11 maxlength=10 value=' . $_POST['EndDate'] . '></td></tr>'; + echo '<tr><td>' . _('Price') . ':</td> <td><input type="Text" class=number name="Price" size=11 maxlength=10 value=' . $_POST['Price'] . '></td> </tr></table>'; - - - echo '<div class="centre"><input type="Submit" name="submit" VALUE="' . _('Enter Information') . '"></div>'; + + echo '<br><div class="centre"><input type="Submit" name="submit" VALUE="' . _('Enter Information') . '"></div>'; + echo '</form>'; include('includes/footer.inc'); - + function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $CustomerID, $db) { - + /*This is quite complicated - the idea is that prices set up should be unique and there is no way two prices could be returned as valid - when getting a price in includes/GetPrice.inc the logic is to first look for a price of the salestype/currency within the effective start and end dates - then if not get the price with a start date prior but a blank end date (the default price). We would not want two prices where the effective dates fall between an existing price so it is necessary to update enddates of prices - with me - I am just hanging on here myself - + Prices with no end date are default prices and need to be ignored in this resquence*/ - - $SQL = "SELECT branchcode, + + $SQL = "SELECT branchcode, startdate, - enddate - FROM prices - WHERE debtorno='" . $CustomerID . "' + enddate + FROM prices + WHERE debtorno='" . $CustomerID . "' AND stockid='" . $Item . "' AND currabrev='" . $CurrAbbrev . "' AND typeabbrev='" . $PriceList . "' AND enddate<>'' - ORDER BY - branchcode, - startdate, + ORDER BY + branchcode, + startdate, enddate"; - + $result = DB_query($SQL,$db); - + unset($BranchCode); - + while ($myrow = DB_fetch_array($result)){ - if ($BranchCode != $myrow['branchcode']){ + if (!isset($BranchCode)){ unset($NextDefaultStartDate); //a price with a blank end date unset($NextStartDate); unset($EndDate); unset($StartDate); $BranchCode = $myrow['branchcode']; } - if (isset($NextStartDate)){ + if (isset($NextStartDate)){ if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']),$NextStartDate)){ $NextStartDate = ConvertSQLDate($myrow['startdate']); if (Date1GreaterThanDate2(ConvertSQLDate($EndDate),ConvertSQLDate($myrow['startdate']))) { Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 15:18:25 UTC (rev 3736) +++ trunk/doc/Change.log.html 2010-09-13 16:30:01 UTC (rev 3737) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: POReport.php - Format correctly for screen and add in option to export as a csv file</p> <p>11/09/10 Tim: PO_SelectPurchOrder.php - Correct the sql quoting, and various 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-09-13 17:26:38
|
Revision: 3738 http://web-erp.svn.sourceforge.net/web-erp/?rev=3738&view=rev Author: tim_schofield Date: 2010-09-13 17:26:31 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Correct the sql quoting, and various layout improvements and bug fixes Modified Paths: -------------- trunk/PricesBasedOnMarkUp.php trunk/doc/Change.log.html Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2010-09-13 16:30:01 UTC (rev 3737) +++ trunk/PricesBasedOnMarkUp.php 2010-09-13 17:26:31 UTC (rev 3738) @@ -8,6 +8,9 @@ $title=_('Update Pricing From Costs'); include('includes/header.inc'); +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . + '" alt="">' . '</img>' . $title.'</p>'; + echo '<br><div class="page_help_text">' . _('This page adds new prices or updates already existing prices for a specified sales type (price list) and currency for the stock category selected - based on a percentage mark up from cost prices or from preferred supplier cost data. The rounding factor ensures that prices are at least this amount or a multiple of it. A rounding factor of 1000 would mean that prices would be a minimum of 1000 and other prices would be expressed as multiples of 1000.') . '</div><br><div class="centre">'; echo "<form method='POST' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; @@ -16,7 +19,7 @@ $PricesResult = DB_query($SQL,$db); -echo '<p><table> +echo '<p><table class=selection> <tr> <td>' . _('Select the Price List to update') .':</td> <td><select name="PriceList">'; @@ -26,7 +29,7 @@ } while ($PriceLists=DB_fetch_array($PricesResult)){ - if ($_POST['PriceList']==$PriceLists['typeabbrev']){ + if (isset($_POST['PriceList']) and $_POST['PriceList']==$PriceLists['typeabbrev']){ echo "<option selected value='" . $PriceLists['typeabbrev'] . "'>" . $PriceLists['sales_type'] . '</option>'; } else { echo "<option value='" . $PriceLists['typeabbrev'] . "'>" . $PriceLists['sales_type'] . '</option>'; @@ -48,7 +51,7 @@ } while ($Currencies=DB_fetch_array($result)){ - if ($Currencies['currabrev']==$_POST['CurrCode']){ + if (isset($_POST['CurrCode']) and $_POST['CurrCode']==$Currencies['currabrev']) { echo '<option selected value="' . $Currencies['currabrev'] . '">' . $Currencies['currency'] . '</option>'; } else { echo '<option value="' . $Currencies['currabrev'] . '">' . $Currencies['currency'] . '</option>'; @@ -82,7 +85,7 @@ DB_data_seek($PricesResult,0); -if ($_POST['CostType']=='OtherPriceList'){ +if (isset($_POST['CostType']) and $_POST['CostType']=='OtherPriceList'){ echo '<tr><td>' . _('Select the Base Price List to Use') . ':</td> <td><select name="BasePriceList">'; @@ -90,7 +93,7 @@ echo '<option selected VALUE=0>' . _('No Price List Selected'); } while ($PriceLists=DB_fetch_array($PricesResult)){ - if ($_POST['BasePriceList']==$PriceLists['typeabbrev']){ + if (isset($_POST['BasePriceList']) and $_POST['BasePriceList']==$PriceLists['typeabbrev']){ echo "<option selected value='" . $PriceLists['typeabbrev'] . "'>" . $PriceLists['sales_type'] . '</option>'; } else { echo "<option value='" . $PriceLists['typeabbrev'] . "'>" . $PriceLists['sales_type'] . '</option>'; @@ -109,7 +112,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); while ($myrow=DB_fetch_array($result)){ - if ($myrow['categoryid']==$_POST['StkCatFrom']){ + if (isset($_POST['StkCatFrom']) and $myrow['categoryid']==$_POST['StkCatFrom']){ echo "<option selected VALUE='". $myrow['categoryid'] . "'>" . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; } else { echo "<option VALUE='". $myrow['categoryid'] . "'>" . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; @@ -123,7 +126,7 @@ <td><select name="StkCatTo">'; while ($myrow=DB_fetch_array($result)){ - if ($myrow['categoryid']==$_POST['StkCatTo']){ + if (isset($_POST['StkCatFrom']) and $myrow['categoryid']==$_POST['StkCatTo']){ echo "<option selected VALUE='". $myrow['categoryid'] . "'>" . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; } else { echo "<option VALUE='". $myrow['categoryid'] . "'>" . $myrow['categoryid'] . ' - ' . $myrow['categorydescription']; @@ -135,6 +138,14 @@ $_POST['RoundingFactor']=1; } +if (!isset($_POST['PriceStartDate'])) { + $_POST['PriceStartDate']=DateAdd(date($_SESSION['DefaultDateFormat']),'d',1); +} + +if (!isset($_POST['PriceEndDate'])) { + $_POST['PriceEndDate']=DateAdd(date($_SESSION['DefaultDateFormat']), 'y', 1); +} + echo '<tr><td>' . _('Rounding Factor') . ':</td> <td><input type=text class=number name="RoundingFactor" size="6" maxlength="6" value=' . $_POST['RoundingFactor'] . '></td></tr>'; @@ -166,7 +177,7 @@ prnMsg(_('No price list currency is selected to update. No updates will take place'),'error'); $InputError =1; } - + if (! Is_Date($_POST['PriceEndDate']) AND $_POST['PriceEndDate']!=''){ $InputError =1; prnMsg (_('The date the new price is to be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); @@ -182,7 +193,7 @@ if (Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']),$_POST['PriceStartDate'])){ $InputError =1; prnMsg(_('The date this new price is to start from is expected to be after today'),'error'); - } + } if ($_POST['StkCatTo']<$_POST['StkCatFrom']){ prnMsg(_('The stock category from must be before the stock category to - there would be not items in the range to update'),'error'); $InputError =1; @@ -196,7 +207,7 @@ prnMsg(_('When you are updating prices based on another price list - the other price list cannot be the same as the price list being used for the calculation. No updates will take place until the other price list selected is different from the price list to be updated' ),'error'); $InputError =1; } - + if ($InputError==0) { prnMsg(_('For a log of all the prices changed this page should be printed with CTRL+P'),'info'); echo '<br>' . _('So we are using a price list/sales type of') .' : ' . $_POST['PriceList']; @@ -204,7 +215,7 @@ echo '<br>' . _('and the stock category range from') . ' : ' . $_POST['StkCatFrom'] . ' ' . _('to') . ' ' . $_POST['StkCatTo']; echo '<br>' . _('and we are applying a markup percent of') . ' : ' . $_POST['IncreasePercent']; echo '<br>' . _('against') . ' '; - + if ($_POST['CostType']=='PreferredSupplier'){ echo _('Preferred Supplier Cost Data'); } elseif ($_POST['CostType']=='OtherPriceList') { @@ -212,7 +223,7 @@ } else { echo $CostingBasis; } - + if ($_POST['PriceList']=='0'){ echo '<br>' . _('The price list/sales type to be updated must be selected first'); include ('includes/footer.inc'); @@ -227,22 +238,22 @@ $SQLEndDate = FormatDateForSQL($_POST['PriceEndDate']); } else { $SQLEndDate = '0000-00-00'; - } + } $sql = "SELECT stockid, materialcost+labourcost+overheadcost AS cost FROM stockmaster WHERE categoryid>='" . $_POST['StkCatFrom'] . "' AND categoryid <='" . $_POST['StkCatTo'] . "'"; $PartsResult = DB_query($sql,$db); - + $IncrementPercentage = $_POST['IncreasePercent']/100; - + $CurrenciesResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_POST['CurrCode'] . "'",$db); $CurrencyRow = DB_fetch_row($CurrenciesResult); $CurrencyRate = $CurrencyRow[0]; - + while ($myrow=DB_fetch_array($PartsResult)){ - + //Figure out the cost to use if ($_POST['CostType']=='PreferredSupplier'){ $sql = "SELECT purchdata.price/purchdata.conversionfactor/currencies.rate AS cost @@ -266,8 +277,8 @@ } elseif ($_POST['CostType']=='OtherPriceList'){ $sql = "SELECT price FROM prices - WHERE typeabbrev= '" . $_POST['BasePriceList'] . "' - AND currabrev='" . $_POST['CurrCode'] . "' + WHERE typeabbrev= '" . $_POST['BasePriceList'] . "' + AND currabrev='" . $_POST['CurrCode'] . "' AND debtorno='' AND enddate='0000-00-00' AND stockid='" . $myrow['stockid'] . "' @@ -287,7 +298,7 @@ prnMsg(_('The cost for this item is not set up or is set up as less than or equal to zero - no price changes will be made based on zero cost items. The item concerned is:') . ' ' . $myrow['stockid'],'warn'); } } - + if ($_POST['CostType']!='OtherPriceList'){ $RoundedPrice = round(($Cost * (1+ $IncrementPercentage) * $CurrencyRate+($_POST['RoundingFactor']/2))/$_POST['RoundingFactor']) * $_POST['RoundingFactor']; if ($RoundedPrice <=0){ @@ -299,23 +310,23 @@ $RoundedPrice = $_POST['RoundingFactor']; } } - + if ($Cost > 0) { $CurrentPriceResult = DB_query("SELECT price FROM prices WHERE typeabbrev= '" . $_POST['PriceList'] . "' - AND debtorno ='' + AND debtorno ='' AND currabrev='" . $_POST['CurrCode'] . "' AND enddate='" . $SQLEndDate . "' AND startdate='" . FormatDateForSQL($_POST['PriceStartDate']) . "' AND stockid='" . $myrow['stockid'] . "'",$db); if (DB_num_rows($CurrentPriceResult)==1){ - $sql = 'UPDATE prices SET price=' . $RoundedPrice . " + $sql = "UPDATE prices SET price='" . $RoundedPrice . "' WHERE typeabbrev='" . $_POST['PriceList'] . "' AND currabrev='" . $_POST['CurrCode'] . "' AND debtorno='' AND startdate ='" . FormatDateForSQL($_POST['PriceStartDate']) . "' - AND enddate ='" . $SQLEndDate . "' + AND enddate ='" . $SQLEndDate . "' AND stockid='" . $myrow['stockid'] . "'"; $ErrMsg =_('Error updating prices for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($sql,$db,$ErrMsg); @@ -332,7 +343,7 @@ '" . $_POST['CurrCode'] . "', '" . FormatDateForSQL($_POST['PriceStartDate']) . "', '" . $SQLEndDate . "', - " . $RoundedPrice . ")"; + '" . $RoundedPrice . "')"; $ErrMsg =_('Error inserting prices for') . ' ' . $myrow['stockid'] . ' ' . _('because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('to') . ' ' . $RoundedPrice,'info'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 16:30:01 UTC (rev 3737) +++ trunk/doc/Change.log.html 2010-09-13 17:26:31 UTC (rev 3738) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: POReport.php - Format correctly for screen and add in option to export as a csv file</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 17:45:35
|
Revision: 3739 http://web-erp.svn.sourceforge.net/web-erp/?rev=3739&view=rev Author: tim_schofield Date: 2010-09-13 17:45:29 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Correct the sql quoting Modified Paths: -------------- trunk/PrintCustOrder.php trunk/doc/Change.log.html Modified: trunk/PrintCustOrder.php =================================================================== --- trunk/PrintCustOrder.php 2010-09-13 17:26:31 UTC (rev 3738) +++ trunk/PrintCustOrder.php 2010-09-13 17:45:29 UTC (rev 3739) @@ -54,7 +54,7 @@ ON salesorders.shipvia=shippers.shipper_id INNER JOIN locations ON salesorders.fromstkloc=locations.loccode - WHERE salesorders.orderno=" . $_GET['TransNo']; + WHERE salesorders.orderno='" . $_GET['TransNo']. "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -115,7 +115,7 @@ salesorderdetails.unitprice FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno=" . $_GET['TransNo']; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql, $db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -188,7 +188,7 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Customer_Order_' . $_GET['TransNo'] . '_' . Date('Y-m-d') .'.pdf'); $pdf-> __destruct(); - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" .$_GET['TransNo']; + $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } else { $title = _('Print Packing Slip Error'); @@ -199,4 +199,4 @@ include('includes/footer.inc'); exit; } /*end if there are order details to show on the order*/ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 17:26:31 UTC (rev 3738) +++ trunk/doc/Change.log.html 2010-09-13 17:45:29 UTC (rev 3739) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting</p> <p>13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices.php - Correct the sql quoting, and various layout improvements and bug fixes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 17:50:25
|
Revision: 3740 http://web-erp.svn.sourceforge.net/web-erp/?rev=3740&view=rev Author: tim_schofield Date: 2010-09-13 17:50:19 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Correct the sql quoting Modified Paths: -------------- trunk/PrintCustOrder_generic.php trunk/doc/Change.log.html Modified: trunk/PrintCustOrder_generic.php =================================================================== --- trunk/PrintCustOrder_generic.php 2010-09-13 17:45:29 UTC (rev 3739) +++ trunk/PrintCustOrder_generic.php 2010-09-13 17:50:19 UTC (rev 3740) @@ -56,7 +56,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno=" . $_GET['TransNo']; + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -125,15 +125,15 @@ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); - $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, + $sql = "SELECT salesorderdetails.stkcode, + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, salesorderdetails.unitprice, salesorderdetails.narrative FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno=" . $_GET['TransNo']; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -195,8 +195,8 @@ */ $pdf->OutputD($_SESSION['DatabaseName'] . '_PackingSlip_' . date('Y-m-d') . '.pdf');//UldisN $pdf->__destruct(); //UldisN - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" .$_GET['TransNo']; + $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 17:45:29 UTC (rev 3739) +++ trunk/doc/Change.log.html 2010-09-13 17:50:19 UTC (rev 3740) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting</p> <p>13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting</p> <p>13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes</p> <p>13/09/10 Tim: Prices_Customer.php - Correct the sql quoting, and various layout improvements and bug fixes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 18:11:30
|
Revision: 3741 http://web-erp.svn.sourceforge.net/web-erp/?rev=3741&view=rev Author: tim_schofield Date: 2010-09-13 18:11:24 +0000 (Mon, 13 Sep 2010) Log Message: ----------- Small bug fixes Modified Paths: -------------- trunk/PrintCustStatements.php trunk/doc/Change.log.html Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2010-09-13 17:50:19 UTC (rev 3740) +++ trunk/PrintCustStatements.php 2010-09-13 18:11:24 UTC (rev 3741) @@ -428,12 +428,12 @@ $title = _('Select Statements to Print'); include('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Customer Account Statements') . ''; + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt=""></img>' . ' ' . _('Print Customer Account Statements') . '</p>'; if (!isset($_POST['FromCust']) || $_POST['FromCust']=='') { /*if FromTransNo is not set then show a form to allow input of either a single statement number or a range of statements to be printed. Also get the last statement number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"><table class=selection>'; echo '<tr><td>' . _('Starting Customer statement to print (Customer code)'). ' </td><td><input Type=text max=6 size=7 name=FromCust value="1"></td></tr> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 17:50:19 UTC (rev 3740) +++ trunk/doc/Change.log.html 2010-09-13 18:11:24 UTC (rev 3741) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: PrintStatements.php - Small bug fixes</p> <p>13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting</p> <p>13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting</p> <p>13/09/10 Tim: PricesBasedOnMarkup.php - Correct the sql quoting, and various layout improvements and bug fixes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-13 21:44:59
|
Revision: 3742 http://web-erp.svn.sourceforge.net/web-erp/?rev=3742&view=rev Author: tim_schofield Date: 2010-09-13 21:44:52 +0000 (Mon, 13 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/PrintCustTrans.php trunk/doc/Change.log.html Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2010-09-13 18:11:24 UTC (rev 3741) +++ trunk/PrintCustTrans.php 2010-09-13 21:44:52 UTC (rev 3742) @@ -6,6 +6,8 @@ $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { $FromTransNo = trim($_POST['FromTransNo']); +} else { + $FromTransNo = ''; } if (isset($_GET['InvOrCredit'])) { $InvOrCredit = $_GET['InvOrCredit']; @@ -50,7 +52,7 @@ notice that salesorder record must be present to print the invoice purging of sales orders will nobble the invoice reprints */ if ($InvOrCredit == 'Invoice') { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -107,19 +109,19 @@ paymentterms WHERE debtortrans.order_ = salesorders.orderno AND debtortrans.type=10 - AND debtortrans.transno=' . $FromTransNo . ' + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.shipvia=shippers.shipper_id AND debtortrans.debtorno=debtorsmaster.debtorno AND debtorsmaster.paymentterms=paymentterms.termsindicator AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode - AND salesorders.fromstkloc=locations.loccode'; + AND salesorders.fromstkloc=locations.loccode"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI'] == 'No') { - $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; + $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -160,11 +162,11 @@ paymentterms WHERE debtortrans.type=11 AND debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtortrans.transno=' . $FromTransNo . ' + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode'; + AND custbranch.salesman=salesman.salesmancode"; if ($_POST['PrintEDI'] == 'No') { $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; } @@ -190,12 +192,12 @@ $ExchRate = 'X'; } if ($InvOrCredit == 'Invoice') { - $sql = 'SELECT stockmoves.stockid, + $sql = "SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . '* -stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces @@ -203,16 +205,16 @@ stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ - $sql = 'SELECT stockmoves.stockid, + $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces @@ -220,8 +222,8 @@ stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } // end else if ($FromTransNo!='Preview') { $result = DB_query($sql, $db); @@ -392,13 +394,16 @@ } elseif (isset($_POST['FromTransNo'])) { $FromTransNo = trim($_POST['FromTransNo']); } -if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and $PrintPDF) { - $sql = 'SELECT stockmoves.stockid, stockmaster.appendfile +if (!isset($InvOrCredit)) { + $InvOrCredit=''; +} +if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and isset($PrintPDF)) { + $sql = "SELECT stockmoves.stockid, stockmaster.appendfile FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; // }; if ($FromTransNo!='Preview') { $result = DB_query($sql, $db); @@ -450,7 +455,7 @@ include ('includes/header.inc'); if (!isset($FromTransNo) OR $FromTransNo == '') { /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table class='table1'>"; + echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method='POST'><table class='selection'>"; echo '<div class="centre"><p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { @@ -472,7 +477,7 @@ echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td><td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . "</td><td><input Type=text class=number max=6 size=7 name='ToTransNo'></td></tr></table>"; - echo "<div class='centre'><input type=Submit Name='Print' Value='" . _('Print') . "'><p>"; + echo "<br><div class='centre'><input type=Submit Name='Print' Value='" . _('Print') . "'><p>"; echo "<input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; $sql = 'SELECT typeno FROM systypes WHERE typeid=10'; $result = DB_query($sql, $db); @@ -533,14 +538,14 @@ salesman WHERE debtortrans.order_ = salesorders.orderno AND debtortrans.type=10 - AND debtortrans.transno=" . $FromTransNo . " + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.shipvia=shippers.shipper_id AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } else { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -569,15 +574,15 @@ custbranch, salesman WHERE debtortrans.type=11 - AND debtortrans.transno=' . $FromTransNo . ' + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode'; + AND custbranch.salesman=salesman.salesmancode"; } $result = DB_query($sql, $db); if (DB_num_rows($result) == 0 OR DB_error_no($db) != 0) { - echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'); + echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $FromTransNo . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available').'</div>'; if ($debug == 1) { echo _('The SQL used to get this information that failed was') . "<br>$sql"; } @@ -655,16 +660,16 @@ stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . '* -stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { /* then its a credit note */ echo "<table WIDTH=50%><tr> <td align=left bgcolor='#BBBBBB'><b>" . _('Branch') . ":</b></td> @@ -680,24 +685,24 @@ <td bgcolor='#EEEEEE'>" . ConvertSQLDate($myrow['trandate']) . "</td> <td bgcolor='#EEEEEE'>" . $myrow['salesmanname'] . '</td> </tr></table>'; - $sql = 'SELECT stockmoves.stockid, + $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, - stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } echo '<hr>'; echo '<div class="centre"><font size=2>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</font></div>'; $result = DB_query($sql, $db); if (DB_error_no($db) != 0) { - echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); + echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database').'</div>'; if ($debug == 1) { echo '<br>' . _('The SQL used to get this information that failed was') . "<br>$sql"; } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 18:11:24 UTC (rev 3741) +++ trunk/doc/Change.log.html 2010-09-13 21:44:52 UTC (rev 3742) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintStatements.php - Small bug fixes</p> <p>13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting</p> <p>13/09/10 Tim: PrintCustOrder.php - Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-14 08:36:35
|
Revision: 3743 http://web-erp.svn.sourceforge.net/web-erp/?rev=3743&view=rev Author: tim_schofield Date: 2010-09-14 08:36:29 +0000 (Tue, 14 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/PrintCustTransPortrait.php trunk/doc/Change.log.html Modified: trunk/PrintCustTransPortrait.php =================================================================== --- trunk/PrintCustTransPortrait.php 2010-09-13 21:44:52 UTC (rev 3742) +++ trunk/PrintCustTransPortrait.php 2010-09-14 08:36:29 UTC (rev 3743) @@ -10,6 +10,8 @@ $FromTransNo = $_GET['FromTransNo']; } elseif (isset($_POST['FromTransNo'])){ $FromTransNo = $_POST['FromTransNo']; +} else { + $FromTransNo = ''; } if (isset($_GET['InvOrCredit'])) { @@ -99,7 +101,7 @@ // gather the invoice data if ($InvOrCredit=='Invoice') { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -156,21 +158,21 @@ paymentterms WHERE debtortrans.order_ = salesorders.orderno AND debtortrans.type=10 - AND debtortrans.transno=' . $FromTransNo . ' + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.shipvia=shippers.shipper_id AND debtortrans.debtorno=debtorsmaster.debtorno AND debtorsmaster.paymentterms=paymentterms.termsindicator AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode - AND salesorders.fromstkloc=locations.loccode'; + AND salesorders.fromstkloc=locations.loccode"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No'){ $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; } } else { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -211,11 +213,11 @@ paymentterms WHERE debtortrans.type=11 AND debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtortrans.transno=' . $FromTransNo .' + AND debtortrans.transno='" . $FromTransNo ."' AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode'; + AND custbranch.salesman=salesman.salesmancode"; if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No'){ $sql = $sql . ' AND debtorsmaster.ediinvoices=0'; @@ -242,12 +244,12 @@ $ExchRate = $myrow['rate']; if ($InvOrCredit == 'Invoice') { - $sql = 'SELECT stockmoves.stockid, + $sql = "SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . '* -stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, stockmaster.units, @@ -256,16 +258,16 @@ stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { /* only credit notes to be retrieved */ - $sql = 'SELECT stockmoves.stockid, + $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.controlled, stockmaster.units, @@ -274,8 +276,8 @@ stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } // end else $result=DB_query($sql,$db); @@ -528,19 +530,19 @@ } // Check its an Invoice type again, then select appendfile filename if ($InvOrCredit=='Invoice'){ - $sql = 'SELECT stockmoves.stockid, stockmaster.appendfile + $sql = "SELECT stockmoves.stockid, stockmaster.appendfile FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid WHERE stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { - $sql = 'SELECT stockmoves.stockid, stockmaster.appendfile + $sql = "SELECT stockmoves.stockid, stockmaster.appendfile FROM stockmoves INNER JOIN stockmaster ON stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } $result=DB_query($sql,$db); // Loop the result set and add appendfile if the field is not 0 or none @@ -594,7 +596,7 @@ /*if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="POST"><table class="table1">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method="POST"><table class="selection">'; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Portrait Mode)') . '</div>'; echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)){ @@ -625,8 +627,8 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td><td><input Type=text max=6 size=7 name=FromTransNo></td></tr>'; - echo '<tr><td>' . _('End invoice/credit note number to print') . "</td><td><input Type=text max=6 size=7 name='ToTransNo'></td></tr></table>"; + echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td><td><input class=number type=text max=6 size=7 name=FromTransNo></td></tr>'; + echo '<tr><td>' . _('End invoice/credit note number to print') . "</td><td><input class=number type=text max=6 size=7 name='ToTransNo'></td></tr></table>"; echo "<div class='centre'><br><input type=Submit Name='Print' Value='" . _('Print Preview') . "'><p>"; echo "<input type=Submit Name='PrintPDF' Value='" . _('Print PDF') . "'></div>"; @@ -699,7 +701,7 @@ salesman WHERE debtortrans.order_ = salesorders.orderno AND debtortrans.type=10 - AND debtortrans.transno=" . $FromTransNo . " + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.shipvia=shippers.shipper_id AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno @@ -707,7 +709,7 @@ AND custbranch.salesman=salesman.salesmancode"; } else { - $sql = 'SELECT debtortrans.trandate, + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, debtortrans.ovfreight, @@ -736,11 +738,11 @@ custbranch, salesman WHERE debtortrans.type=11 - AND debtortrans.transno=' . $FromTransNo . ' + AND debtortrans.transno='" . $FromTransNo . "' AND debtortrans.debtorno=debtorsmaster.debtorno AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode - AND custbranch.salesman=salesman.salesmancode'; + AND custbranch.salesman=salesman.salesmancode"; } @@ -786,7 +788,7 @@ echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; - echo '</td><td WIDTH=50% class=number>'; + echo '</td><td width=50% class=number>'; /*Now the customer charged to details in a sub table within a cell of the main table*/ @@ -833,12 +835,12 @@ </tr> </table>"; - $sql ='SELECT stockmoves.stockid, + $sql ="SELECT stockmoves.stockid, stockmaster.description, - -stockmoves.qty as Quantity, + -stockmoves.qty as quantity, stockmoves.discountpercent, - ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . '* -stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, stockmaster.units, stockmaster.decimalplaces @@ -846,8 +848,8 @@ stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } else { /* then its a credit note */ @@ -867,18 +869,18 @@ </tr></table>'; - $sql ='SELECT stockmoves.stockid, + $sql ="SELECT stockmoves.stockid, stockmaster.description, - stockmoves.qty as Quantity, - stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, - (stockmoves.price * ' . $ExchRate . ') AS fxprice, + stockmoves.qty as quantity, + stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, + (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno=' . $FromTransNo . ' - AND stockmoves.show_on_inv_crds=1'; + AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.show_on_inv_crds=1"; } echo '<hr>'; @@ -996,7 +998,7 @@ /* check to see enough space left to print the totals/footer */ $LinesRequiredForText = floor(strlen($myrow['invtext'])/140); - if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredFortext)){ + if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)){ /* head up a new invoice/credit note page */ @@ -1113,4 +1115,4 @@ } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-13 21:44:52 UTC (rev 3742) +++ trunk/doc/Change.log.html 2010-09-14 08:36:29 UTC (rev 3743) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintStatements.php - Small bug fixes</p> <p>13/09/10 Tim: PrintCustOrder_Generic.php - Correct the sql quoting</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-14 08:41:17
|
Revision: 3744 http://web-erp.svn.sourceforge.net/web-erp/?rev=3744&view=rev Author: tim_schofield Date: 2010-09-14 08:41:11 +0000 (Tue, 14 Sep 2010) Log Message: ----------- SQL quoting corrections Modified Paths: -------------- trunk/PrintSalesOrder_generic.php trunk/doc/Change.log.html Modified: trunk/PrintSalesOrder_generic.php =================================================================== --- trunk/PrintSalesOrder_generic.php 2010-09-14 08:36:29 UTC (rev 3743) +++ trunk/PrintSalesOrder_generic.php 2010-09-14 08:41:11 UTC (rev 3744) @@ -56,7 +56,7 @@ WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.shipvia=shippers.shipper_id AND salesorders.fromstkloc=locations.loccode - AND salesorders.orderno=" . $_GET['TransNo']; + AND salesorders.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); @@ -129,15 +129,15 @@ $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['TransNo'] . ' ' . _('from the database'); - $sql = "SELECT salesorderdetails.stkcode, - stockmaster.description, - salesorderdetails.quantity, - salesorderdetails.qtyinvoiced, + $sql = "SELECT salesorderdetails.stkcode, + stockmaster.description, + salesorderdetails.quantity, + salesorderdetails.qtyinvoiced, salesorderdetails.unitprice, salesorderdetails.narrative FROM salesorderdetails INNER JOIN stockmaster ON salesorderdetails.stkcode=stockmaster.stockid - WHERE salesorderdetails.orderno=" . $_GET['TransNo']; + WHERE salesorderdetails.orderno='" . $_GET['TransNo'] . "'"; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)>0){ @@ -187,8 +187,8 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_SalesOrder_' . date('Y-m-d') . '.pdf');//UldisN $pdf->__destruct(); //UldisN - $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" .$_GET['TransNo']; + $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno='" .$_GET['TransNo'] . "'"; $result = DB_query($sql,$db); } -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-14 08:36:29 UTC (rev 3743) +++ trunk/doc/Change.log.html 2010-09-14 08:41:11 UTC (rev 3744) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections</p> <p>14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintStatements.php - Small bug fixes</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-14 09:38:04
|
Revision: 3745 http://web-erp.svn.sourceforge.net/web-erp/?rev=3745&view=rev Author: tim_schofield Date: 2010-09-14 09:37:58 +0000 (Tue, 14 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/PurchData.php trunk/doc/Change.log.html Modified: trunk/PurchData.php =================================================================== --- trunk/PurchData.php 2010-09-14 08:41:11 UTC (rev 3744) +++ trunk/PurchData.php 2010-09-14 09:37:58 UTC (rev 3745) @@ -71,14 +71,14 @@ preferred) VALUES ('" . $SupplierID . "', '" . $StockID . "', - " . $_POST['Price'] . ", + '" . $_POST['Price'] . "', '" . FormatDateForSQL($_POST['EffectiveFrom']) . "', '" . $_POST['SuppliersUOM'] . "', - " . $_POST['ConversionFactor'] . ", + '" . $_POST['ConversionFactor'] . "', '" . $_POST['SupplierDescription'] . "', '" . $_POST['SupplierCode'] . "', - " . $_POST['LeadTime'] . ", - " . $_POST['Preferred'] . ')'; + '" . $_POST['LeadTime'] . "', + '" . $_POST['Preferred'] . "')"; $ErrMsg = _('The supplier purchasing details could not be added to the database because'); $DbgMsg = _('The SQL that failed was'); $AddResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); @@ -86,16 +86,16 @@ } if ($InputError == 0 AND isset($_POST['UpdateRecord'])) { $sql = "UPDATE purchdata SET - price=" . $_POST['Price'] . ", + price='" . $_POST['Price'] . "', effectivefrom='" . FormatDateForSQL($_POST['EffectiveFrom']) . "', suppliersuom='" . $_POST['SuppliersUOM'] . "', - conversionfactor=" . $_POST['ConversionFactor'] . ", + conversionfactor='" . $_POST['ConversionFactor'] . "', supplierdescription='" . $_POST['SupplierDescription'] . "', suppliers_partno='" . $_POST['SupplierCode'] . "', - leadtime=" . $_POST['LeadTime'] . ", - preferred=" . $_POST['Preferred'] . " - WHERE purchdata.stockid='$StockID' - AND purchdata.supplierno='$SupplierID' + leadtime='" . $_POST['LeadTime'] . "', + preferred='" . $_POST['Preferred'] . "' + WHERE purchdata.stockid='".$StockID."' + AND purchdata.supplierno='".$SupplierID."' AND purchdata.effectivefrom='" . $_POST['WasEffectiveFrom'] . "'"; $ErrMsg = _('The supplier purchasing details could not be update because'); $DbgMsg = _('The SQL that failed was'); @@ -120,8 +120,8 @@ if (isset($_GET['Delete'])) { $sql = "DELETE FROM purchdata - WHERE purchdata.supplierno='$SupplierID' - AND purchdata.stockid='$StockID' + WHERE purchdata.supplierno='".$SupplierID."' + AND purchdata.stockid='".$StockID."' AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'"; $ErrMsg = _('The supplier purchasing details could not be deleted because'); $DelResult = DB_query($sql, $db, $ErrMsg); @@ -153,7 +153,7 @@ // prnMsg(_('There is no purchasing data set up for the part selected'), 'info'); $NoPurchasingData=1; } else if ($StockID != '') { - echo '<table cellpadding=2 BORDER=2>'; + echo '<table cellpadding=2 class=selection>'; $TableHeader = '<tr><th>' . _('Supplier') . '</th> <th>' . _('Price') . '</th> <th>' . _('Currency') . '</th> @@ -203,7 +203,7 @@ } /* Only show the existing purchasing data records if one is not being edited */ if (isset($SupplierID) AND $SupplierID != '' AND !isset($_POST['SearchSupplier'])) { /*NOT EDITING AN EXISTING BUT SUPPLIER selected OR ENTERED*/ - $sql = "SELECT suppliers.suppname, suppliers.currcode FROM suppliers WHERE supplierid='$SupplierID'"; + $sql = "SELECT suppliers.suppname, suppliers.currcode FROM suppliers WHERE supplierid='".$SupplierID."'"; $ErrMsg = _('The supplier details for the selected supplier could not be retrieved because'); $DbgMsg = _('The SQL that failed was'); $SuppSelResult = DB_query($sql, $db, $ErrMsg, $DbgMsg); @@ -220,7 +220,7 @@ echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '<br>'; } if (!isset($_POST['SearchSupplier'])) { - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=3 colspan=4><tr>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=3 colspan=4 class=selection><tr>'; echo '<input type="hidden" name="StockID" value="' . $StockID . '">'; echo '<td>' . _('Text in the Supplier') . ' <b>' . _('NAME') . '</b>:</font></td>'; echo '<td><input type="Text" name="Keywords" size=20 maxlength=25></td>'; @@ -234,9 +234,14 @@ }; } +if (isset($_GET['Edit'])) { + echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/maintenance.png" title="' . _('Search') . '" alt="">' . ' ' . $title . ' ' . _('For Stock Code') . ' - ' . $StockID . '<br>'; +} + if (isset($_POST['SearchSupplier'])) { if (isset($_POST['Keywords']) AND isset($_POST['SupplierCode'])) { prnMsg( _('Supplier Name keywords have been used in preference to the Supplier Code extract entered') . '.', 'info' ); + echo '<br>'; } if ($_POST['Keywords'] == '' AND $_POST['SupplierCode'] == '') { $_POST['Keywords'] = ' '; @@ -251,7 +256,7 @@ suppliers.address1, suppliers.address2, suppliers.address3 - FROM suppliers WHERE suppliers.suppname " . LIKE . " '$SearchString'"; + FROM suppliers WHERE suppliers.suppname LIKE . ".$SearchString; } elseif (strlen($_POST['SupplierCode']) > 0) { $SQL = "SELECT suppliers.supplierid, suppliers.suppname, @@ -260,7 +265,7 @@ suppliers.address2, suppliers.address3 FROM suppliers - WHERE suppliers.supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%'"; + WHERE suppliers.supplierid LIKE '%" . $_POST['SupplierCode'] . "%'"; } //one of keywords or SupplierCode was more than a zero length string $ErrMsg = _('The suppliers matching the criteria entered could not be retrieved because'); $DbgMsg = _('The SQL to retrieve supplier details that failed was'); @@ -273,7 +278,7 @@ stockmaster.units, stockmaster.mbflag FROM stockmaster - WHERE stockmaster.stockid='$StockID'", $db); + WHERE stockmaster.stockid='".$StockID."'", $db); $myrow = DB_fetch_row($result); $stockuom = $myrow[1]; if (DB_num_rows($result) == 1) { @@ -291,7 +296,7 @@ $StockID = ''; $stockuom = 'each'; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=2 colspan=7 BORDER=2>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> <th>' . _('Supplier Name') . '</th> <th>' . _('Currency') . '</th> @@ -300,9 +305,16 @@ <th>' . _('Address 3') . '</th> </tr>'; echo $TableHeader; - $j = 1; + $k = 0; while ($myrow = DB_fetch_array($SuppliersResult)) { - printf("<tr><td><font size=1><input type=submit name='SupplierID' VALUE='%s'</font></td> + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + printf("<td><font size=1><input type=submit name='SupplierID' VALUE='%s'</font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> <td><font size=1>%s</font></td> @@ -311,12 +323,6 @@ </tr>", $myrow['supplierid'], $myrow['suppname'], $myrow['currcode'], $myrow['address1'], $myrow['address2'], $myrow['address3']); echo '<input type=hidden name=StockID value="' . $StockID . '">'; echo '<input type=hidden name=stockuom value="' . $stockuom . '">'; - $j++; - if ($j == 11) { - $j = 1; - echo $TableHeader; - } - //end of page full new headings if } //end of while loop @@ -343,8 +349,8 @@ ON purchdata.supplierno=suppliers.supplierid INNER JOIN stockmaster ON purchdata.stockid=stockmaster.stockid - WHERE purchdata.supplierno='$SupplierID' - AND purchdata.stockid='$StockID' + WHERE purchdata.supplierno='".$SupplierID."' + AND purchdata.stockid='".$StockID."' AND purchdata.effectivefrom='" . $_GET['EffectiveFrom'] . "'"; $ErrMsg = _('The supplier purchasing details for the selected supplier and item could not be retrieved because'); $EditResult = DB_query($sql, $db, $ErrMsg); @@ -361,7 +367,7 @@ $_POST['SupplierCode'] = $myrow['suppliers_partno']; $stockuom=$myrow['units']; } - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID . '" method=post><table class=selection>'; if (!isset($SupplierID)) { $SupplierID = ''; } @@ -445,7 +451,7 @@ echo '<option VALUE=1>' . _('Yes'); echo '<option selected VALUE=0>' . _('No'); } - echo '</select></td></tr></table><div class="centre">'; + echo '</select></td></tr></table><br><div class="centre">'; if (isset($_GET['Edit'])) { echo '<input type=submit name="UpdateRecord" VALUE="' . _('Update') . '">'; } else { @@ -463,4 +469,4 @@ } include ('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-14 08:41:11 UTC (rev 3744) +++ trunk/doc/Change.log.html 2010-09-14 09:37:58 UTC (rev 3745) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements</p> <p>14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections</p> <p>14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements</p> <p>13/09/10 Tim: PrintCustTrans.php - SQL quoting corrections and layout changes and improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-20 16:11:32
|
Revision: 3751 http://web-erp.svn.sourceforge.net/web-erp/?rev=3751&view=rev Author: tim_schofield Date: 2010-09-20 16:11:26 +0000 (Mon, 20 Sep 2010) Log Message: ----------- Restrict price changes to those stock items not discontinued Modified Paths: -------------- trunk/PricesByCost.php trunk/doc/Change.log.html Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2010-09-19 13:14:43 UTC (rev 3750) +++ trunk/PricesByCost.php 2010-09-20 16:11:26 UTC (rev 3751) @@ -1,5 +1,5 @@ <?php -/* $Id: PricesByCost.php 3475 2010-05-29 00:00:42Z daintree $ */ +/* $Id: PricesByCost.php 3566 2010-07-05 13:06:08Z tim_schofield $ */ // PricesByCost.php - $PageSecurity = 11; include ('includes/session.inc'); @@ -33,6 +33,7 @@ prices.enddate FROM stockmaster, prices WHERE stockmaster.stockid=prices.stockid" . $Category . " + AND stockmaster.discontinued = 0 AND prices.price" . $Comparator . "(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) * '" . $_POST['Margin'] . "' AND prices.typeabbrev ='" . $_POST['SalesType'] . "' AND prices.currabrev ='" . $_POST['CurrCode'] . "' Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-19 13:14:43 UTC (rev 3750) +++ trunk/doc/Change.log.html 2010-09-20 16:11:26 UTC (rev 3751) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>20/09/10 Pak Ricard: PricesByCost.php - Restrict price changes to those stock items not discontinued</p> <p>14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements</p> <p>14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections</p> <p>14/09/10 Tim: PrintCustTransPortrait.php - SQL quoting corrections and layout changes and improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-23 09:12:04
|
Revision: 3754 http://web-erp.svn.sourceforge.net/web-erp/?rev=3754&view=rev Author: tim_schofield Date: 2010-09-23 09:11:58 +0000 (Thu, 23 Sep 2010) Log Message: ----------- mktime() function without paramaeters is now deprecated, replaced with time() Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/DateFunctions.inc Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-22 08:42:50 UTC (rev 3753) +++ trunk/doc/Change.log.html 2010-09-23 09:11:58 UTC (rev 3754) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>23/09/10 Tim: DateFunctions.inc - mktime() function without paramaeters is now deprecated, replaced with time()</p> <p>20/09/10 Pak Ricard: PricesByCost.php - Restrict price changes to those stock items not discontinued</p> <p>14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements</p> <p>14/09/10 Tim: PrintSalesOrder_generic.php - SQL quoting corrections</p> Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2010-09-22 08:42:50 UTC (rev 3753) +++ trunk/includes/DateFunctions.inc 2010-09-23 09:11:58 UTC (rev 3754) @@ -403,7 +403,7 @@ } } return $Date_Array[0].'-'.$Date_Array[1].'-'.$Date_Array[2]; - + }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ if (strlen($Date_Array[2])==2) { if ((int)$Date_Array[2] <=60) { @@ -414,7 +414,7 @@ } /* 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']=='m/d/Y') { if (strlen($Date_Array[2])==2) { if ((int)$Date_Array[2] <=60) { @@ -424,7 +424,7 @@ } } return $Date_Array[2].'-'.$Date_Array[0].'-'.$Date_Array[1]; - } + } }// end of function @@ -707,7 +707,7 @@ /*This function will need to be modified depending on the business - many businesses run 24x7 The default assumes no delivery on Sat and Sun*/ - $EarliestDispatch = Mktime(); + $EarliestDispatch = time(); if (Date('w',$EarliestDispatch)==0 ){ /*if today is a sunday the dispatch date must be tomorrow (Monday) or after */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2010-09-23 09:38:50
|
Revision: 3755 http://web-erp.svn.sourceforge.net/web-erp/?rev=3755&view=rev Author: tim_schofield Date: 2010-09-23 09:38:43 +0000 (Thu, 23 Sep 2010) Log Message: ----------- SQL quoting corrections and layout changes and improvements Modified Paths: -------------- trunk/RecurringSalesOrders.php trunk/doc/Change.log.html Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2010-09-23 09:11:58 UTC (rev 3754) +++ trunk/RecurringSalesOrders.php 2010-09-23 09:38:43 UTC (rev 3755) @@ -24,16 +24,16 @@ } else { $NewRecurringOrder ='No'; if (isset($_GET['ModifyRecurringSalesOrder'])){ - + $_POST['ExistingRecurrOrderNo'] = $_GET['ModifyRecurringSalesOrder']; - + /*Need to read in the existing recurring order template */ - + $_SESSION['Items'.$identifier] = new cart; /*read in all the guff from the selected order into the Items cart */ - $OrderHeaderSQL = 'SELECT recurringsalesorders.debtorno, + $OrderHeaderSQL = "SELECT recurringsalesorders.debtorno, debtorsmaster.name, recurringsalesorders.branchcode, recurringsalesorders.customerref, @@ -58,27 +58,27 @@ recurringsalesorders.stopdate, recurringsalesorders.lastrecurrence, recurringsalesorders.autoinvoice - FROM recurringsalesorders, - debtorsmaster, + FROM recurringsalesorders, + debtorsmaster, salestypes WHERE recurringsalesorders.ordertype=salestypes.typeabbrev AND recurringsalesorders.debtorno = debtorsmaster.debtorno - AND recurringsalesorders.recurrorderno = ' . $_GET['ModifyRecurringSalesOrder']; + AND recurringsalesorders.recurrorderno = '" . $_GET['ModifyRecurringSalesOrder'] . "'"; $ErrMsg = _('The order cannot be retrieved because'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg); if (DB_num_rows($GetOrdHdrResult)==1) { - + $myrow = DB_fetch_array($GetOrdHdrResult); - + $_SESSION['Items'.$identifier]->DebtorNo = $myrow['debtorno']; /*CustomerID defined in header.inc */ $_SESSION['Items'.$identifier]->Branch = $myrow['branchcode']; $_SESSION['Items'.$identifier]->CustomerName = $myrow['name']; $_SESSION['Items'.$identifier]->CustRef = $myrow['customerref']; $_SESSION['Items'.$identifier]->Comments = $myrow['comments']; - + $_SESSION['Items'.$identifier]->DefaultSalesType =$myrow['ordertype']; $_SESSION['Items'.$identifier]->SalesTypeName =$myrow['sales_type']; $_SESSION['Items'.$identifier]->DefaultCurrency = $myrow['currcode']; @@ -86,12 +86,12 @@ $BestShipper = $myrow['shipvia']; $_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto']; $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); - $_SESSION['Items'.$identifier]->BrAdd1 = $myrow['deladd1']; - $_SESSION['Items'.$identifier]->BrAdd2 = $myrow['deladd2']; - $_SESSION['Items'.$identifier]->BrAdd3 = $myrow['deladd3']; - $_SESSION['Items'.$identifier]->BrAdd4 = $myrow['deladd4']; - $_SESSION['Items'.$identifier]->BrAdd5 = $myrow['deladd5']; - $_SESSION['Items'.$identifier]->BrAdd6 = $myrow['deladd6']; + $_SESSION['Items'.$identifier]->DelAdd1 = $myrow['deladd1']; + $_SESSION['Items'.$identifier]->DelAdd2 = $myrow['deladd2']; + $_SESSION['Items'.$identifier]->DelAdd3 = $myrow['deladd3']; + $_SESSION['Items'.$identifier]->DelAdd4 = $myrow['deladd4']; + $_SESSION['Items'.$identifier]->DelAdd5 = $myrow['deladd5']; + $_SESSION['Items'.$identifier]->DelAdd6 = $myrow['deladd6']; $_SESSION['Items'.$identifier]->PhoneNo = $myrow['contactphone']; $_SESSION['Items'.$identifier]->Email = $myrow['contactemail']; $_SESSION['Items'.$identifier]->Location = $myrow['fromstkloc']; @@ -121,12 +121,12 @@ ON recurrsalesorderdetails.stkcode = stockmaster.stockid INNER JOIN locstock ON locstock.stockid = stockmaster.stockid WHERE locstock.loccode = '" . $myrow['fromstkloc'] . "' - AND recurrsalesorderdetails.recurrorderno =" . $_GET['ModifyRecurringSalesOrder']; - + AND recurrsalesorderdetails.recurrorderno ='" . $_GET['ModifyRecurringSalesOrder'] . "'"; + $ErrMsg = _('The line items of the order cannot be retrieved because'); $LineItemsResult = db_query($LineItemsSQL,$db,$ErrMsg); if (db_num_rows($LineItemsResult)>0) { - + while ($myrow=db_fetch_array($LineItemsResult)) { $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], $myrow['quantity'], @@ -146,7 +146,7 @@ $myrow['decimalplaces'], $myrow['narrative']); /*Just populating with existing order - no DBUpdates */ - + } /* line items from sales order details */ } //end of checks on returned data set } @@ -161,18 +161,18 @@ if (isset($_POST['DeleteRecurringOrder'])){ - $sql = 'DELETE FROM recurrsalesorderdetails WHERE recurrorderno=' . $_POST['ExistingRecurrOrderNo']; + $sql = "DELETE FROM recurrsalesorderdetails WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete recurring sales order lines for the recurring order template') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - - $sql = 'DELETE FROM recurringsalesorders WHERE recurrorderno=' . $_POST['ExistingRecurrOrderNo']; + + $sql = "DELETE FROM recurringsalesorders WHERE recurrorderno='" . $_POST['ExistingRecurrOrderNo'] . "'"; $ErrMsg = _('Could not delete the recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo']; $result = DB_query($sql,$db,$ErrMsg); - + prnMsg(_('Successfully deleted recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo'],'success'); - + echo "<p><a href='$rootpath/SelectRecurringSalesOrder.php?" . SID . "'>". _('Select A Recurring Sales Order Template') .'</a>'; - + unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); include('includes/footer.inc'); @@ -198,13 +198,13 @@ } if ($InputErrors == 0 ){ /*Error checks above all passed ok so lets go*/ - + if ($NewRecurringOrder=='Yes'){ /* finally write the recurring order header to the database and then the line details*/ - + $DelDate = FormatDateforSQL($_SESSION['Items'.$identifier]->DeliveryDate); - + $HeaderSQL = "INSERT INTO recurringsalesorders ( debtorno, branchcode, @@ -228,7 +228,7 @@ stopdate, frequency, autoinvoice) - VALUES ( + valueS ( '" . $_SESSION['Items'.$identifier]->DebtorNo . "', '" . $_SESSION['Items'.$identifier]->Branch . "', '". $_SESSION['Items'.$identifier]->CustRef ."', @@ -236,21 +236,21 @@ '" . Date("Y-m-d H:i") . "', '" . $_SESSION['Items'.$identifier]->DefaultSalesType . "', '" . $_SESSION['Items'.$identifier]->DeliverTo . "', - '" . $_SESSION['Items'.$identifier]->BrAdd1 . "', - '" . $_SESSION['Items'.$identifier]->BrAdd2 . "', - '" . $_SESSION['Items'.$identifier]->BrAdd3 . "', - '" . $_SESSION['Items'.$identifier]->BrAdd4 . "', - '" . $_SESSION['Items'.$identifier]->BrAdd5 . "', - '" . $_SESSION['Items'.$identifier]->BrAdd6 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd1 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd2 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd3 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd4 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd5 . "', + '" . $_SESSION['Items'.$identifier]->DelAdd6 . "', '" . $_SESSION['Items'.$identifier]->PhoneNo . "', '" . $_SESSION['Items'.$identifier]->Email . "', - " . $_SESSION['Items'.$identifier]->FreightCost .", + '" . $_SESSION['Items'.$identifier]->FreightCost ."', '" . $_SESSION['Items'.$identifier]->Location ."', '" . $_SESSION['Items'.$identifier]->ShipVia ."', '" . FormatDateforSQL($_POST['StartDate']) . "', '" . FormatDateforSQL($_POST['StopDate']) . "', - " . $_POST['Frequency'] .', - ' . $_POST['AutoInvoice'] . ')'; + '" . $_POST['Frequency'] ."', + '" . $_POST['AutoInvoice'] . "')"; $ErrMsg = _('The recurring order cannot be added because'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg); @@ -263,39 +263,39 @@ quantity, discountpercent, narrative) - VALUES ("; + values ('"; foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineItemsSQL = $StartOf_LineItemsSQL . - $RecurrOrderNo . ", + $RecurrOrderNo . "', '" . $StockItem->StockID . "', - ". $StockItem->Price . ", - " . $StockItem->Quantity . ", - " . $StockItem->DiscountPercent . ", + '". $StockItem->Price . "', + '" . $StockItem->Quantity . "', + '" . $StockItem->DiscountPercent . "', '" . $StockItem->Narrative . "' )"; $Ins_LineItemResult = DB_query($LineItemsSQL,$db); } /* inserted line items into sales order details */ - + prnmsg(_('The new recurring order template has been added'),'success'); - + } else { /* must be updating an existing recurring order */ $HeaderSQL = "UPDATE recurringsalesorders SET stopdate = '" . FormatDateforSQL($_POST['StopDate']) . "', - frequency = " . $_POST['Frequency'] . ", - autoinvoice = " . $_POST['AutoInvoice'] . ' - WHERE recurrorderno = ' . $_POST['ExistingRecurrOrderNo']; - + frequency = '" . $_POST['Frequency'] . "', + autoinvoice = '" . $_POST['AutoInvoice'] . "' + WHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'"; + $ErrMsg = _('The recurring order cannot be updated because'); $UpdateQryResult = DB_query($HeaderSQL,$db,$ErrMsg); prnmsg(_('The recurring order template has been updated'),'success'); - } - + } + echo "<p><a href='$rootpath/SelectOrderItems.php?" . SID . "&NewOrder=Yes'>". _('Enter New Sales Order') .'</a>'; echo "<p><a href='$rootpath/SelectRecurringSalesOrder.php?" . SID . "'>". _('Select A Recurring Sales Order Template') .'</a>'; - + unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); include('includes/footer.inc'); @@ -304,12 +304,14 @@ } } -echo '<div class="centre"><font size=4><b>'. _('Recurring Order for Customer') .' : ' . $_SESSION['Items'.$identifier]->CustomerName . '</b></font></div>'; -echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . $SID .'identifier='.$identifier. "' method=post>"; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Search') . + '" alt=""><b>'.' '. _('Recurring Order for Customer') .' : ' . $_SESSION['Items'.$identifier]->CustomerName .'</b></p'; +echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier. "' method=post>"; -echo "<table cellpadding=2 colspan=7 BORDER=1> -<tr> +echo "<table cellpadding=2 colspan=7 class=selection>"; +echo "<tr><th colspan=7><font size=2 color=navy><b>"._('Order Line Details')."</b></font></th></tr>"; +echo "<tr> <th>". _('Item Code') ."</th> <th>". _('Item Description') ."</th> <th>". _('Quantity') ."</th> @@ -361,7 +363,10 @@ <td class=number>$DisplayTotal</td> </tr></table>"; -echo '<table><tr> +echo '<br><table class=selection>'; +echo "<tr><th colspan=7><font size=2 color=navy><b>"._('Order Header Details')."</b></font></th></tr>"; + +echo '<tr> <td>'. _('Deliver To') .":</td> <td>" . $_SESSION['Items'.$identifier]->DeliverTo . "</td></tr>"; @@ -371,19 +376,19 @@ echo '<tr> <td>'. _('Street') .":</td> - <td>" . $_SESSION['Items'.$identifier]->BrAdd1 . "</td></tr>"; + <td>" . $_SESSION['Items'.$identifier]->DelAdd1 . "</td></tr>"; echo "<tr> <td>". _('Suburb') .":</td> - <td>" . $_SESSION['Items'.$identifier]->BrAdd2 . "</td></tr>"; + <td>" . $_SESSION['Items'.$identifier]->DelAdd2 . "</td></tr>"; echo '<tr> <td>'. _('City') . '/' . _('Region') .':</td> - <td>' . $_SESSION['Items'.$identifier]->BrAdd3 . '</td></tr>'; + <td>' . $_SESSION['Items'.$identifier]->DelAdd3 . '</td></tr>'; echo '<tr> <td>'. _('Post Code') .':</td> - <td>' . $_SESSION['Items'.$identifier]->BrAdd4 . '</td></tr>'; + <td>' . $_SESSION['Items'.$identifier]->DelAdd4 . '</td></tr>'; echo '<tr> <td>'. _('Contact Phone Number') .':</td> @@ -403,63 +408,63 @@ $_POST['StartDate'] = date($_SESSION['DefaultDateFormat']); } -if ($NewRecurringOrder=='Yes'){ +if ($NewRecurringOrder=='Yes'){ echo '<tr> <td>'. _('Start Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 VALUE="' . $_POST['StartDate'] .'"</td></tr>'; + <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StartDate" size=11 maxlength=10 value="' . $_POST['StartDate'] .'"</td></tr>'; } else { echo '<tr> <td>'. _('Last Recurrence') . ':</td> <td>' . $_POST['StartDate'] . '</td></tr>'; - echo '<input type=hidden name="StartDate" VALUE="' . $_POST['StartDate'] . '">'; + echo '<input type=hidden name="StartDate" value="' . $_POST['StartDate'] . '">'; } if (!isset($_POST['StopDate'])){ $_POST['StopDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')+1,Date('y')+1)); } - + echo '<tr> <td>'. _('Finish Date') .':</td> - <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 VALUE="' . $_POST['StopDate'] .'"</td></tr>'; + <td><input type=TEXT class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="StopDate" size=11 maxlength=10 value="' . $_POST['StopDate'] .'"</td></tr>'; echo '<tr> <td>'. _('Frequency of Recurrence') .':</td> <td><select name="Frequency">'; - -if ($_POST['Frequency']==52){ - echo '<option selected VALUE=52>' . _('Weekly'); + +if (isset($_POST['Frequency']) and $_POST['Frequency']==52){ + echo '<option selected value=52>' . _('Weekly'); } else { - echo '<option VALUE=52>' . _('Weekly'); + echo '<option value=52>' . _('Weekly'); } -if ($_POST['Frequency']==26){ - echo '<option selected VALUE=26>' . _('Fortnightly'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==26){ + echo '<option selected value=26>' . _('Fortnightly'); } else { - echo '<option VALUE=26>' . _('Fortnightly'); + echo '<option value=26>' . _('Fortnightly'); } -if ($_POST['Frequency']==12){ - echo '<option selected VALUE=12>' . _('Monthly'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==12){ + echo '<option selected value=12>' . _('Monthly'); } else { - echo '<option VALUE=12>' . _('Monthly'); + echo '<option value=12>' . _('Monthly'); } -if ($_POST['Frequency']==6){ - echo '<option selected VALUE=6>' . _('Bi-monthly'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==6){ + echo '<option selected value=6>' . _('Bi-monthly'); } else { - echo '<option VALUE=6>' . _('Bi-monthly'); + echo '<option value=6>' . _('Bi-monthly'); } -if ($_POST['Frequency']==4){ - echo '<option selected VALUE=4>' . _('Quarterly'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==4){ + echo '<option selected value=4>' . _('Quarterly'); } else { - echo '<option VALUE=4>' . _('Quarterly'); + echo '<option value=4>' . _('Quarterly'); } -if ($_POST['Frequency']==2){ - echo '<option selected VALUE=2>' . _('Bi-Annually'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==2){ + echo '<option selected value=2>' . _('Bi-Annually'); } else { - echo '<option VALUE=2>' . _('Bi-Annually'); + echo '<option value=2>' . _('Bi-Annually'); } -if ($_POST['Frequency']==1){ - echo '<option selected VALUE=1>' . _('Annually'); +if (isset($_POST['Frequency']) and $_POST['Frequency']==1){ + echo '<option selected value=1>' . _('Annually'); } else { - echo '<option VALUE=1>' . _('Annually'); + echo '<option value=1>' . _('Annually'); } echo '</select></td></tr>'; @@ -469,32 +474,32 @@ echo '<tr><td>' . _('Invoice Automatically') . ':</td> <td><select name="AutoInvoice">'; if ($_POST['AutoInvoice']==0){ - echo '<option selected VALUE=0>' . _('No'); - echo '<option VALUE=1>' . _('Yes'); + echo '<option selected value=0>' . _('No'); + echo '<option value=1>' . _('Yes'); } else { - echo '<option VALUE=0>' . _('No'); - echo '<option selected VALUE=1>' . _('Yes'); + echo '<option value=0>' . _('No'); + echo '<option selected value=1>' . _('Yes'); } echo '</select></td></tr>'; } else { - echo '<input type=hidden name="AutoInvoice" VALUE=0>'; + echo '<input type=hidden name="AutoInvoice" value=0>'; } echo '</table>'; echo '<br><div class="centre">'; if ($NewRecurringOrder=='Yes'){ - echo '<input type=hidden name="NewRecurringOrder" VALUE="Yes">'; - echo "<input type=submit name='Process' VALUE='" . _('Create Recurring Order') . "'>"; + echo '<input type=hidden name="NewRecurringOrder" value="Yes">'; + echo "<input type=submit name='Process' value='" . _('Create Recurring Order') . "'>"; } else { - echo '<input type=hidden name="NewRecurringOrder" VALUE="No">'; - echo '<input type=hidden name="ExistingRecurrOrderNo" VALUE=' . $_POST['ExistingRecurrOrderNo'] . '>'; - - echo "<input type=submit name='Process' VALUE='" . _('Update Recurring Order Details') . "'>"; + echo '<input type=hidden name="NewRecurringOrder" value="No">'; + echo '<input type=hidden name="ExistingRecurrOrderNo" value=' . $_POST['ExistingRecurrOrderNo'] . '>'; + + echo "<input type=submit name='Process' value='" . _('Update Recurring Order Details') . "'>"; echo '<hr>'; - echo '<br><br><input type=submit name="DeleteRecurringOrder" VALUE="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');">'; + echo '<br><br><input type=submit name="DeleteRecurringOrder" value="' . _('Delete Recurring Order') . ' ' . $_POST['ExistingRecurrOrderNo'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this recurring order template?') . '\');">'; } echo '</form></div>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-09-23 09:11:58 UTC (rev 3754) +++ trunk/doc/Change.log.html 2010-09-23 09:38:43 UTC (rev 3755) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>23/09/10 Tim: RecurringSalesOrders.php - SQL quoting corrections and layout changes and improvements</p> <p>23/09/10 Tim: DateFunctions.inc - mktime() function without paramaeters is now deprecated, replaced with time()</p> <p>20/09/10 Pak Ricard: PricesByCost.php - Restrict price changes to those stock items not discontinued</p> <p>14/09/10 Tim: PurchData.php - SQL quoting corrections and layout changes and improvements</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |