From a35e4975947824055bb4ebcac5ab2fbc748a218c Mon Sep 17 00:00:00 2001 From: Paul Thursby Date: Tue, 27 Feb 2018 09:35:48 +0000 Subject: [PATCH] PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later. --- AccountGroups.php | 12 +- AccountSections.php | 12 +- AddCustomerContacts.php | 15 +- AddCustomerNotes.php | 15 +- AddCustomerTypeNotes.php | 15 +- AgedControlledInventory.php | 29 +- AnalysisHorizontalIncome.php | 11 +- AnalysisHorizontalPosition.php | 11 +- Areas.php | 12 +- AutomaticTranslationDescriptions.php | 23 +- BOMInquiry.php | 24 +- BOMs.php | 25 +- BOMs_SingleLevel.php | 25 +- BankAccountUsers.php | 13 +- BankAccounts.php | 12 +- BankMatching.php | 13 +- BankReconciliation.php | 32 +- COGSGLPostings.php | 27 +- CollectiveWorkOrderCost.php | 40 +- ConfirmDispatch_Invoice.php | 7 +- ContractBOM.php | 28 +- ContractOtherReqts.php | 13 +- Contracts.php | 14 +- CounterReturns.php | 42 +- CounterSales.php | 44 +- CreditStatus.php | 11 +- Credit_Invoice.php | 11 +- Currencies.php | 7 +- CustItem.php | 24 +- CustWhereAlloc.php | 11 +- CustomerAccount.php | 23 +- CustomerAllocations.php | 34 +- CustomerBranches.php | 11 +- CustomerInquiry.php | 44 +- CustomerReceipt.php | 23 +- CustomerTransInquiry.php | 12 +- CustomerTypes.php | 12 +- Customers.php | 14 +- DailyBankTransactions.php | 35 +- Dashboard.php | 89 +- DeliveryDetails.php | 28 +- Departments.php | 12 +- DiscountCategories.php | 12 +- DiscountMatrix.php | 12 +- FTP_RadioBeacon.php | 16 +- Factors.php | 12 +- FixedAssetCategories.php | 12 +- FixedAssetDepreciation.php | 12 +- FreightCosts.php | 11 +- GLAccountInquiry.php | 11 +- GLAccountUsers.php | 11 +- GLAccounts.php | 11 +- GLBalanceSheet.php | 14 +- GLCashFlowsIndirect.php | 110 +- GLCodesInquiry.php | 14 +- GLJournal.php | 15 +- GLJournalInquiry.php | 20 +- GLProfit_Loss.php | 14 +- GLTagProfit_Loss.php | 15 +- GLTransInquiry.php | 23 +- GLTrialBalance.php | 12 +- GeocodeSetup.php | 12 +- GoodsReceived.php | 13 +- HistoricalTestResults.php | 18 +- InternalStockCategoriesByRole.php | 12 +- InternalStockRequest.php | 37 +- InternalStockRequestInquiry.php | 1069 ++++++++------- Labels.php | 26 +- LocationUsers.php | 12 +- Locations.php | 11 +- MRPDemands.php | 12 +- MRPPlannedPurchaseOrders.php | 12 +- MRPPlannedWorkOrders.php | 12 +- MRPReport.php | 11 +- MailingGroupMaintenance.php | 514 ++++---- Manufacturers.php | 11 +- MaterialsNotUsed.php | 165 ++- NoSalesItems.php | 17 +- OffersReceived.php | 13 +- OrderDetails.php | 82 +- OutstandingGRNs.php | 15 +- PDFPrintLabel.php | 716 +++++----- PDFWeeklyOrders.php | 2 +- POReport.php | 39 +- PO_Header.php | 13 +- PO_Items.php | 26 +- PO_OrderDetails.php | 9 +- PO_SelectOSPurchOrder.php | 27 +- PaymentAllocations.php | 13 +- PaymentMethods.php | 14 +- PcAnalysis.php | 512 ++++---- PcAssignCashTabToTab.php | 17 +- PcAssignCashToTab.php | 783 ++++++----- PcAuthorizeCash.php | 598 +++++---- PcAuthorizeExpenses.php | 804 ++++++------ PcClaimExpensesFromTab.php | 1377 ++++++++++---------- PcExpenses.php | 594 +++++---- PcExpensesTypeTab.php | 380 +++--- PcReportExpense.php | 12 +- PcReportTab.php | 14 +- PcTabExpensesList.php | 622 ++++----- PcTabs.php | 952 +++++++------- PcTypeTabs.php | 356 +++-- PeriodsInquiry.php | 12 +- PriceMatrix.php | 775 ++++++----- Prices.php | 11 +- PricesByCost.php | 16 +- Prices_Customer.php | 5 +- PrintCustTrans.php | 18 +- PrintCustTransPortrait.php | 18 +- PrintWOItemSlip.php | 432 +++--- ProductSpecs.php | 24 +- PurchData.php | 38 +- PurchasesReport.php | 22 +- QATests.php | 12 +- RecurringSalesOrders.php | 12 +- RelatedItemsUpdate.php | 403 +++--- ReorderLevelLocation.php | 15 +- ReprintGRN.php | 14 +- ReverseGRN.php | 11 +- RevisionTranslations.php | 26 +- SalesAnalReptCols.php | 11 +- SalesAnalRepts.php | 13 +- SalesByTypePeriodInquiry.php | 86 +- SalesCategories.php | 24 +- SalesCategoryPeriodInquiry.php | 21 +- SalesGLPostings.php | 27 +- SalesPeople.php | 12 +- SalesTopCustomersInquiry.php | 22 +- SalesTopItemsInquiry.php | 23 +- SalesTypes.php | 12 +- SelectAsset.php | 11 +- SelectCompletedOrder.php | 26 +- SelectContract.php | 10 +- SelectCreditItems.php | 51 +- SelectCustomer.php | 53 +- SelectOrderItems.php | 60 +- SelectProduct.php | 13 +- SelectQASamples.php | 24 +- SelectRecurringSalesOrder.php | 14 +- SelectSalesOrder.php | 32 +- SelectSupplier.php | 12 +- SelectWorkOrder.php | 24 +- SellThroughSupport.php | 24 +- ShipmentCosting.php | 40 +- Shipments.php | 25 +- Shippers.php | 15 +- Shipt_Select.php | 31 +- ShiptsList.php | 11 +- SpecialOrder.php | 24 +- StockCategories.php | 12 +- StockCategorySalesInquiry.php | 14 +- StockLocMovements.php | 13 +- StockLocStatus.php | 25 +- StockLocTransferReceive.php | 26 +- StockMovements.php | 18 +- StockQuantityByDate.php | 21 +- StockReorderLevel.php | 15 +- StockSerialItems.php | 10 +- StockStatus.php | 24 +- StockUsage.php | 14 +- SuppPriceList.php | 13 +- SuppWhereAlloc.php | 12 +- SupplierAllocations.php | 35 +- SupplierGRNAndInvoiceInquiry.php | 192 ++- SupplierInquiry.php | 10 +- SupplierPriceList.php | 24 +- SupplierTenderCreate.php | 1811 +++++++++++++------------- SupplierTenders.php | 20 +- SupplierTransInquiry.php | 12 +- SupplierTypes.php | 12 +- TaxAuthorities.php | 12 +- TaxAuthorityRates.php | 11 +- TaxCategories.php | 10 +- TaxGroups.php | 42 +- TaxProvinces.php | 11 +- TopItems.php | 14 +- UnitsOfMeasure.php | 18 +- UserBankAccounts.php | 470 ++++--- UserGLAccounts.php | 11 +- UserLocations.php | 520 ++++---- WOCanBeProducedNow.php | 506 +++---- WWW_Access.php | 34 +- WWW_Users.php | 11 +- WhereUsedInquiry.php | 12 +- WorkOrderEntry.php | 29 +- WorkOrderEntry.php.orig | 1064 +++++++++++++++ WorkOrderIssue.php | 12 +- Z_CheckAllocs.php | 12 +- Z_CheckDebtorsControl.php | 11 +- Z_ItemsWithoutPicture.php | 128 +- css/WEBootstrap/default.css | 7 +- css/aguapop/default.css | 990 +++++++------- css/aguapop/login.css | 170 +-- css/default/default.css | 22 +- css/fluid/default.css | 5 +- css/fresh/default.css | 13 +- css/gel/default.css | 26 +- css/professional-rtl/default.css | 9 +- css/professional/default.css | 9 +- css/silverwolf/default.css | 9 +- css/wood/default.css | 1138 ++++++++-------- css/xenos/default.css | 8 +- doc/Change.log | 1 + includes/InputSerialItemsFile.php | 12 +- includes/InputSerialItemsKeyed.php | 12 +- includes/OutputSerialItems.php | 12 +- 207 files changed, 10365 insertions(+), 11190 deletions(-) create mode 100644 WorkOrderEntry.php.orig diff --git a/AccountGroups.php b/AccountGroups.php index 648b81a1d..160bf3972 100644 --- a/AccountGroups.php +++ b/AccountGroups.php @@ -290,17 +290,8 @@ function CheckForRecursiveGroup($ParentGroupName, $GroupName, $db) {   '; - $k=0; //row colour counter while($myrow = DB_fetch_array($result)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - switch ($myrow['pandl']) { case -1: $PandLText=_('Yes'); @@ -313,7 +304,8 @@ function CheckForRecursiveGroup($ParentGroupName, $GroupName, $db) { break; } //end of switch statement - echo '' . htmlspecialchars($myrow['groupname'], ENT_QUOTES,'UTF-8') . ' + echo ' + ' . htmlspecialchars($myrow['groupname'], ENT_QUOTES,'UTF-8') . ' ' . $myrow['sectionname'] . ' ' . $myrow['sequenceintb'] . ' ' . $PandLText . ' diff --git a/AccountSections.php b/AccountSections.php index 99fda26d3..17ebd0b35 100644 --- a/AccountSections.php +++ b/AccountSections.php @@ -180,18 +180,10 @@   '; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - echo '', $myrow['sectionid'], ' + echo ' + ', $myrow['sectionid'], ' ', $myrow['sectionname'], ' ', _('Edit'), ' '; diff --git a/AddCustomerContacts.php b/AddCustomerContacts.php index 9523a9f2d..125ffd08b 100644 --- a/AddCustomerContacts.php +++ b/AddCustomerContacts.php @@ -139,24 +139,17 @@   '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf('%s + printf(' + %s %s %s %s %s %s ' . _('Edit') . ' - ' . _('Delete'). '', + ' . _('Delete'). ' + ', $myrow['contactname'], $myrow['role'], $myrow['phoneno'], diff --git a/AddCustomerNotes.php b/AddCustomerNotes.php index 3e37a0b9a..be35236bf 100644 --- a/AddCustomerNotes.php +++ b/AddCustomerNotes.php @@ -120,22 +120,15 @@ ' . _('Priority') . ' '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf('%s + printf(' + %s %s %s %s ' . _('Edit').' - ' . _('Delete'). '', + ' . _('Delete'). ' + ', ConvertSQLDate($myrow['date']), $myrow['note'], $myrow['href'], diff --git a/AddCustomerTypeNotes.php b/AddCustomerTypeNotes.php index 1fa703c71..ce42debc1 100644 --- a/AddCustomerTypeNotes.php +++ b/AddCustomerTypeNotes.php @@ -114,22 +114,15 @@ ' . _('Priority') . ' '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf('%s + printf(' + %s %s %s %s ' . _('Edit') . ' - ' . _('Delete') . '', + ' . _('Delete') . ' + ', $myrow['date'], $myrow['note'], $myrow['href'], diff --git a/AgedControlledInventory.php b/AgedControlledInventory.php index 1ce49c5f1..b82c41ac0 100644 --- a/AgedControlledInventory.php +++ b/AgedControlledInventory.php @@ -43,7 +43,6 @@ $TotalQty=0; $TotalVal=0; -$k=0; //row colour counter echo ' @@ -58,14 +57,6 @@ while ($LocQtyRow=DB_fetch_array($LocStockResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $DaysOld=floor(($Today - strtotime($LocQtyRow['createdate']))/(60*60*24)); $TotalQty +=$LocQtyRow['quantity']; $DispVal = '-----------'; @@ -75,7 +66,8 @@ $TotalVal +=($LocQtyRow['quantity'] *$LocQtyRow['cost']); } - printf(' + printf(' + @@ -93,20 +85,15 @@ ); } //while -if ($k==1){ - echo ''; - $k=0; -} else { - echo ''; - $k=1; -} - -echo ' +echo ' + + - '; -echo '
%s
%s %s %s %s
' . _('Total') . '
' . _('Total') . ' ' . locale_number_format($TotalQty,2) . ' ' . locale_number_format($TotalVal,2) . '
'; + + + '; include('includes/footer.php'); ?> \ No newline at end of file diff --git a/AnalysisHorizontalIncome.php b/AnalysisHorizontalIncome.php index 25fd37f8d..a2cb2ddaf 100644 --- a/AnalysisHorizontalIncome.php +++ b/AnalysisHorizontalIncome.php @@ -217,7 +217,6 @@ function RelativeChange($selected_period, $previous_period) { $ParentGroups=array(); $ParentGroups[$Level]=''; - $k=0;// Row colour counter. $DrawTotalLine = '  
@@ -374,14 +373,8 @@ function RelativeChange($selected_period, $previous_period) { if($_POST['Detail']=='Detailed') { if(isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND ($AccountTotal <> 0 OR $AccountTotalLY <> 0))) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo '', $myrow['accountcode'], ''; + echo ' + ', $myrow['accountcode'], ''; // ---> if($Section ==1) { echo ' ', htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false), ' diff --git a/AnalysisHorizontalPosition.php b/AnalysisHorizontalPosition.php index da4c83d45..e359080d4 100644 --- a/AnalysisHorizontalPosition.php +++ b/AnalysisHorizontalPosition.php @@ -179,7 +179,6 @@ function RelativeChange($selected_period, $previous_period) { $GroupTotal = array(0); $GroupTotalLY = array(0); - $k=0;// Row colour counter. $DrawTotalLine = '  
@@ -280,14 +279,8 @@ function RelativeChange($selected_period, $previous_period) { if($_POST['Detail']=='Detailed') { if(isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND (round($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) <> 0 OR round($AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']) <> 0))) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo '', $myrow['accountcode'], ' + echo ' + ', $myrow['accountcode'], ' ', htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false), ' ', locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), ' ', locale_number_format($AccountBalanceLY,$_SESSION['CompanyRecord']['decimalplaces']), ' diff --git a/Areas.php b/Areas.php index 7d604c212..133312953 100644 --- a/Areas.php +++ b/Areas.php @@ -149,17 +149,9 @@ ' . _('Area Name') . ' '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo '' . $myrow['areacode'] . ' + echo ' + ' . $myrow['areacode'] . ' ' . $myrow['areadescription'] . ' ' . _('Edit') . ' ' . _('Delete') . ' diff --git a/AutomaticTranslationDescriptions.php b/AutomaticTranslationDescriptions.php index d80a583ba..92a8c435b 100644 --- a/AutomaticTranslationDescriptions.php +++ b/AutomaticTranslationDescriptions.php @@ -34,7 +34,7 @@ $result = DB_query($SQL); if(DB_num_rows($result) != 0) { - echo '

' . _('Description Automatic Translation for empty translations') . '

'; + echo '

' . _('Description Automatic Translation for empty translations') . '

'; echo '
'; echo ''; $TableHeader = ' @@ -45,7 +45,6 @@ '; echo $TableHeader; - $k = 0; //row colour counter $i = 0; while ($myrow = DB_fetch_array($result)) { @@ -59,15 +58,9 @@ "WHERE stockid='" . $myrow['stockid'] . "' AND (language_id='" . $myrow['language_id'] . "')"; $update = DB_query($sql, $ErrMsg, $DbgMsg, true); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $i++; - printf(' + printf(' + @@ -90,15 +83,9 @@ "WHERE stockid='" . $myrow['stockid'] . "' AND (language_id='" . $myrow['language_id'] . "')"; $update = DB_query($sql, $ErrMsg, $DbgMsg, true); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $i++; - printf(' + printf(' + diff --git a/BOMInquiry.php b/BOMInquiry.php index 24a35a9c7..348d75250 100644 --- a/BOMInquiry.php +++ b/BOMInquiry.php @@ -114,22 +114,16 @@ echo $TableHeader; $j = 1; - $k = 0; //row colour counter + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K'){ $StockOnHand = 'N/A'; } else { $StockOnHand = locale_number_format($myrow['totalonhand'],2); } $tabindex=$j+4; - printf(' + printf(' + @@ -203,24 +197,16 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter $TotalCost = 0; while ($myrow=DB_fetch_array($BOMResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $ComponentLink = '' . $myrow['component'] . ''; /* Component Code Description Quantity Std Cost Total Cost */ - printf(' + printf(' + diff --git a/BOMs.php b/BOMs.php index dc85a1e8b..4e56879ad 100644 --- a/BOMs.php +++ b/BOMs.php @@ -671,25 +671,20 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { '; echo $TableHeader; if(count($BOMTree) == 0) { - echo ' + echo ''; } else { $UltimateParent = $SelectedParent; - $k = 0; $RowCounter = 1; $BOMTree = arrayUnique($BOMTree); foreach($BOMTree as $BOMItem){ $Level = $BOMItem['Level']; $Parent = $BOMItem['Parent']; $Component = $BOMItem['Component']; - if ($k==1){ - echo ''; - $k=0; - }else { - echo ''; - $k++; - } + + echo ''; + DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } @@ -1025,22 +1020,16 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { echo $TableHeader; $j = 1; - $k=0; //row colour counter + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '';; - $k=0; - } else { - echo '';; - $k++; - } if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ $StockOnHand = _('N/A'); } else { $StockOnHand = locale_number_format($myrow['totalonhand'],$myrow['decimalplaces']); } $tab = $j+3; - printf(' + printf(' + diff --git a/BOMs_SingleLevel.php b/BOMs_SingleLevel.php index 0e815fd26..42fb64062 100644 --- a/BOMs_SingleLevel.php +++ b/BOMs_SingleLevel.php @@ -566,25 +566,20 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { '; echo $TableHeader; if(count($BOMTree) == 0) { - echo ' + echo ''; } else { $UltimateParent = $SelectedParent; - $k = 0; $RowCounter = 1; $BOMTree = arrayUnique($BOMTree); foreach($BOMTree as $BOMItem){ $Level = $BOMItem['Level']; $Parent = $BOMItem['Parent']; $Component = $BOMItem['Component']; - if ($k==1){ - echo ''; - $k=0; - }else { - echo ''; - $k++; - } + + echo ''; + DisplayBOMItems($UltimateParent, $Parent, $Component, $Level, $db); } } @@ -909,22 +904,16 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) { echo $TableHeader; $j = 1; - $k=0; //row colour counter + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo '';; - $k=0; - } else { - echo '';; - $k++; - } if ($myrow['mbflag']=='A' OR $myrow['mbflag']=='K' OR $myrow['mbflag']=='G'){ $StockOnHand = _('N/A'); } else { $StockOnHand = locale_number_format($myrow['totalonhand'],$myrow['decimalplaces']); } $tab = $j+3; - printf(' + printf(' + diff --git a/BankAccountUsers.php b/BankAccountUsers.php index 1edfd9463..98f4fed93 100644 --- a/BankAccountUsers.php +++ b/BankAccountUsers.php @@ -168,18 +168,9 @@ '; -$k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + printf(' + ', diff --git a/BankAccounts.php b/BankAccounts.php index ac60f969e..eeba415d7 100644 --- a/BankAccounts.php +++ b/BankAccounts.php @@ -205,15 +205,7 @@ '; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['invoice']==0) { $DefaultBankAccount=_('No'); } elseif ($myrow['invoice']==1) { @@ -221,6 +213,7 @@ } elseif ($myrow['invoice']==2) { $DefaultBankAccount=_('Currency Default'); } + switch ($myrow['importformat']) { case 'MT940-ING': $ImportFormat = 'ING MT940'; @@ -232,7 +225,8 @@ $ImportFormat =''; } - printf(' + printf(' + diff --git a/BankMatching.php b/BankMatching.php index 449ea3b23..6c3cdd40b 100644 --- a/BankMatching.php +++ b/BankMatching.php @@ -285,7 +285,6 @@ '; - $k = 0; //row colour counter $i = 1; //no of rows counter while ($myrow=DB_fetch_array($PaymentsResult)) { @@ -294,7 +293,7 @@ $Outstanding = $myrow['amt']- $myrow['amountcleared']; if (ABS($Outstanding)<0.009){ /*the payment is cleared dont show the check box*/ - printf(' + printf(' @@ -314,14 +313,8 @@ $myrow['banktransid']); } else{ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/BankReconciliation.php b/BankReconciliation.php index c74e78309..64e6b07b2 100644 --- a/BankReconciliation.php +++ b/BankReconciliation.php @@ -176,7 +176,7 @@ echo '
' . _('Translated') . '
%s
%s %s %s %s
%s
%s %s %s %s
%s %s %s
%s
%s %s %s %s
' . _('No materials found.') . '
%s %s %s
' . _('No materials found.') . '
%s %s %s' . _('User Name') . '
%s
%s %s ' . _('Un-authorise') . '
' . _('Default for Invoices') . '
%s
%s
%s
%s
%s %s %s' . _('Clear') . ' / ' . _('Unclear') . '
%s %s %s
%s
%s %s %s %s
- + '; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + @@ -259,7 +251,7 @@ echo ' - + '; @@ -297,19 +289,11 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter $TotalUnclearedDeposits =0; while ($myrow=DB_fetch_array($UPChequesResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + @@ -335,7 +319,7 @@ echo ' - + '; @@ -343,7 +327,7 @@ echo ' - + '; diff --git a/COGSGLPostings.php b/COGSGLPostings.php index 8b382a59a..629e7ff29 100644 --- a/COGSGLPostings.php +++ b/COGSGLPostings.php @@ -97,18 +97,11 @@ '; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + + printf(' + @@ -205,17 +198,11 @@ '; - $k = 0; + while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - }else { - echo ''; - $k++; - } - - printf(' + + printf(' + diff --git a/CollectiveWorkOrderCost.php b/CollectiveWorkOrderCost.php index 26769b217..4c5f517b1 100644 --- a/CollectiveWorkOrderCost.php +++ b/CollectiveWorkOrderCost.php @@ -56,20 +56,14 @@ '; - $i = 0; + $TotalCost = 0; while ($myrow = DB_fetch_array($result)){ - if ($i==0) { - echo ''; - $i = 1; - } else { - echo ''; - $i = 0; - } $IssuedQty = - $myrow['qty']; $IssuedCost = $IssuedQty * $myrow['standardcost']; $TotalCost += $IssuedCost; - echo ' + echo ' + @@ -277,7 +271,7 @@
' . $CurrencyRow['bankaccountname'] . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); if ($_SESSION['CompanyRecord']['currencydefault']!=$CurrencyRow['currcode']){ @@ -220,19 +220,11 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter $TotalUnpresentedCheques =0; while ($myrow=DB_fetch_array($UPChequesResult)) { - if ($k==1){ - echo '
%s
%s %s %s %s

' . _('Total of all unpresented cheques') . ' ' . locale_number_format($TotalUnpresentedCheques,$CurrencyRow['currdecimalplaces']) . '
%s
%s %s %s %s

' . _('Total of all uncleared deposits') . ' ' . locale_number_format($TotalUnclearedDeposits,$CurrencyRow['currdecimalplaces']) . '

' . _('Bank statement balance should be') . ' (' . $CurrencyRow['currcode'] . ') ' . locale_number_format($FXStatementBalance,$CurrencyRow['currdecimalplaces']) . '
' . _('Sales Type') . ' ' . _('COGS Account') . '
%s
%s %s %s %s' . _('Sales Type') . ' ' . _('GL Account') . '
%s
%s %s %s %s' . _('Issued Cost') . ' ' . _('Work Order') . '
' . $myrow['stockid'] . '
' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['trandate'] . ' ' . locale_number_format($IssuedQty,$myrow['decimalplaces']) . '
'; - echo '
+ echo ' @@ -326,19 +320,11 @@ ' . _('On Hand') . ' ' . _('Units') . ' '; - $k=0; //row colour counter while ($myrow=DB_fetch_array($StockItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + %s %s %s @@ -457,17 +443,8 @@ ' . _('Required Date') . ' '; - $k=0; //row colour counter while ($myrow=DB_fetch_array($WorkOrdersResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $ModifyPage = $RootPath . '/WorkOrderEntry.php?WO=' . $myrow['wo']; $Status_WO = $RootPath . '/WorkOrderStatus.php?WO=' .$myrow['wo'] . '&StockID=' . $myrow['stockid']; $Receive_WO = $RootPath . '/WorkOrderReceive.php?WO=' .$myrow['wo'] . '&StockID=' . $myrow['stockid']; @@ -479,7 +456,8 @@ $FormatedStartDate = ConvertSQLDate($myrow['startdate']); - printf(' + printf(' + %s ' . _('Status') . ' ' . _('Issue To') . ' @@ -513,7 +491,7 @@ //end of while loop echo ' -
+
'; } diff --git a/ConfirmDispatch_Invoice.php b/ConfirmDispatch_Invoice.php index 843537d21..0566514b7 100644 --- a/ConfirmDispatch_Invoice.php +++ b/ConfirmDispatch_Invoice.php @@ -373,7 +373,6 @@ /*show the line items on the order with the quantity being dispatched available for modification */ -$k=0; //row colour counter $j=0; //used for tabindex foreach ($_SESSION['Items'.$identifier]->LineItems as $LnItm) { @@ -382,12 +381,8 @@ if ($LnItm->QOHatLoc < $LnItm->Quantity and ($LnItm->MBflag == 'B' or $LnItm->MBflag == 'M')) { /*There is a stock deficiency in the stock location selected */ $RowStarter = ''; //rows show red where stock deficiency - } elseif ($k == 1) { - $RowStarter = ''; - $k = 0; } else { - $RowStarter = ''; - $k = 1; + $RowStarter = ''; } if (sizeOf($LnItm->SerialItems) > 0) { diff --git a/ContractBOM.php b/ContractBOM.php index b1981c6cd..78fbadef9 100644 --- a/ContractBOM.php +++ b/ContractBOM.php @@ -246,7 +246,7 @@ '; $_SESSION['Contract'.$identifier]->total = 0; - $k = 0; //row colour counter + $TotalCost =0; foreach ($_SESSION['Contract'.$identifier]->ContractBOM as $ContractComponent) { @@ -254,21 +254,15 @@ $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CompanyRecord']['decimalplaces']); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $ContractComponent->StockID . ' + echo ' + ' . $ContractComponent->StockID . ' ' . $ContractComponent->ItemDescription . ' ' . $ContractComponent->UOM . ' ' . locale_number_format($ContractComponent->ItemCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . $DisplayLineTotal . ' - ' . _('Delete') . ''; + ' . _('Delete') . ' + '; $TotalCost += $LineTotal; } @@ -357,18 +351,9 @@ '; echo $TableHeader; - $k=0; //row colour counter $i=0; while ($myrow=DB_fetch_array($SearchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); if (extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { @@ -384,7 +369,8 @@ $ImageSource = _('No Image'); } - echo '' . $myrow['stockid'] . ' + echo ' + ' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['units'] . ' ' . $ImageSource . ' diff --git a/ContractOtherReqts.php b/ContractOtherReqts.php index 77575a60e..766bb7cd3 100644 --- a/ContractOtherReqts.php +++ b/ContractOtherReqts.php @@ -101,22 +101,15 @@ '; $_SESSION['Contract'.$identifier]->total = 0; - $k = 0; //row colour counter + $TotalCost =0; foreach ($_SESSION['Contract'.$identifier]->ContractReqts as $ContractReqtID => $ContractComponent) { $LineTotal = $ContractComponent->Quantity * $ContractComponent->CostPerUnit; $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CompanyRecord']['decimalplaces']); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + ' . $DisplayLineTotal . ' diff --git a/Contracts.php b/Contracts.php index 391febcfc..efc48662f 100644 --- a/Contracts.php +++ b/Contracts.php @@ -791,21 +791,13 @@ echo $TableHeader; $j = 1; - $k = 0; //row counter to determine background colour + $LastCustomer=''; while ($myrow=DB_fetch_array($result_CustSelect)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } if ($LastCustomer != $myrow['name']) { - echo '' . $myrow['name'] . ''; + echo '' . $myrow['name'] . ''; } else { - echo ''; + echo ''; } echo ' diff --git a/CounterReturns.php b/CounterReturns.php index 62e8b22af..2fcc73666 100644 --- a/CounterReturns.php +++ b/CounterReturns.php @@ -682,26 +682,18 @@ $TaxTotals = array(); $TaxGLCodes = array(); $TaxTotal =0; - $k =0; //row colour counter + foreach ($_SESSION['Items' . $identifier]->LineItems as $ReturnItemLine) { $SubTotal = $ReturnItemLine->Quantity * $ReturnItemLine->Price * (1 - $ReturnItemLine->DiscountPercent); $DisplayDiscount = locale_number_format(($ReturnItemLine->DiscountPercent * 100),2); $QtyReturned = $ReturnItemLine->Quantity; - if ($k==1){ - $RowStarter = ''; - $k=0; - } else { - $RowStarter = ''; - $k=1; - } - - echo $RowStarter; echo ''; echo ''; - echo '' . $ReturnItemLine->StockID . ' + echo ' + ' . $ReturnItemLine->StockID . ' ' . $ReturnItemLine->ItemDescription . ''; echo ''; @@ -740,8 +732,8 @@ echo '' . _('Delete') . ''; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ - echo $RowStarter; - echo '' . _('Narrative') . ':
'; + echo ' + ' . _('Narrative') . ':
'; } else { echo ''; } @@ -752,7 +744,7 @@ } /* end of loop around items */ - echo ''; + echo ''; echo '' . _('Total') . ''; echo '' . locale_number_format(($_SESSION['Items' . $identifier]->total),$_SESSION['Items' . $identifier]->CurrDecimalPlaces) . ' ' . locale_number_format($TaxTotal,$_SESSION['Items' . $identifier]->CurrDecimalPlaces) . ' @@ -1655,12 +1647,12 @@ functionalexrate, : size="20" maxlength="25" value="" /> - : + : - - + + '; echo ' - + '; $TableHeader = ' @@ -1694,7 +1686,6 @@ functionalexrate, ' . _('Quantity') . ''; echo $TableHeader; $i=0; - $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { @@ -1731,17 +1722,10 @@ functionalexrate, // Get the QOO dues to Work Orders for all locations. Function defined in SQL_CommonFunctions.inc $QOO += GetQuantityOnOrderDueToWorkOrders($myrow['stockid'], ''); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $Available = $QOH - $DemandQty + $QOO; - printf('%s + printf(' + %s %s %s %s @@ -1774,7 +1758,7 @@ functionalexrate, - + diff --git a/CounterSales.php b/CounterSales.php index d640fc937..4d3b98831 100644 --- a/CounterSales.php +++ b/CounterSales.php @@ -765,7 +765,7 @@ $TaxTotals = array(); $TaxGLCodes = array(); $TaxTotal =0; - $k =0; //row colour counter + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { $SubTotal = round($OrderLine->Quantity * $OrderLine->Price * (1 - $OrderLine->DiscountPercent),$_SESSION['Items'.$identifier]->CurrDecimalPlaces); @@ -776,12 +776,8 @@ if ($OrderLine->QOHatLoc < $OrderLine->Quantity AND ($OrderLine->MBflag=='B' OR $OrderLine->MBflag=='M')) { /*There is a stock deficiency in the stock location selected */ $RowStarter = ''; - } elseif ($k==1){ - $RowStarter = ''; - $k=0; } else { - $RowStarter = ''; - $k=1; + $RowStarter = ''; } echo $RowStarter; @@ -848,7 +844,7 @@ } /* end of loop around items */ - echo ''; + echo ''; if (in_array($_SESSION['PageSecurityArray']['OrderEntryDiscountPricing'], $_SESSION['AllowedPageSecurityTokens'])){ echo '' . _('Total') . ''; } else { @@ -2119,7 +2115,6 @@ functionalexrate, echo $TableHeader; $i = 0; $j = 1; - $k = 0; //row colour counter while ($myrow=DB_fetch_array($result2)) { // This code needs sorting out, but until then : @@ -2158,17 +2153,10 @@ functionalexrate, // Get the QOO due to Work Orders for all locations. Function defined in SQL_CommonFunctions.inc $QOO += GetQuantityOnOrderDueToWorkOrders($myrow['stockid'], ''); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $Available = $QOH - $DemandQty + $QOO; - printf('%s + printf(' + %s %s %s %s @@ -2194,7 +2182,7 @@ functionalexrate, #end of page full new headings if } #end of while loop for Frequently Ordered Items - echo ''; + echo ''; echo ''; } //end of if Frequently Ordered Items > 0 if (isset($msg)){ @@ -2238,8 +2226,8 @@ functionalexrate, echo '" /> - - + +
@@ -2258,7 +2246,7 @@ functionalexrate, echo ''; echo ' - + @@ -2272,7 +2260,6 @@ functionalexrate, '; $i=0; - $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { @@ -2309,17 +2296,10 @@ functionalexrate, // Get the QOO dues to Work Orders for all locations. Function defined in SQL_CommonFunctions.inc $QOO += GetQuantityOnOrderDueToWorkOrders($myrow['stockid'], ''); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $Available = $QOH - $DemandQty + $QOO; - printf(' + printf(' + @@ -2352,7 +2332,7 @@ functionalexrate, - +
' . _('Quantity') . '
%s
%s %s %s %s
diff --git a/CreditStatus.php b/CreditStatus.php index 160d1153c..93a90e023 100644 --- a/CreditStatus.php +++ b/CreditStatus.php @@ -153,7 +153,6 @@ ' . _('Disallow Invoices') . ' '; - $k=0; //row colour counter while ($myrow=DB_fetch_array($result)) { if ($myrow['dissallowinvoices']==0) { @@ -161,15 +160,9 @@ } else { $DissallowText = '' . _('NO INVOICING') . ''; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf('%s + printf(' + %s %s %s ' . _('Edit') . ' diff --git a/Credit_Invoice.php b/Credit_Invoice.php index 729de5742..9392286ac 100644 --- a/Credit_Invoice.php +++ b/Credit_Invoice.php @@ -323,7 +323,6 @@ /*show the line items on the invoice with the quantity to credit and price being available for modification */ -$k=0; //row colour counter $j=0; //row counter $tabindex=1;// Tab order of an element when the "tab" button is used for navigating. @@ -336,17 +335,9 @@ if(!isset($_POST['ProcessCredit'])) { - if($k==1) { - $RowClass='EvenTableRows'; - $k=0; - } else { - $RowClass='OddTableRows'; - $k=1; - } - $j++; // Use of htmlspecialchars to convert ampersand, double_quote, single_quote, less_than, and greater_than to html entities to to preserve their meanings. - echo ' + echo ' ' . $LnItm->StockID . ' ' . $LnItm->ItemDescription . ' ' . locale_number_format($LnItm->Quantity,$LnItm->DecimalPlaces) . ' diff --git a/Currencies.php b/Currencies.php index 6bf54756f..693e4a775 100644 --- a/Currencies.php +++ b/Currencies.php @@ -314,7 +314,6 @@ ' . _('Maintenance') . ' '; - $k=0; //row colour counter /*Get published currency rates from Eurpoean Central Bank */ if ($_SESSION['UpdateCurrencyRatesDaily'] != '0') { $CurrencyRatesArray = GetECBCurrencyRates(); @@ -325,12 +324,8 @@ while ($myrow = DB_fetch_array($result)) { if ($myrow['currabrev']==$FunctionalCurrency){ echo ''; - } elseif ($k==1){ - echo ''; - $k=0; } else { - echo ''; - $k++; + echo ''; } // Lets show the country flag $ImageFile = 'flags/' . mb_strtoupper($myrow['currabrev']) . '.gif'; diff --git a/CustItem.php b/CustItem.php index 290731007..962e2681b 100644 --- a/CustItem.php +++ b/CustItem.php @@ -149,16 +149,10 @@ '; echo $TableHeader; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($custitemResult)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - printf('%s + printf(' + %s %s %s %s @@ -302,16 +296,10 @@ ' . _('Address 3') . ' '; echo $TableHeader; - $k = 0; + while ($myrow = DB_fetch_array($debtorsmasterResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - printf(' + printf(' + %s %s %s diff --git a/CustWhereAlloc.php b/CustWhereAlloc.php index 78bd421ec..037151a98 100755 --- a/CustWhereAlloc.php +++ b/CustWhereAlloc.php @@ -154,17 +154,9 @@ '; $RowCounter = 1; - $k = 0; //row colour counter $AllocsTotal = 0; while($myrow=DB_fetch_array($TransResult)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if($myrow['type']==11) { $TransType = _('Credit Note'); @@ -173,7 +165,8 @@ } else { $TransType = _('Receipt'); } - echo ' ', ConvertSQLDate($myrow['trandate']), ' + echo ' + ', ConvertSQLDate($myrow['trandate']), ' ' . $TransType . ' ' . $myrow['transno'] . ' ' . $myrow['reference'] . ' diff --git a/CustomerAccount.php b/CustomerAccount.php index 45ed7cd27..ea0908b4f 100644 --- a/CustomerAccount.php +++ b/CustomerAccount.php @@ -262,7 +262,6 @@ '; -$k = 0; //row colour counter $OutstandingOrSettled = ''; if ($_SESSION['InvoicePortraitFormat'] == 1) { //Invoice/credits in portrait $PrintCustomerTransactionScript = 'PrintCustTransPortrait.php'; @@ -279,20 +278,11 @@ $OutstandingOrSettled='Outstanding'; } - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - $FormatedTranDate = ConvertSQLDate($MyRow['trandate']); - if ($MyRow['type']==10) { //its an invoice - echo '', _($MyRow['typename']), ' + echo ' + ', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], ' @@ -316,7 +306,8 @@ '; } elseif ($MyRow['type'] == 11) { - echo '', _($MyRow['typename']), ' + echo ' + ', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], ' @@ -345,7 +336,8 @@ /* Show transactions where: * - Is receipt */ - echo '', _($MyRow['typename']), ' + echo ' + ', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], ' @@ -369,7 +361,8 @@ * - Is a negative receipt * - User cannot view GL transactions */ - echo '', _($MyRow['typename']), ' + echo ' + ', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], ' diff --git a/CustomerAllocations.php b/CustomerAllocations.php index 7ff2ef77d..073f8e7d4 100644 --- a/CustomerAllocations.php +++ b/CustomerAllocations.php @@ -390,16 +390,14 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); if ( $AllocnItem->ID == $_POST['AllocTrans'] ) { - echo ''; $curTrans = _('Being allocated'); } else if ($AllocnItem->AllocAmt > 0) { - echo ''; } else { - echo ''; $curTrans = " "; } - echo '' . _($AllocnItem->TransType) . ' + echo ' + ' . _($AllocnItem->TransType) . ' ' . $AllocnItem->TypeNo . ' ' . $AllocnItem->TransDate . ' ' . locale_number_format($AllocnItem->TransAmount,$_SESSION['Alloc']->CurrDecimalPlaces) . ' @@ -495,16 +493,10 @@ } echo ''; echo $TableHeader; - $k=0; + while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo '';; - $k++; - } - echo ' + echo ' + @@ -557,14 +549,13 @@ echo '
' . _($myrow['typename']) . '
' . _($myrow['typename']) . ' ' . $myrow['name'] . ' ' . $myrow['debtorno'] . ' ' . $myrow['transno'] . '
'; echo $TableHeader; - $k=0; while ($myrow = DB_fetch_array($result)) { $AllocateLink = '' . _('Allocate') . ''; if ( $CurrentDebtor != $myrow['debtorno'] ) { if ( $CurrentTransaction > 1 ) { - echo ' + echo ' @@ -590,15 +581,8 @@ $AllocateLink = ' '; } - if ($k==1) { - echo ''; - $k=0; - } else { - echo '';; - $k++; - } - - echo ' + echo ' + @@ -617,7 +601,7 @@ if ($NoOfUnallocatedTrans == 0) { prnMsg(_('There are no allocations to be done'),'info'); } else { - echo ' + echo ' diff --git a/CustomerBranches.php b/CustomerBranches.php index 868a30fd5..1e4e0466d 100644 --- a/CustomerBranches.php +++ b/CustomerBranches.php @@ -410,17 +410,10 @@ '; - $k=0; do { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/CustomerInquiry.php b/CustomerInquiry.php index b791af647..5024b3bc0 100644 --- a/CustomerInquiry.php +++ b/CustomerInquiry.php @@ -154,7 +154,7 @@ $CustomerRecord['overdue2'] = 0; } -echo '
+echo ''; @@ -265,17 +265,8 @@
'; -$k = 0; //row colour counter while ($MyRow = DB_fetch_array($TransResult)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $FormatedTranDate = ConvertSQLDate($MyRow['trandate']); if ($_SESSION['InvoicePortraitFormat'] == 1) { //Invoice/credits in portrait @@ -292,7 +283,8 @@ * - User can raise credits * - User can view GL transactions */ - echo ' + echo ' + @@ -338,7 +330,8 @@ * - User can raise credits * - User cannot view GL transactions */ - echo ' + echo ' + @@ -382,7 +375,8 @@ * - User cannot raise credits * - User cannot view GL transactions */ - echo ' + echo ' + @@ -419,7 +413,8 @@ * - User can view GL transactions */ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) { - echo ' + echo ' + @@ -465,7 +460,8 @@ * - Is credit note * - User cannot view GL transactions */ - echo ' + echo ' + @@ -508,7 +504,8 @@ * - User can view GL transactions */ if ($_SESSION['CompanyRecord']['gllink_debtors'] == 1 and in_array($_SESSION['PageSecurityArray']['GLTransInquiry.php'], $_SESSION['AllowedPageSecurityTokens'])) { - echo ' + echo ' + @@ -540,7 +537,8 @@ * - Is credit note * - User cannot view GL transactions */ - echo ' + echo ' + @@ -569,7 +567,8 @@ * - Is a negative receipt * - User can view GL transactions */ - echo ' + echo ' + @@ -596,7 +595,8 @@ * - Is a negative receipt * - User cannot view GL transactions */ - echo ' + echo ' + @@ -619,7 +619,8 @@ * - Is a misc transaction * - User can view GL transactions */ - echo ' + echo ' + @@ -646,7 +647,8 @@ * - Is a misc transaction * - User cannot view GL transactions */ - echo ' + echo ' + diff --git a/CustomerReceipt.php b/CustomerReceipt.php index 2dc272871..99e417393 100644 --- a/CustomerReceipt.php +++ b/CustomerReceipt.php @@ -279,7 +279,6 @@ $BatchReceiptsTotal = 0; //in functional currency $BatchDiscount = 0; //in functional currency $BatchDebtorTotal = 0; //in functional currency - $k=0; //Table row counter for row styles $CustomerReceiptCounter=1; //Count lines of customer receipts in this batch echo '
@@ -304,19 +303,12 @@ foreach ($_SESSION['ReceiptBatch' . $identifier]->Items as $ReceiptItem) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $ReceiptItem->GLCode . "'"; $Result=DB_query($SQL); $myrow=DB_fetch_array($Result); - echo ' + echo ' + @@ -1249,18 +1241,11 @@ functionalexrate, '; echo $TableHeader; $j = 1; - $k = 0; //row counter to determine background colour while ($myrow=DB_fetch_array($CustomerSearchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + ', $myrow['debtorno'], diff --git a/CustomerTransInquiry.php b/CustomerTransInquiry.php index 98abc4d9f..dcc45baa6 100644 --- a/CustomerTransInquiry.php +++ b/CustomerTransInquiry.php @@ -110,19 +110,11 @@ echo $TableHeader; $RowCounter = 1; - $k = 0; //row colour counter while ($myrow=DB_fetch_array($TransResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - $format_base = ' + $format_base = ' + diff --git a/CustomerTypes.php b/CustomerTypes.php index eef8df4c8..ad24cb38d 100644 --- a/CustomerTypes.php +++ b/CustomerTypes.php @@ -189,18 +189,10 @@ '; -$k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } -printf(' + printf(' + diff --git a/Customers.php b/Customers.php index 305859591..223d92bf9 100644 --- a/Customers.php +++ b/Customers.php @@ -1132,19 +1132,12 @@ '; } - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } if (isset($_GET['Modify'])) { - printf(' + printf(' + @@ -1157,7 +1150,8 @@ $myrow['email'], $myrow['notes']); } else { - printf(' + printf(' + diff --git a/DailyBankTransactions.php b/DailyBankTransactions.php index cb69b5b7e..0e93d3a36 100644 --- a/DailyBankTransactions.php +++ b/DailyBankTransactions.php @@ -166,33 +166,21 @@ $LocalCurrTotal =0; $Balance = 0; $j = 0; - $k = 0; while ($myrow = DB_fetch_array($result)){ if ($j == 0) { if (ABS($myrow['prebalance'])>0.0001) { - if ($k == 0) { - echo ''; - $k = 1; - } else { - echo ''; - $k = 0; - } $Balance += $myrow['prebalance']; - echo ' + echo ' + - '; + + '; $j++; } } - if ($k == 0) { - echo ''; - $k = 1; - } else { - echo ''; - $k = 0; - } + //check the GL narrative if ($myrow['type'] == 2) { $myrow['typeid'] = 1; @@ -217,7 +205,7 @@ $Matched=_('No'); } - echo ' + echo ' @@ -232,13 +220,12 @@ '; } - if ($k == 0 ) { - echo ''; - } else { - echo ''; - } - echo ' + echo ' + + + +
' . locale_number_format($Balance,$CurrDecimalPlaces) . ' ' . $CurrCode . ' ' . _('Balance') . '
' . _($myrow['typename']) . '
' . _($myrow['typename']) . ' ' . $myrow['name'] . ' ' . $myrow['debtorno'] . ' ' . $myrow['transno'] . '
' . locale_number_format($Balance,$CurrDecimalPlaces) . ' ' . $CurrCode . ' ' . _('Balance') . '' . _('Enabled?') . '
%s
%s %s %s %s
', _($MyRow['typename']), '
', _($MyRow['typename']), ' ' . $MyRow['transno'] . ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ' . $MyRow['transno'] . ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ' . $MyRow['transno'] . ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ' . $MyRow['transno'] . ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ' . $MyRow['transno'] . ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', _($MyRow['typename']), '
', _($MyRow['typename']), ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '', $MyRow['typename'], '
', $MyRow['typename'], ' ', $MyRow['transno'], ' ', ConvertSQLDate($MyRow['trandate']), ' ', $MyRow['branchcode'], '
' . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . '
' . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . ' ' . $_SESSION['ReceiptBatch' . $identifier]->DateBanked . ' ' . $ReceiptItem->CustomerName . ' ' . $ReceiptItem->GLCode . ' - ' . $myrow['accountname'] . '
%s
%s
%s %s %s %s' . _('Type Name') . '
%s
%s %s ' . _('Edit') . ' ' . _('Delete') . '
%s
%s %s %s %s%s
%s %s %s %s
' . _('Previous Balance') . '
' . _('Previous Balance') . ' ' . locale_number_format($myrow['prebalance'],$BankDetailRow['decimalplaces']) . '
' . ConvertSQLDate($myrow['transdate']) . ' ' . _($myrow['typename']) . ' ' . $myrow['transno'] . '' . $GLNarrative . '
' . _('Account Balance') . '' .locale_number_format($Balance,$BankDetailRow['decimalplaces']) . '
' . _('Account Balance') . '' .locale_number_format($Balance,$BankDetailRow['decimalplaces']) . '
'; echo '
';// div id="Report". } //end if no bank trans in the range to show diff --git a/Dashboard.php b/Dashboard.php index 4993bf008..128d62d9c 100644 --- a/Dashboard.php +++ b/Dashboard.php @@ -67,7 +67,6 @@ '; $j = 1; - $k = 0;// Row colour counter. $TotBal = 0; $TotCurr = 0; $TotDue = 0; @@ -164,13 +163,6 @@ } while($AgedAnalysis = DB_fetch_array($CustomerResult)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $CurrDecimalPlaces = $AgedAnalysis['decimalplaces']; $DisplayDue = locale_number_format($AgedAnalysis['due']-$AgedAnalysis['overdue1'],$CurrDecimalPlaces); $DisplayCurrent = locale_number_format($AgedAnalysis['balance']-$AgedAnalysis['due'],$CurrDecimalPlaces); @@ -183,7 +175,8 @@ $TotDue += ($AgedAnalysis['due']-$AgedAnalysis['overdue1']); $TotOD1 += ($AgedAnalysis['overdue1']-$AgedAnalysis['overdue2']); $TotOD2 += $AgedAnalysis['overdue2']; - echo ' ', + echo ' + ', $AgedAnalysis['debtorno'], ' - ', $AgedAnalysis['name'], ' ', $DisplayBalance, ' ', $DisplayCurrent, ' @@ -262,14 +255,8 @@ $DisplayDueDate = CalcDueDate($DisplayTranDate, $DetailTrans['dayinfollowingmonth'], $DetailTrans['daysbeforedue']); - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', _($DetailTrans['typename']), '',// Should it be left (text field) ? + echo ' + ', _($DetailTrans['typename']), '',// Should it be left (text field) ? '', $DetailTrans['transno'], ' ', $DisplayTranDate, ' ', $DisplayDueDate, ' @@ -284,14 +271,8 @@ } //end customer aged analysis while loop // Print totals of 'Overdue Customer Balances': - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', _('Totals'), ' + echo ' + ', _('Totals'), '       @@ -385,32 +366,18 @@ unset($Allocs); $Allocs = array(); $AllocCounter =0; - $k = 0; //row colour counter while($DetailTrans = DB_fetch_array($TransResult)) { if($DetailTrans['supplierid'] != $SupplierID) { /*Need to head up for a new suppliers details */ - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $SupplierID = $DetailTrans['supplierid']; $SupplierName = $DetailTrans['suppname']; //$AccumBalance = 0; $AccumDiffOnExch = 0; - echo '', $DetailTrans['supplierid'], ' - ', $DetailTrans['suppname'], ' - ', $DetailTrans['terms'], ' + echo ' + ', $DetailTrans['supplierid'], ' - ', $DetailTrans['suppname'], ' - ', $DetailTrans['terms'], ' '; } - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $DisplayFormat = ''; if((time()-(60*60*24)) > strtotime($DetailTrans['duedate'])) { $DisplayFormat = ' style="color:red;"'; @@ -418,14 +385,16 @@ $DislayTranDate = ConvertSQLDate($DetailTrans['trandate']); $AccumBalance += $DetailTrans['balance']; if($DetailTrans['type'] == 20) {// If Purchase Invoice: - echo '', _($DetailTrans['typename']), ' + echo ' + ', _($DetailTrans['typename']), ' ', $DislayTranDate, ' ', $DetailTrans['suppreference'], ' ', locale_number_format($DetailTrans['balance'], $CurrDecimalPlaces), ' ', ConvertSQLDate($DetailTrans['duedate']), ' '; } else {// If NOT Purchase Invoice (Creditors Payment): - echo '', _($DetailTrans['typename']), ' + echo ' + ', _($DetailTrans['typename']), ' ', $DislayTranDate, ' ', $DetailTrans['suppreference'], ' ', locale_number_format($DetailTrans['balance'], $CurrDecimalPlaces), ' @@ -435,14 +404,8 @@ } /*end while there are detail transactions to show */ } /* end while there are suppliers to retrieve transactions for */ - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', _('Grand Total Payments Due'), ' + echo ' + ', _('Grand Total Payments Due'), '     ', locale_number_format($AccumBalance, $CurrDecimalPlaces), ' @@ -479,16 +442,7 @@ $DbgMsg = _('The SQL used to retrieve the bank account details was') . '
' . $Sql; $result1 = DB_query($Sql,$ErrMsg,$DbgMsg); - $k = 0; //row colour counter - while($myrow = DB_fetch_array($result1)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } /*Is the account a balance sheet or a profit and loss account */ $result = DB_query("SELECT pandl FROM accountgroups @@ -569,7 +523,8 @@ $PeriodTotal += $myrow2['amount']; } $DisplayBalance=locale_number_format(($RunningTotal),$_SESSION['CompanyRecord']['decimalplaces']); - echo '', $myrow['accountcode'], ' - ', $myrow['accountname'], ' + echo ' + ', $myrow['accountcode'], ' - ', $myrow['accountname'], ' ', $myrow['bankaccountname'], ' ', $DisplayBalance, ' '; @@ -630,7 +585,6 @@ /*show a table of the orders returned by the SQL */ if(DB_num_rows($SalesOrdersResult)>0) { - $k = 0; //row colour counter $OrdersTotal = 0; $FontColor = ''; @@ -641,14 +595,9 @@ if(DateDiff(Date($_SESSION['DefaultDateFormat']), $OrderDate, 'd') > 5) { $FontColor = ' style="color:green; font-weight:bold"'; } - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', $MyRow['orderno'], ' + + echo ' + ', $MyRow['orderno'], ' ', $MyRow['name'], ' ', $MyRow['brname'], ' ', $MyRow['customerref'], ' diff --git a/DeliveryDetails.php b/DeliveryDetails.php index 6145b7e24..1069c42bb 100644 --- a/DeliveryDetails.php +++ b/DeliveryDetails.php @@ -887,7 +887,6 @@ $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; $_SESSION['Items'.$identifier]->totalWeight = 0; - $k = 0;//row colour counter foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { @@ -898,15 +897,8 @@ $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $StockItem->StockID . ' + echo ' + ' . $StockItem->StockID . ' ' . $StockItem->ItemDescription . ' ' . $DisplayQuantity . ' ' . $StockItem->Units . ' @@ -921,7 +913,7 @@ } $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); - echo ' + echo ' ' . _('TOTAL Excl Tax/Freight') . ' ' . $DisplayTotal . ' @@ -931,7 +923,7 @@ $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); echo '
- + @@ -956,7 +948,7 @@ $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; $_SESSION['Items'.$identifier]->totalWeight = 0; - $k=0;// row colour counter + foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { $LineTotal = $StockItem->Quantity * $StockItem->Price * (1 - $StockItem->DiscountPercent); @@ -964,14 +956,8 @@ $DisplayPrice = locale_number_format($StockItem->Price,$_SESSION['Items'.$identifier]->CurrDecimalPlaces); $DisplayQuantity = locale_number_format($StockItem->Quantity,$StockItem->DecimalPlaces); - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + diff --git a/Departments.php b/Departments.php index 445e63b5b..b57c5a3e9 100644 --- a/Departments.php +++ b/Departments.php @@ -170,18 +170,10 @@ '; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - echo ' + echo ' + diff --git a/DiscountCategories.php b/DiscountCategories.php index 1b6c62102..a35c0ddad 100644 --- a/DiscountCategories.php +++ b/DiscountCategories.php @@ -221,19 +221,11 @@ '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&StockID=' . $myrow['stockid'] . '&DiscountCategory=' . $myrow['discountcategory']; - printf(' + printf(' + ', diff --git a/DiscountMatrix.php b/DiscountMatrix.php index 0feb7080d..58389fa16 100644 --- a/DiscountMatrix.php +++ b/DiscountMatrix.php @@ -164,19 +164,11 @@ '; -$k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&DiscountCategory=' . $myrow['discountcategory'] . '&QuantityBreak=' . $myrow['quantitybreak']; - printf(' + printf(' + diff --git a/FTP_RadioBeacon.php b/FTP_RadioBeacon.php index 870a13947..e63c1b612 100644 --- a/FTP_RadioBeacon.php +++ b/FTP_RadioBeacon.php @@ -61,25 +61,18 @@ echo $TableHeader; $j = 1; -$k=0; //row colour counter while ($myrow=DB_fetch_array($SalesOrdersResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $FTPDispatchNote = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?OrderNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = locale_number_format($myrow['ordervalue'],2); $FormatedDateLastSent = ConvertSQLDate($myrow['datepackingslipprinted']); - $ModifyPage = $RootPath . 'SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; + $ModifyPage = $RootPath . 'SelectOrderItems.php?ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['printedpackingslip'] ==1){ - printf(' + printf(' + @@ -100,7 +93,8 @@ $FormatedOrderValue, $FormatedDateLastSent); } else { - printf(' + printf(' + diff --git a/Factors.php b/Factors.php index 380b0241c..7a27d3a4f 100644 --- a/Factors.php +++ b/Factors.php @@ -310,16 +310,10 @@ email FROM factorcompanies"; $result=DB_query($sql); - $j=1; + while ($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - echo ' + echo ' + diff --git a/FixedAssetCategories.php b/FixedAssetCategories.php index 536acb470..3d9d4cbac 100644 --- a/FixedAssetCategories.php +++ b/FixedAssetCategories.php @@ -171,17 +171,9 @@ '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/FixedAssetDepreciation.php b/FixedAssetDepreciation.php index 01fb965a7..4ee6ac8f1 100644 --- a/FixedAssetDepreciation.php +++ b/FixedAssetDepreciation.php @@ -109,7 +109,6 @@ $TotalCategoryDepn = 0; $RowCounter = 0; -$k=0; while ($AssetRow=DB_fetch_array($AssetsResult)) { if ($AssetCategoryDescription != $AssetRow['categorydescription'] OR $AssetCategoryDescription =='0'){ @@ -151,14 +150,9 @@ echo $Heading; $RowCounter =0; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + + echo ' + diff --git a/FreightCosts.php b/FreightCosts.php index 5bb7a1540..d0c115510 100644 --- a/FreightCosts.php +++ b/FreightCosts.php @@ -224,7 +224,6 @@ echo $TableHeader; - $k = 0; //row counter to determine background colour $PageFullCounter=0; while ($myrow = DB_fetch_row($result)) { @@ -234,15 +233,9 @@ echo $TableHeader; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/GLAccountInquiry.php b/GLAccountInquiry.php index 5b73e2508..c81a2b8c2 100644 --- a/GLAccountInquiry.php +++ b/GLAccountInquiry.php @@ -229,7 +229,6 @@ $PeriodNo = -9999; $ShowIntegrityReport = False; $j = 1; - $k = 0; //row colour counter $IntegrityReport=''; while($myrow=DB_fetch_array($TransResult)) { if($myrow['periodno']!=$PeriodNo) { @@ -271,13 +270,6 @@ $PeriodTotal = 0; } - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $BankRef = ''; $OrgAmt = ''; $Currency = ''; @@ -333,7 +325,8 @@ } $RunningTotal += $myrow['amount']; $PeriodTotal += $myrow['amount']; - echo ' + echo ' + diff --git a/GLAccountUsers.php b/GLAccountUsers.php index 836cf428c..a219dc771 100644 --- a/GLAccountUsers.php +++ b/GLAccountUsers.php @@ -165,16 +165,9 @@ WHERE glaccountusers.accountcode='" . $SelectedGLAccount . "' ORDER BY glaccountusers.userid ASC"); if(DB_num_rows($Result)>0) {// If the GL account has access permissions for one or more users: - $k = 0; //row colour counter while($MyRow = DB_fetch_array($Result)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + echo ' + '; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + echo ' + diff --git a/GLBalanceSheet.php b/GLBalanceSheet.php index af5acfb19..c36c1bce0 100644 --- a/GLBalanceSheet.php +++ b/GLBalanceSheet.php @@ -164,7 +164,6 @@ include('includes/PDFBalanceSheetPageHeader.inc'); - $k=0; //row colour counter $Section=''; $SectionBalance = 0; $SectionBalanceLY = 0; @@ -331,7 +330,7 @@ $Title = _('Print Balance Sheet Error'); include('includes/header.php'); prnMsg( _('There were no entries to print out for the selections specified') ); - echo '
' . _('Back to the menu'). ''; + echo '
' . _('Back to the menu'). ''; include('includes/footer.php'); exit; } else { @@ -421,7 +420,6 @@ } /* echo '' . $TableHeader . '';// thead used in conjunction with tbody enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header to be printed at the top of each page. */ - $k=0; //row colour counter $Section=''; $SectionBalance = 0; $SectionBalanceLY = 0; @@ -579,17 +577,11 @@ if ($_POST['Detail']=='Detailed'){ if (isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND (round($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) <> 0 OR round($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) <> 0))){ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $ActEnquiryURL = '' . $myrow['accountcode'] . ''; - printf(' + printf(' + diff --git a/GLCashFlowsIndirect.php b/GLCashFlowsIndirect.php index ce7992797..7e58e5140 100644 --- a/GLCashFlowsIndirect.php +++ b/GLCashFlowsIndirect.php @@ -95,7 +95,7 @@ function colDebitCredit($Amount) { $ActualTotal = 0; $LastSection = 0; $LastTotal = 0; - $k = 1;// Lines counter. + // Gets the net profit for the period GL account: if(!isset($_SESSION['PeriodProfitAccount'])) { $_SESSION['PeriodProfitAccount'] = ''; @@ -139,7 +139,7 @@ function colDebitCredit($Amount) { echo ' - + '; // Net profit for the period: @@ -156,7 +156,7 @@ function colDebitCredit($Amount) { colDebitCredit($MyRow1['BudgetProfit']), colDebitCredit($MyRow1['LastProfit']), ' - + '; // Dividends: @@ -237,14 +237,9 @@ function colDebitCredit($Amount) { if($MyRow['ActualAmount']<>0 OR $MyRow['BudgetAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', + + echo ' + ', '', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['BudgetAmount']), @@ -297,14 +292,9 @@ function colDebitCredit($Amount) { if($MyRow['ActualAmount']<>0 OR $MyRow['BudgetAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', + + echo ' + ', '', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['BudgetAmount']), @@ -358,15 +348,10 @@ function colDebitCredit($Amount) { if($MyRow['ActualAmount']<>0 OR $MyRow['BudgetAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['BudgetAmount']), colDebitCredit($MyRow['LastAmount']), @@ -410,15 +395,10 @@ function colDebitCredit($Amount) { if($MyRow['ActualAmount']<>0 OR $MyRow['BudgetAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['BudgetAmount']), colDebitCredit($MyRow['LastAmount']), @@ -459,7 +439,7 @@ function colDebitCredit($Amount) { echo ' - + '; // Net profit for the period: @@ -475,7 +455,7 @@ function colDebitCredit($Amount) { echo colDebitCredit($MyRow1['ActualProfit']), colDebitCredit($MyRow1['LastProfit']), ' - + '; // Dividends: @@ -547,15 +527,10 @@ function colDebitCredit($Amount) { } if($MyRow['ActualAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['LastAmount']), ''; @@ -599,15 +574,10 @@ function colDebitCredit($Amount) { while($MyRow = DB_fetch_array($Result)) { if($MyRow['ActualAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['LastAmount']), ''; @@ -653,15 +623,10 @@ function colDebitCredit($Amount) { while($MyRow = DB_fetch_array($Result)) { if($MyRow['ActualAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['LastAmount']), ''; @@ -700,15 +665,10 @@ function colDebitCredit($Amount) { while($MyRow = DB_fetch_array($Result)) { if($MyRow['ActualAmount']<>0 OR $MyRow['LastAmount']<>0 OR isset($_POST['ShowZeroBalance'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', - '', + + echo ' + + ', colDebitCredit($MyRow['ActualAmount']), colDebitCredit($MyRow['LastAmount']), ''; diff --git a/GLCodesInquiry.php b/GLCodesInquiry.php index 0038cc0ed..c0ed54906 100644 --- a/GLCodesInquiry.php +++ b/GLCodesInquiry.php @@ -28,20 +28,13 @@ '; $j = 1; -$k=0; //row colour counter $ActGrp =''; while ($myrow=DB_fetch_array($AccountsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['group_']== $ActGrp){ - printf(' + printf(' + ', @@ -49,7 +42,8 @@ htmlspecialchars($myrow['accountname'],ENT_QUOTES,'UTF-8',false)); } else { $ActGrp = $myrow['group_']; - printf(' + printf(' + ', diff --git a/GLJournal.php b/GLJournal.php index e33b50549..a47ce4201 100755 --- a/GLJournal.php +++ b/GLJournal.php @@ -394,16 +394,8 @@ $DebitTotal=0; $CreditTotal=0; -$j=0; foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } $sql="SELECT tagdescription FROM tags WHERE tagref='".$JournalItem->tag . "'"; @@ -414,7 +406,8 @@ } else { $TagDescription=$myrow[0]; } - echo ' + echo ' + '; if ($JournalItem->Amount>0) { echo ' @@ -432,13 +425,13 @@ '; } -echo ' +echo ''; if ($DebitTotal!=$CreditTotal) { - echo ''; $LastJournal = 0; - $i = 0; + while ($myrow = DB_fetch_array($result)){ if ($myrow['tag']==0) { @@ -112,21 +112,17 @@ } if ($myrow['typeno']!=$LastJournal) { - if ($i == 0) { - $RowClass = 'class="OddTableRows"'; - $i = 1; - } else { - $RowClass = 'class="EvenTableRows"'; - $i = 0; - } - echo ' - + echo ' + + + '; } else { - echo ''; + echo ' + '; } // if user is allowed to see the account we show it, other wise we show "OTHERS ACCOUNTS" @@ -158,8 +154,6 @@ echo ''; } - - $LastJournal = $myrow['typeno']; } else { echo ''; diff --git a/GLProfit_Loss.php b/GLProfit_Loss.php index 3c83bf6d7..fc0ee7430 100644 --- a/GLProfit_Loss.php +++ b/GLProfit_Loss.php @@ -649,7 +649,6 @@ /* echo '' . $TableHeader . '';// thead used in conjunction with tbody enable scrolling of the table body independently of the header and footer. Also, when printing a large table that spans multiple pages, these elements can enable the table header to be printed at the top of each page. */ $j = 1; - $k=0; //row colour counter $Section=''; $SectionPrdActual= 0; $SectionPrdLY = 0; @@ -986,16 +985,10 @@ if ($_POST['Detail']=='Detailed'){ if (isset($_POST['ShowZeroBalances']) OR (!isset($_POST['ShowZeroBalances']) AND ($AccountPeriodActual <> 0 OR $AccountPeriodBudget <> 0 OR $AccountPeriodLY <> 0))){ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $ActEnquiryURL = '' . $myrow['accountcode'] . ''; if ($Section ==1){ - printf(' + printf(' + @@ -1010,7 +1003,8 @@ locale_number_format(-$AccountPeriodBudget,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format(-$AccountPeriodLY,$_SESSION['CompanyRecord']['decimalplaces'])); } else { - printf(' + printf(' + diff --git a/GLTagProfit_Loss.php b/GLTagProfit_Loss.php index b2ee02756..247635c69 100644 --- a/GLTagProfit_Loss.php +++ b/GLTagProfit_Loss.php @@ -547,7 +547,6 @@ $j = 1; - $k=0; //row colour counter $Section=''; $SectionPrdActual= 0; $SectionPrdLY = 0; @@ -753,18 +752,11 @@ if ($_POST['Detail']==_('Detailed')){ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $ActEnquiryURL = '' . $myrow['account'] . ''; if ($Section ==4){ - printf(' + printf(' + @@ -773,7 +765,8 @@ htmlspecialchars($myrow['accountname'], ENT_QUOTES,'UTF-8', false), locale_number_format(-$AccountPeriodActual,$_SESSION['CompanyRecord']['decimalplaces'])); } else { - printf(' + printf(' + ', diff --git a/GLTransInquiry.php b/GLTransInquiry.php index f5f5bc1fd..f11bfd369 100644 --- a/GLTransInquiry.php +++ b/GLTransInquiry.php @@ -75,7 +75,7 @@ $CreditTotal = 0; $DebitTotal = 0; $AnalysisCompleted = 'Not Yet'; - $j = 1;// Row counter to determine background colour. + while( $TransRow = DB_fetch_array($TransResult) ) { $TranDate = ConvertSQLDate($TransRow['trandate']); $DetailResult = false; @@ -145,15 +145,8 @@ $TransRow['narrative'] = ' '; } - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - - echo ' + echo ' + '; if ($URL == ""){ @@ -192,14 +185,8 @@ } } - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - echo ' + echo ' + diff --git a/GLTrialBalance.php b/GLTrialBalance.php index 21ac881a6..947183b2c 100644 --- a/GLTrialBalance.php +++ b/GLTrialBalance.php @@ -458,7 +458,6 @@ '; $j = 1; - $k=0; //row colour counter $ActGrp =''; $ParentGroups = array(); $Level =1; //level of nested sub-groups @@ -568,16 +567,8 @@ $j++; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } /*MonthActual, MonthBudget, FirstPrdBFwd, FirstPrdBudgetBFwd, LastPrdBudgetCFwd, LastPrdCFwd */ - if ($myrow['pandl']==1){ $AccountPeriodActual = $myrow['lastprdcfwd'] - $myrow['firstprdbfwd']; @@ -623,7 +614,8 @@ $ActEnquiryURL = '' . $myrow['accountcode'] . ''; - printf(' + printf(' + diff --git a/GeocodeSetup.php b/GeocodeSetup.php index 982b98b18..ddf20e494 100644 --- a/GeocodeSetup.php +++ b/GeocodeSetup.php @@ -152,18 +152,10 @@ '; - $k=0; //row colour counter while ($myrow=DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + printf(' + diff --git a/GoodsReceived.php b/GoodsReceived.php index f1b36f342..0a9925953 100644 --- a/GoodsReceived.php +++ b/GoodsReceived.php @@ -143,20 +143,10 @@ $_SESSION['PO'.$identifier]->Total = 0; } -$k=0; //row colour counter - if (count($_SESSION['PO'.$identifier]->LineItems)>0 and !isset($_POST['ProcessGoodsReceived'])){ foreach ($_SESSION['PO'.$identifier]->LineItems as $LnItm) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - /* if ($LnItm->ReceiveQty==0){ /*If no quantities yet input default the balance to be received $LnItm->ReceiveQty = $LnItm->QuantityOrd - $LnItm->QtyReceived; } @@ -190,7 +180,8 @@ $ImageLink = $LnItm->StockID; } - echo ' + echo ' + diff --git a/HistoricalTestResults.php b/HistoricalTestResults.php index a2330dae4..ce0b7fbb3 100644 --- a/HistoricalTestResults.php +++ b/HistoricalTestResults.php @@ -132,21 +132,19 @@ if ($TotResults>0) { echo '
' . _('Historical Test Results for') . ' ' . $KeyValue . '-' . $MyRowSelection['description'] . '
'; - $k = 0; //row colour counter - echo '
' . _('Total Weight') .': ' . $DisplayWeight . ' ' . _('Total Volume') .':
' . $StockItem->ItemDescription . '
' . $StockItem->ItemDescription . ' ' . $DisplayQuantity . ' ' . $StockItem->Units . ' ' . $DisplayPrice . '' . _('Authoriser') . '
' . $myrow['description'] . '
' . $myrow['description'] . ' ' . $myrow['authoriser'] . ' ' . _('Edit') . ' ' . _('Delete') . '' . _('Discount Category') . ' ' . _('Item') . '
%s
%s %s - %s ' . _('Delete') . '
' . _('Discount Rate') . ' %' . '
%s
%s %s %s %s
%s
%s ' . _('Already') . '
' . _('Sent') . '
%s %s%s
%s ' . _('Send') . ' %s %s
' . $myrow['id'] . '
' . $myrow['id'] . ' ' . $myrow['coyname'] . ' ' . $myrow['address1'] . ' ' . $myrow['address2'] . '' . _('Accum Depn GL') . '
%s
%s %s %s %s
' . $AssetRow['assetid'] . '
' . $AssetRow['assetid'] . ' ' . $AssetRow['description'] . ' ' . ConvertSQLDate($AssetRow['datepurchased']) . ' ' . locale_number_format($AssetRow['costtotal'],$_SESSION['CompanyRecord']['decimalplaces']) . '
%s
%s %s %s %s
', _($myrow['typename']), '
', _($myrow['typename']), ' ', $myrow['typeno'], ' ', $FormatedTranDate, ' ', $myrow['narrative'], '
', $MyRow['userid'], '
', $MyRow['userid'], ' ', $MyRow['realname'], ' '; if($MyRow['canview'] == 1) { diff --git a/GLAccounts.php b/GLAccounts.php index 73c9f9668..8d74fb34d 100644 --- a/GLAccounts.php +++ b/GLAccounts.php @@ -318,16 +318,9 @@ function CashFlowsActivityName($Activity) { $ErrMsg = _('The chart accounts could not be retrieved because'); $Result = DB_query($Sql, $ErrMsg); - $k = 1;// Row colour counter. while ($MyRow = DB_fetch_array($Result)) { - if($k == 1) { - echo '
', $MyRow['accountcode'], '
', $MyRow['accountcode'], ' ', htmlspecialchars($MyRow['accountname'], ENT_QUOTES, 'UTF-8'), ' ', $MyRow['group_'], ' ', $MyRow['acttype'], '
%s
%s %s %s

', _('Net profit and dividends'), '

  ', _('Net profit for the period'), '
  ', _('Dividends'), '
', $MyRow['accountcode'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '

', _('Net profit and dividends'), '

  ', _('Net profit for the period'), '
  ', _('Dividends'), '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
', $MyRow['accountcode'], '', $MyRow['accountname'], '
%s %s
%s
%s %s %s
' . $JournalItem->tag . ' - ' . $TagDescription . '
' . $JournalItem->tag . ' - ' . $TagDescription . ' ' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '' . locale_number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '
' . _('Total') . ' ' . locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '
' . _('Required to balance') .' - ' . + echo '
' . _('Required to balance') .' - ' . locale_number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); } if ($DebitTotal>$CreditTotal) { diff --git a/GLJournalInquiry.php b/GLJournalInquiry.php index 28910422c..0c874ab5d 100644 --- a/GLJournalInquiry.php +++ b/GLJournalInquiry.php @@ -104,7 +104,7 @@
' . ConvertSQLDate($myrow['trandate']) . ' ' . $myrow['typeno'] . '
' . _('Print') . '
%s
%s %s %s%s
%s %s %s
%s
%s %s %s%s
%s %s %s
' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '
' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . ' ' . $TranDate . '
' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . '
' . MonthAndYearFromSQLDate($TransRow['lastdate_in_period']) . ' ' . $TranDate . ' ' . $TransRow['accountname'] . ' - ' . $DetailRow['otherparty'] . '
%s
%s %s %s %s' . _('Map host') . '
%s
%s %s %s %s
' . $ImageLink . '
' . $ImageLink . ' ' . $LnItm->Suppliers_PartNo . ' ' . $LnItm->ItemDescription . ' ' . $DisplaySupplierQtyOrd . '
'; + + echo '
+
+
' . _('Sample ID:') . '
' . _('Lot/Serial:') . '
' . _('Identifier:') . '
' . _('Sample Date:') .'
+ + '; foreach ($SamplesArray as $samplekey => $samplevalue) { echo ''; } echo ''; foreach ($TestsArray as $testkey => $testvalue) { - if ($k == 1) { /*alternate bgcolour of row for highlighting */ - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - echo ' + '; foreach ($SamplesArray as $samplekey => $samplevalue) { if ($AllResultsArray[$testkey][$samplekey]['testvalue']=='' OR !isset($AllResultsArray[$testkey][$samplekey]['testvalue'])) { $AllResultsArray[$testkey][$samplekey]['testvalue']=' '; diff --git a/InternalStockCategoriesByRole.php b/InternalStockCategoriesByRole.php index 915bf0559..adf3c72e9 100644 --- a/InternalStockCategoriesByRole.php +++ b/InternalStockCategoriesByRole.php @@ -168,18 +168,10 @@ '; -$k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + ', diff --git a/InternalStockRequest.php b/InternalStockRequest.php index a25b1f8d4..45bd54539 100644 --- a/InternalStockRequest.php +++ b/InternalStockRequest.php @@ -279,17 +279,10 @@ '; -$k=0; if (isset($_SESSION['Request']->LineItems)) { foreach ($_SESSION['Request']->LineItems as $LineItems) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + @@ -567,19 +560,11 @@ '; $j = 1; - $k = 0; //row counter to determine background colour $RowIndex = 0; if (DB_num_rows($searchresult) <> 0) { DB_data_seek($searchresult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while (($myrow = DB_fetch_array($searchresult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } if ($myrow['mbflag'] == 'D') { $qoh = _('N/A'); } else { @@ -591,7 +576,8 @@ $ItemStatus =''; } - echo ' + echo ' + @@ -622,7 +608,7 @@ - '; $ImageSource = _('No Image'); - $k=0; //row colour counter $i=0; while ($myrow=DB_fetch_array($SearchResult)) { if ($myrow['decimalplaces']=='') { @@ -715,16 +700,10 @@ $WoQty = 0; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $OnOrder = $PurchQty + $WoQty; $Available = $QOH - $DemandQty + $OnOrder; - echo ' + echo ' + @@ -744,7 +723,7 @@ echo ' - \ diff --git a/InternalStockRequestInquiry.php b/InternalStockRequestInquiry.php index 8f6eae2f9..e174cd86a 100644 --- a/InternalStockRequestInquiry.php +++ b/InternalStockRequestInquiry.php @@ -1,541 +1,528 @@ -' . ' ' . $Title . '

'; - -echo ''; -echo ''; -echo '
'; -if (isset($_POST['ResetPart'])) { - unset($SelectedStockItem); -} -echo '
'; -if (isset($_POST['RequestNo'])) { - $RequestNo = $_POST['RequestNo']; -} -if (isset($_POST['SearchPart'])) { - $StockItemsResult = GetSearchItems(); -} -if (isset($_POST['StockID'])) { - $StockID = trim(mb_strtoupper($_POST['StockID'])); -} -if (isset($_POST['SelectedStockItem'])) { - $StockID = $_POST['SelectedStockItem']; -} - -if (!isset($StockID) AND !isset($_POST['Search'])) {//The scripts is just opened or click a submit button - if (!isset($RequestNo) OR $RequestNo == '') { - echo '
' . _('Sample ID:') . '
' . _('Lot/Serial:') . '
' . _('Identifier:') . '
' . _('Sample Date:') .'
'. $samplekey . '
' . $samplevalue['lotkey'] . '
' . $samplevalue['identifier'] . '
' . ConvertSQLDate($samplevalue['sampledate']).'
'.$testvalue.''; + echo '
'.$testvalue.'' . _('Description') . '
%s
%s %s ' . _('Delete') . '
' . _('UOM'). '
' . $LineItems->LineNumber . '
' . $LineItems->LineNumber . ' ' . $LineItems->StockID . ' ' . $LineItems->ItemDescription . ' ' . locale_number_format($LineItems->Quantity, $LineItems->DecimalPlaces) . '' . _('Stock Status') . '
' . $myrow['description'] . ' ' . $qoh . ' ' . $myrow['units'] . ' + @@ -641,7 +627,6 @@
' . $myrow['stockid'] . '
' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['stockunits'] . ' ' . locale_number_format($QOH,$DecimalPlaces) . '
+
- - - - - '; - } else {//there are possiblity that the user is the authorization person,lets figure things out - - $sql = "SELECT stockrequest.loccode,locations.locationname FROM stockrequest INNER JOIN locations ON stockrequest.loccode=locations.loccode - INNER JOIN department ON stockrequest.departmentid=department.departmentid WHERE department.authoriser='" . $_SESSION['UserID'] . "'"; - $authresult = DB_query($sql); - $LocationCounter = DB_num_rows($authresult); - if ($LocationCounter>0) { - $Authorizer = true; - - while ($myrow = DB_fetch_array($authresult)) { - $Locations[] = $myrow['loccode']; - if (isset($_POST['StockLocation'])) { - if ($_POST['StockLocation'] == 'All' AND $locallctr==0) { - echo ''; - $locallctr = 1; - } elseif ($myrow['loccode'] == $_POST['StockLocation']) { - echo ''; - } - } else { - if ($LocationCounter>1 AND $locallctr == 0) { - $locallctr = 1; - echo ''; - } - echo ''; - } - } - echo ''; - - - } else { - prnMsg(_('You have no authority to do the internal request inquiry'),'error'); - include('includes/footer.php'); - exit; - } - } - echo '';//store the locations for later using; - if (!isset($_POST['Authorized'])) { - $_POST['Authorized'] = 'All'; - } - echo ' - '; - } - //add the department, sometime we need to check each departments' internal request - if (!isset($_POST['Department'])) { - $_POST['Department'] = ''; - } - - echo ' - '; - echo ''; - } else { - prnMsg(_('There are no internal request result available for your or your department'),'error'); - include('includes/footer.php'); - exit; - } - - //now lets add the time period option - if (!isset($_POST['ToDate'])) { - $_POST['ToDate'] = ''; - } - if (!isset($_POST['FromDate'])) { - $_POST['FromDate'] = ''; - } - echo ' - - - -
' . _('Request Number') . ':' . _('From Stock Location') . ':' . _('Authorisation status') . '
' . _('Department') . '' . _('Date From') . '' . _('Date To') . '
'; - if (!isset($_POST['ShowDetails'])) { - $_POST['ShowDetails'] = 1; - } - $Checked = ($_POST['ShowDetails'] == 1)?'checked="checked"':''; - echo '' . _('Show Details') . ' - '; - //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous - //hereby if the authorizer is login, we only show all category available, even if there is problem, it'll be correceted later when items selected -:) - if (isset($Authorizer)) { - $WhereAuthorizer = ''; - } else { - $WhereAuthorizer = " AND internalstockcatrole.secroleid = '" . $_SESSION['AccessLevel'] . "' "; - } - - $SQL = "SELECT stockcategory.categoryid, - stockcategory.categorydescription - FROM stockcategory, internalstockcatrole - WHERE stockcategory.categoryid = internalstockcatrole.categoryid - " . $WhereAuthorizer . " - ORDER BY stockcategory.categorydescription"; - $result1 = DB_query($SQL); - //first lets check that the category id is not zero - $Cats = DB_num_rows($result1); - - - if ($Cats >0) { - - echo '
- - - - - - - '; - if (!isset($_POST['Keywords'])) { - $_POST['Keywords'] = ''; - } - echo ''; - echo ' - - - - '; - if (!isset($_POST['StockCode'])) { - $_POST['StockCode'] = ''; - } - echo ''; - - } - echo ' -

' . _('To search for internal request for a specific part use the part selection facilities below') . '

' . _('Stock Category') . '' . _('Enter partial') . ' ' . _('Description') . ':
' . _('OR') . ' ' . _('Enter partial') . ' ' . _('Stock Code') . ':
-
-
- - -
-
-
- '; - - if ($Cats == 0) { - - echo '

' . _('Problem Report') . ':
' . _('There are no stock categories currently defined please use the link below to set them up') . '

'; - echo '
- ' . _('Define Stock Categories') . ''; - exit; - } - - -} - -if(isset($StockItemsResult)){ - - if (isset($StockItemsResult) - AND DB_num_rows($StockItemsResult)>1) { - echo '' . _('Return') . ''; - echo ''; - echo ' - - - - - '; - - $k=0; //row colour counter - - while ($myrow=DB_fetch_array($StockItemsResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' - - - - ', - $myrow['stockid'], - $myrow['description'], - locale_number_format($myrow['qoh'],$myrow['decimalplaces']), - $myrow['units']); -//end of page full new headings if - } -//end of while loop - - echo '
' . _('Code') . '' . _('Description') . '' . _('Total Applied') . '' . _('Units') . '
%s%s%s
'; - -} - -} elseif(isset($_POST['Search']) OR isset($StockID)) {//lets show the search result here - if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { - $StockID = DB_fetch_array($StockItemsResult); - $StockID = $StockID[0]; - } - - if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $SQL = "SELECT stockrequest.dispatchid, - stockrequest.loccode, - stockrequest.departmentid, - departments.description, - locations.locationname, - despatchdate, - authorised, - closed, - narrative, - initiator, - stockrequestitems.stockid, - stockmaster.description as stkdescription, - quantity, - stockrequestitems.decimalplaces, - uom, - completed - FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid - INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode - INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid"; - } else { - $SQL = "SELECT stockrequest.dispatchid, - stockrequest.loccode, - stockrequest.departmentid, - departments.description, - locations.locationname, - despatchdate, - authorised, - closed, - narrative, - initiator - FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode "; - } - //lets add the condition selected by users - if (isset($_POST['RequestNo']) AND $_POST['RequestNo'] !== '') { - $SQL .= "WHERE stockrequest.dispatchid = '" . $_POST['RequestNo'] . "'"; - } else { - //first the constraint of locations; - if ($_POST['StockLocation'] != 'All') {//retrieve the location data from current code - $SQL .= "WHERE stockrequest.loccode='" . $_POST['StockLocation'] . "'"; - } else {//retrieve the location data from serialzed data - if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { - $Locations = unserialize($_POST['Locations']); - $Locations = implode("','",$Locations); - $SQL .= "WHERE stockrequest.loccode in ('" . $Locations . "')"; - } else { - $SQL .= "WHERE 1 "; - } - } - //the authorization status - if ($_POST['Authorized'] != 'All') {//no bothering for all - $SQL .= " AND authorised = '" . $_POST['Authorized'] . "'"; - } - //the department: if the department is all, no bothering for this since user has no relation ship with department; but consider the efficency, we should use the departments to filter those no needed out - if ($_POST['Department'] == 'All') { - if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { - - if (isset($_POST['Departments'])) { - $Departments = unserialize(base64_decode($_POST['Departments'])); - $Departments = implode("','", $Departments); - $SQL .= " AND stockrequest.departmentid IN ('" . $Departments . "')"; - - } //IF there are no departments set,so forgot it - - } - } else { - $SQL .= " AND stockrequest.departmentid='" . $_POST['Department'] . "'"; - } - //Date from - if (isset($_POST['FromDate']) AND is_date($_POST['FromDate'])) { - $SQL .= " AND despatchdate>='" . $_POST['FromDate'] . "'"; - } - if (isset($_POST['ToDate']) AND is_date($_POST['ToDate'])) { - $SQL .= " AND despatchdate<='" . $_POST['ToDate'] . "'"; - } - //item selected - if (isset($StockID)) { - $SQL .= " AND stockrequestitems.stockid='" . $StockID . "'"; - } - }//end of no request no selected - //the user or authority contraint - if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { - $SQL .= " AND (authoriser='" . $_SESSION['UserID'] . "' OR initiator='" . $_SESSION['UserID'] . "')"; - } - $result = DB_query($SQL); - if (DB_num_rows($result)>0) { - $Html = ''; - if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $Html .= ' - - - - - - - - - - - - '; - } else { - $Html .= '
' . _('ID') . '' . _('Locations') . '' . _('Department') . '' . _('Authorization') . '' . _('Dispatch Date') . '' . _('Stock ID') . '' . _('Description') . '' . _('Quantity') . '' . _('Units') . '' . _('Completed') . '
- - - - - - - '; - } - - if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $ID = '';//mark the ID change of the internal request - } - $i = 0; - //There are items without details AND with it - while ($myrow = DB_fetch_array($result)) { - if ($i == 0) { - $Html .= ""; - $i = 1; - } elseif ($i == 1) { - $Html .= ""; - $i = 0; - } - if ($myrow['authorised'] == 0) { - $Auth = _('No'); - } else { - $Auth = _('Yes'); - } - if ($myrow['despatchdate'] == '0000-00-00') { - $Disp = _('Not yet'); - } else { - $Disp = ConvertSQLDate($myrow['despatchdate']); - } - if (isset($ID)) { - if ($myrow['completed'] == 0) { - $Comp = _('No'); - } else { - $Comp = _('Yes'); - } - } - if (isset($ID) AND ($ID != $myrow['dispatchid'])) { - $ID = $myrow['dispatchid']; - $Html .= ' - - - - - - - - - '; - - } elseif (isset($ID) AND ($ID == $myrow['dispatchid'])) { - $Html .= ' - - - - - - - - - '; - } elseif(!isset($ID)) { - $Html .= ' - - - - '; - } - $Html .= ''; - }//end of while loop; - $Html .= '
' . _('ID') . '' . _('Locations') . '' . _('Department') . '' . _('Authorization') . '' . _('Dispatch Date') . '
' . $myrow['dispatchid'] . '' . $myrow['locationname'] . '' . $myrow['description'] . '' . $Auth . '' . $Disp . '' . $myrow['stockid'] . '' . $myrow['stkdescription'] . '' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '' . $myrow['uom'] . '' . $Comp . '' . $myrow['stockid'] . '' . $myrow['stkdescription'] . '' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '' . $myrow['uom'] . '' . $Comp . '' . $myrow['dispatchid'] . '' . $myrow['locationname'] . '' . $myrow['description'] . '' . $Auth . '' . $Disp . '
'; - echo '' . _('Select Others') . ''; - - echo $Html; - } else { - prnMsg(_('There are no stock request available'),'warn'); - } -} - -include('includes/footer.php'); -exit; - -function GetSearchItems ($SQLConstraint='') { - if ($_POST['Keywords'] AND $_POST['StockCode']) { - echo _('Stock description keywords have been used in preference to the Stock code extract entered'); - } - $SQL = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.decimalplaces, - SUM(stockrequestitems.quantity) AS qoh, - stockmaster.units - FROM stockrequestitems INNER JOIN stockrequest ON stockrequestitems.dispatchid=stockrequest.dispatchid - INNER JOIN departments ON stockrequest.departmentid = departments.departmentid - - INNER JOIN stockmaster ON stockrequestitems.stockid = stockmaster.stockid"; - if (isset($_POST['StockCat']) - AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ - $WhereStockCat = ''; - } else { - $WhereStockCat = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' "; - } - if ($_POST['Keywords']) { - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - - $SQL .= " WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' - " . $WhereStockCat ; - - - } elseif (isset($_POST['StockCode'])){ - $SQL .= " WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%'" . $WhereStockCat; - - } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { - $SQL .= " WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."'"; - - } - $SQL .= ' AND (departments.authoriser="' . $_SESSION['UserID'] . '" OR initiator="' . $_SESSION['UserID'] . '") '; - $SQL .= $SQLConstraint; - $SQL .= " GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmaster.units - ORDER BY stockmaster.stockid"; - $ErrMsg = _('No stock items were returned by the SQL because'); - $DbgMsg = _('The SQL used to retrieve the searched parts was'); - $StockItemsResult = DB_query($SQL,$ErrMsg,$DbgMsg); - return $StockItemsResult; - - } -?> +' . ' ' . $Title . '

'; + +echo '
'; +echo ''; +echo '
'; +if (isset($_POST['ResetPart'])) { + unset($SelectedStockItem); +} +echo '
'; +if (isset($_POST['RequestNo'])) { + $RequestNo = $_POST['RequestNo']; +} +if (isset($_POST['SearchPart'])) { + $StockItemsResult = GetSearchItems(); +} +if (isset($_POST['StockID'])) { + $StockID = trim(mb_strtoupper($_POST['StockID'])); +} +if (isset($_POST['SelectedStockItem'])) { + $StockID = $_POST['SelectedStockItem']; +} + +if (!isset($StockID) AND !isset($_POST['Search'])) {//The scripts is just opened or click a submit button + if (!isset($RequestNo) OR $RequestNo == '') { + echo ' + + + + + '; + } else {//there are possiblity that the user is the authorization person,lets figure things out + + $sql = "SELECT stockrequest.loccode,locations.locationname FROM stockrequest INNER JOIN locations ON stockrequest.loccode=locations.loccode + INNER JOIN department ON stockrequest.departmentid=department.departmentid WHERE department.authoriser='" . $_SESSION['UserID'] . "'"; + $authresult = DB_query($sql); + $LocationCounter = DB_num_rows($authresult); + if ($LocationCounter>0) { + $Authorizer = true; + + while ($myrow = DB_fetch_array($authresult)) { + $Locations[] = $myrow['loccode']; + if (isset($_POST['StockLocation'])) { + if ($_POST['StockLocation'] == 'All' AND $locallctr==0) { + echo ''; + $locallctr = 1; + } elseif ($myrow['loccode'] == $_POST['StockLocation']) { + echo ''; + } + } else { + if ($LocationCounter>1 AND $locallctr == 0) { + $locallctr = 1; + echo ''; + } + echo ''; + } + } + echo ''; + + + } else { + prnMsg(_('You have no authority to do the internal request inquiry'),'error'); + include('includes/footer.php'); + exit; + } + } + echo '';//store the locations for later using; + if (!isset($_POST['Authorized'])) { + $_POST['Authorized'] = 'All'; + } + echo ' + '; + } + //add the department, sometime we need to check each departments' internal request + if (!isset($_POST['Department'])) { + $_POST['Department'] = ''; + } + + echo ' + '; + echo ''; + } else { + prnMsg(_('There are no internal request result available for your or your department'),'error'); + include('includes/footer.php'); + exit; + } + + //now lets add the time period option + if (!isset($_POST['ToDate'])) { + $_POST['ToDate'] = ''; + } + if (!isset($_POST['FromDate'])) { + $_POST['FromDate'] = ''; + } + echo ' + + + +
' . _('Request Number') . ':' . _('From Stock Location') . ':' . _('Authorisation status') . '
' . _('Department') . '' . _('Date From') . '' . _('Date To') . '
'; + if (!isset($_POST['ShowDetails'])) { + $_POST['ShowDetails'] = 1; + } + $Checked = ($_POST['ShowDetails'] == 1)?'checked="checked"':''; + echo '' . _('Show Details') . ' + '; + //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous + //hereby if the authorizer is login, we only show all category available, even if there is problem, it'll be correceted later when items selected -:) + if (isset($Authorizer)) { + $WhereAuthorizer = ''; + } else { + $WhereAuthorizer = " AND internalstockcatrole.secroleid = '" . $_SESSION['AccessLevel'] . "' "; + } + + $SQL = "SELECT stockcategory.categoryid, + stockcategory.categorydescription + FROM stockcategory, internalstockcatrole + WHERE stockcategory.categoryid = internalstockcatrole.categoryid + " . $WhereAuthorizer . " + ORDER BY stockcategory.categorydescription"; + $result1 = DB_query($SQL); + //first lets check that the category id is not zero + $Cats = DB_num_rows($result1); + + + if ($Cats >0) { + + echo '
+ + + + + + + '; + if (!isset($_POST['Keywords'])) { + $_POST['Keywords'] = ''; + } + echo ''; + echo ' + + + + '; + if (!isset($_POST['StockCode'])) { + $_POST['StockCode'] = ''; + } + echo ''; + + } + echo ' +

' . _('To search for internal request for a specific part use the part selection facilities below') . '

' . _('Stock Category') . '' . _('Enter partial') . ' ' . _('Description') . ':
' . _('OR') . ' ' . _('Enter partial') . ' ' . _('Stock Code') . ':
+
+
+ + +
+
+
+ '; + + if ($Cats == 0) { + + echo '

' . _('Problem Report') . ':
' . _('There are no stock categories currently defined please use the link below to set them up') . '

'; + echo '
+ ' . _('Define Stock Categories') . ''; + exit; + } + + +} + +if(isset($StockItemsResult)){ + + if (isset($StockItemsResult) + AND DB_num_rows($StockItemsResult)>1) { + echo '' . _('Return') . ''; + echo ''; + echo ' + + + + + '; + + while ($myrow=DB_fetch_array($StockItemsResult)) { + + printf(' + + + + + ', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + $myrow['units']); +//end of page full new headings if + } +//end of while loop + + echo '
' . _('Code') . '' . _('Description') . '' . _('Total Applied') . '' . _('Units') . '
%s%s%s
'; + +} + +} elseif(isset($_POST['Search']) OR isset($StockID)) {//lets show the search result here + if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { + $StockID = DB_fetch_array($StockItemsResult); + $StockID = $StockID[0]; + } + + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $SQL = "SELECT stockrequest.dispatchid, + stockrequest.loccode, + stockrequest.departmentid, + departments.description, + locations.locationname, + despatchdate, + authorised, + closed, + narrative, + initiator, + stockrequestitems.stockid, + stockmaster.description as stkdescription, + quantity, + stockrequestitems.decimalplaces, + uom, + completed + FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid + INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode + INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid"; + } else { + $SQL = "SELECT stockrequest.dispatchid, + stockrequest.loccode, + stockrequest.departmentid, + departments.description, + locations.locationname, + despatchdate, + authorised, + closed, + narrative, + initiator + FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode "; + } + //lets add the condition selected by users + if (isset($_POST['RequestNo']) AND $_POST['RequestNo'] !== '') { + $SQL .= "WHERE stockrequest.dispatchid = '" . $_POST['RequestNo'] . "'"; + } else { + //first the constraint of locations; + if ($_POST['StockLocation'] != 'All') {//retrieve the location data from current code + $SQL .= "WHERE stockrequest.loccode='" . $_POST['StockLocation'] . "'"; + } else {//retrieve the location data from serialzed data + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + $Locations = unserialize($_POST['Locations']); + $Locations = implode("','",$Locations); + $SQL .= "WHERE stockrequest.loccode in ('" . $Locations . "')"; + } else { + $SQL .= "WHERE 1 "; + } + } + //the authorization status + if ($_POST['Authorized'] != 'All') {//no bothering for all + $SQL .= " AND authorised = '" . $_POST['Authorized'] . "'"; + } + //the department: if the department is all, no bothering for this since user has no relation ship with department; but consider the efficency, we should use the departments to filter those no needed out + if ($_POST['Department'] == 'All') { + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + + if (isset($_POST['Departments'])) { + $Departments = unserialize(base64_decode($_POST['Departments'])); + $Departments = implode("','", $Departments); + $SQL .= " AND stockrequest.departmentid IN ('" . $Departments . "')"; + + } //IF there are no departments set,so forgot it + + } + } else { + $SQL .= " AND stockrequest.departmentid='" . $_POST['Department'] . "'"; + } + //Date from + if (isset($_POST['FromDate']) AND is_date($_POST['FromDate'])) { + $SQL .= " AND despatchdate>='" . $_POST['FromDate'] . "'"; + } + if (isset($_POST['ToDate']) AND is_date($_POST['ToDate'])) { + $SQL .= " AND despatchdate<='" . $_POST['ToDate'] . "'"; + } + //item selected + if (isset($StockID)) { + $SQL .= " AND stockrequestitems.stockid='" . $StockID . "'"; + } + }//end of no request no selected + //the user or authority contraint + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + $SQL .= " AND (authoriser='" . $_SESSION['UserID'] . "' OR initiator='" . $_SESSION['UserID'] . "')"; + } + $result = DB_query($SQL); + if (DB_num_rows($result)>0) { + $Html = ''; + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $Html .= ' + + + + + + + + + + + + '; + } else { + $Html .= '
' . _('ID') . '' . _('Locations') . '' . _('Department') . '' . _('Authorization') . '' . _('Dispatch Date') . '' . _('Stock ID') . '' . _('Description') . '' . _('Quantity') . '' . _('Units') . '' . _('Completed') . '
+ + + + + + + '; + } + + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $ID = '';//mark the ID change of the internal request + } + $i = 0; + //There are items without details AND with it + while ($myrow = DB_fetch_array($result)) { + if ($myrow['authorised'] == 0) { + $Auth = _('No'); + } else { + $Auth = _('Yes'); + } + if ($myrow['despatchdate'] == '0000-00-00') { + $Disp = _('Not yet'); + } else { + $Disp = ConvertSQLDate($myrow['despatchdate']); + } + if (isset($ID)) { + if ($myrow['completed'] == 0) { + $Comp = _('No'); + } else { + $Comp = _('Yes'); + } + } + if (isset($ID) AND ($ID != $myrow['dispatchid'])) { + $ID = $myrow['dispatchid']; + $Html .= ' + + + + + + + + + + '; + + } elseif (isset($ID) AND ($ID == $myrow['dispatchid'])) { + $Html .= ' + + + + + + + + + + '; + } elseif(!isset($ID)) { + $Html .= ' + + + + + '; + } + $Html .= ''; + }//end of while loop; + $Html .= '
' . _('ID') . '' . _('Locations') . '' . _('Department') . '' . _('Authorization') . '' . _('Dispatch Date') . '
' . $myrow['dispatchid'] . '' . $myrow['locationname'] . '' . $myrow['description'] . '' . $Auth . '' . $Disp . '' . $myrow['stockid'] . '' . $myrow['stkdescription'] . '' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '' . $myrow['uom'] . '' . $Comp . '
' . $myrow['stockid'] . '' . $myrow['stkdescription'] . '' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '' . $myrow['uom'] . '' . $Comp . '
' . $myrow['dispatchid'] . '' . $myrow['locationname'] . '' . $myrow['description'] . '' . $Auth . '' . $Disp . '
'; + echo '' . _('Select Others') . ''; + + echo $Html; + } else { + prnMsg(_('There are no stock request available'),'warn'); + } +} + +include('includes/footer.php'); +exit; + +function GetSearchItems ($SQLConstraint='') { + if ($_POST['Keywords'] AND $_POST['StockCode']) { + echo _('Stock description keywords have been used in preference to the Stock code extract entered'); + } + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + SUM(stockrequestitems.quantity) AS qoh, + stockmaster.units + FROM stockrequestitems INNER JOIN stockrequest ON stockrequestitems.dispatchid=stockrequest.dispatchid + INNER JOIN departments ON stockrequest.departmentid = departments.departmentid + + INNER JOIN stockmaster ON stockrequestitems.stockid = stockmaster.stockid"; + if (isset($_POST['StockCat']) + AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ + $WhereStockCat = ''; + } else { + $WhereStockCat = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' "; + } + if ($_POST['Keywords']) { + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + + $SQL .= " WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' + " . $WhereStockCat ; + + + } elseif (isset($_POST['StockCode'])){ + $SQL .= " WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%'" . $WhereStockCat; + + } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { + $SQL .= " WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."'"; + + } + $SQL .= ' AND (departments.authoriser="' . $_SESSION['UserID'] . '" OR initiator="' . $_SESSION['UserID'] . '") '; + $SQL .= $SQLConstraint; + $SQL .= " GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; + $ErrMsg = _('No stock items were returned by the SQL because'); + $DbgMsg = _('The SQL used to retrieve the searched parts was'); + $StockItemsResult = DB_query($SQL,$ErrMsg,$DbgMsg); + return $StockItemsResult; + + } +?> diff --git a/Labels.php b/Labels.php index ea750992e..fa254b086 100644 --- a/Labels.php +++ b/Labels.php @@ -296,16 +296,9 @@ ' . _('Row Height') . ' ' . _('Column Width') . ' '; - $k=0; + while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['rowheight']>0) { $NoOfRows = floor(($myrow['pageheight']-$myrow['topmargin'])/$myrow['rowheight']); } else { @@ -323,7 +316,8 @@ } } if (isset($Paper)){ - printf('%s + printf(' + %s %s %s %s @@ -347,7 +341,8 @@ $RootPath . '/LabelFields.php?', $myrow['labelid']); } else { - printf('%s + printf(' + %s %s %s %s @@ -558,19 +553,10 @@ ' . _('Bar-code') . ' '; if (DB_num_rows($result)>0){ - $k=0; while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' - '; if ($myrow['fieldvalue']=='itemcode'){ echo ''; } else { diff --git a/LocationUsers.php b/LocationUsers.php index 8a3a072cc..3b9f9b6bd 100644 --- a/LocationUsers.php +++ b/LocationUsers.php @@ -177,16 +177,7 @@ ' . _('Update') . ' '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } if ($MyRow['canupd'] == 1) { $ToggleText = '' . _('Remove Update') . ''; @@ -194,7 +185,8 @@ $ToggleText = '' . _('Add Update') . ''; } - printf('%s + printf(' + %s %s %s %s' . diff --git a/Locations.php b/Locations.php index c1c9d2799..92a21edaa 100644 --- a/Locations.php +++ b/Locations.php @@ -415,15 +415,7 @@   '; -$k=0;//row colour counter while ($myrow = DB_fetch_array($result)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } /* warehouse management not implemented ... yet if($myrow['managed'] == 1) { $myrow['managed'] = _('Yes'); @@ -431,7 +423,8 @@ $myrow['managed'] = _('No'); } */ - printf('%s + printf(' + %s %s %s %s diff --git a/MRPDemands.php b/MRPDemands.php index 42aab6866..3081eada4 100644 --- a/MRPDemands.php +++ b/MRPDemands.php @@ -94,17 +94,11 @@ function search(&$db,&$StockID) { //####SEARCH_SEARCH_SEARCH_SEARCH_SEARCH_SEARC echo $TableHeader; $j = 1; - $k = 0; //row colour counter + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $tabindex=$j+4; - echo ' + echo ' + ' . $myrow['description'] . ' '; $j++; diff --git a/MRPPlannedPurchaseOrders.php b/MRPPlannedPurchaseOrders.php index 06127aff7..d6d885636 100644 --- a/MRPPlannedPurchaseOrders.php +++ b/MRPPlannedPurchaseOrders.php @@ -299,21 +299,13 @@ $TotalPartCost = 0; $Total_ExtCost = 0; $j=1; //row ID - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)){ - // Alternate row color - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } list($lastdate,$lastsupplier,$preferredsupplier,$conversionfactor) = GetPartInfo($myrow['part']); - echo '' . _('Convert') . ' + echo ' + ' . _('Convert') . ' ' . '' . $myrow['part'] . '' . ' ' . $myrow['description'] . ' ' . ConvertSQLDate($myrow['mrpdate']) . ' diff --git a/MRPPlannedWorkOrders.php b/MRPPlannedWorkOrders.php index 2c76d69ca..571c924ea 100755 --- a/MRPPlannedWorkOrders.php +++ b/MRPPlannedWorkOrders.php @@ -267,19 +267,11 @@ $TotalPartCost = 0; $Total_ExtCost = 0; $j=1; //row ID - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)){ - // Alternate row color - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo '' . _('Convert') . ' + echo ' + ' . _('Convert') . ' ' . '' . $myrow['part'] . '' . ' ' . $myrow['description'] . ' ' . ConvertSQLDate($myrow['mrpdate']) . ' diff --git a/MRPReport.php b/MRPReport.php index 9876557cd..99b7fbc89 100644 --- a/MRPReport.php +++ b/MRPReport.php @@ -781,25 +781,18 @@ '; echo $tableheader; $j = 1; - $k = 0; //row counter to determine background colour $RowIndex = 0; if (DB_num_rows($searchresult) <> 0) { DB_data_seek($searchresult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while (($myrow = DB_fetch_array($searchresult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } if ($myrow['mbflag'] == 'D') { $qoh = 'N/A'; } else { $qoh = locale_number_format($myrow['qoh'], $myrow['decimalplaces']); } - echo ' + echo ' + ' . $myrow['description'] . ' ' . $qoh . ' ' . $myrow['units'] . ' diff --git a/MailingGroupMaintenance.php b/MailingGroupMaintenance.php index 17eaf5a40..edc6887ee 100644 --- a/MailingGroupMaintenance.php +++ b/MailingGroupMaintenance.php @@ -1,262 +1,252 @@ -' . $Title . '

'; -echo $Header; -//show the mail group existed only when user request this page first -if(!isset($_POST['Clean']) and !isset($_GET['Delete']) and !isset($_GET['Edit']) and !isset($_GET['Add']) and !isset($_GET['Remove'])){ - GetMailGroup(); -} -//validate the input -if(isset($_POST['Enter'])){ //user has input a new value - $InputError = 0; - if(!empty($_POST['MailGroup']) and mb_strlen(trim($_POST['MailGroup']))<=100 and !ContainsIllegalCharacters($_POST['MailGroup'])){ - $MailGroup = strtolower(trim($_POST['MailGroup'])); - }else{ - $InputError = 1; - prnMsg(_('The Mail Group should be less than 100 characters and cannot contain illegal characters and cannot be null'),'error'); - exit; - include('includes/footer.php'); - } - if($InputError == 0){ - $sql = "INSERT INTO mailgroups (groupname) VALUES ('".$MailGroup."')"; - $ErrMsg = _('Failed to add new mail group'); - $result = DB_query($sql,$ErrMsg); - GetMailGroup(); - - } - -}//end of handling new mail group input -//Add the new users to the mail group -if(isset($_GET['Add']) and isset($_GET['UserId'])){ - if(isset($_GET['UserId']) and mb_strlen($_GET['UserId'])<21 and !ContainsIllegalCharacters($_GET['UserId'])){ - $UserId = $_GET['UserId']; - }else{ - prnMsg(_('The User Id should be set and must be less than 21 and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - } - if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ - $GroupId = (int)$_GET['GroupId']; - }else{ - prnMsg(_('The Group Id must be integer'),'error'); - include('includes/footer.php'); - exit; - } - if(!empty($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ - $GroupName = trim($_GET['GroupName']); - - }else{ - prnMsg(_('The Group name should be set and must be less than 100 characters and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - } - $sql = "INSERT INTO mailgroupdetails (groupname, userid) VALUES ('".$GroupName."', - '".$UserId."')"; - $ErrMsg = _('Failed to add users to mail group'); - $result = DB_query($sql,$ErrMsg); - GetUsers($GroupId, $GroupName); -} - -//User try to delete one of the record -if(isset($_GET['Delete'])){ - if(is_numeric($_GET['Id'])){ - $id = (int)$_GET['Id']; - $sql = "DELETE FROM mailgroups WHERE id = '".$id."'"; - $ErrMsg = _('Failed to delete the mail group which id is '.$id); - $result = DB_query($sql,$ErrMsg); - GetMailGroup(); - }else{ - prnMsg(_('The group id must be numeric'),'error'); - include('includes/footer.php'); - exit; - - } - -} - -//User try to Edit the details of the mail groups -if(isset($_GET['Edit'])){ -//First Get mailing list from database; - if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ - $GroupId = (int) $_GET['GroupId']; - if(isset($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ - $GroupName = trim($_GET['GroupName']); - }else{ - prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - } - - }else{ - prnMsg(_('The page must be called with a group id'),'error'); - include('includes/footer.php'); - exit; - } - GetUsers($GroupId,$GroupName); - include('includes/footer.php'); - - -} -//Users remove one user from the group -if(isset($_GET['Remove'])){ - if(!empty($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ - $GroupName = trim($_GET['GroupName']); - }else{ - prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - - } - if(isset($_GET['UserId']) and mb_strlen($_GET['UserId'])<21 and !ContainsIllegalCharacters($_GET['UserId'])){ - $UserId = $_GET['UserId']; - }else{ - prnMsg(_('The User Id should be set and must be less than 21 and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - } - - if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ - $GroupId = (int) $_GET['GroupId']; - if(isset($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ - $GroupName = trim($_GET['GroupName']); - }else{ - prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); - include('includes/footer.php'); - exit; - } - - } - $sql = "DELETE FROM mailgroupdetails WHERE userid = '".$UserId."' AND groupname = '".$GroupName."'"; - $ErrMsg = 'Failed to delete the userid '.$UserId.' from group '.$GroupName; - $result = DB_query($sql,$ErrMsg); - GetUsers($GroupId,$GroupName); - - -} -if(!isset($_GET['Edit'])){//display the input form -?> -
- - - - - -
- - - - - - - - - - - - - - - - -
' . _('Edit') . ''; ?>' . _('Delete') . ''; ?>
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      
- +' . $Title . '

'; +echo $Header; +//show the mail group existed only when user request this page first +if(!isset($_POST['Clean']) and !isset($_GET['Delete']) and !isset($_GET['Edit']) and !isset($_GET['Add']) and !isset($_GET['Remove'])){ + GetMailGroup(); +} +//validate the input +if(isset($_POST['Enter'])){ //user has input a new value + $InputError = 0; + if(!empty($_POST['MailGroup']) and mb_strlen(trim($_POST['MailGroup']))<=100 and !ContainsIllegalCharacters($_POST['MailGroup'])){ + $MailGroup = strtolower(trim($_POST['MailGroup'])); + }else{ + $InputError = 1; + prnMsg(_('The Mail Group should be less than 100 characters and cannot contain illegal characters and cannot be null'),'error'); + exit; + include('includes/footer.php'); + } + if($InputError == 0){ + $sql = "INSERT INTO mailgroups (groupname) VALUES ('".$MailGroup."')"; + $ErrMsg = _('Failed to add new mail group'); + $result = DB_query($sql,$ErrMsg); + GetMailGroup(); + + } + +}//end of handling new mail group input +//Add the new users to the mail group +if(isset($_GET['Add']) and isset($_GET['UserId'])){ + if(isset($_GET['UserId']) and mb_strlen($_GET['UserId'])<21 and !ContainsIllegalCharacters($_GET['UserId'])){ + $UserId = $_GET['UserId']; + }else{ + prnMsg(_('The User Id should be set and must be less than 21 and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + } + if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ + $GroupId = (int)$_GET['GroupId']; + }else{ + prnMsg(_('The Group Id must be integer'),'error'); + include('includes/footer.php'); + exit; + } + if(!empty($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ + $GroupName = trim($_GET['GroupName']); + + }else{ + prnMsg(_('The Group name should be set and must be less than 100 characters and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + } + $sql = "INSERT INTO mailgroupdetails (groupname, userid) VALUES ('".$GroupName."', + '".$UserId."')"; + $ErrMsg = _('Failed to add users to mail group'); + $result = DB_query($sql,$ErrMsg); + GetUsers($GroupId, $GroupName); +} + +//User try to delete one of the record +if(isset($_GET['Delete'])){ + if(is_numeric($_GET['Id'])){ + $id = (int)$_GET['Id']; + $sql = "DELETE FROM mailgroups WHERE id = '".$id."'"; + $ErrMsg = _('Failed to delete the mail group which id is '.$id); + $result = DB_query($sql,$ErrMsg); + GetMailGroup(); + }else{ + prnMsg(_('The group id must be numeric'),'error'); + include('includes/footer.php'); + exit; + + } + +} + +//User try to Edit the details of the mail groups +if(isset($_GET['Edit'])){ +//First Get mailing list from database; + if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ + $GroupId = (int) $_GET['GroupId']; + if(isset($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ + $GroupName = trim($_GET['GroupName']); + }else{ + prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + } + + }else{ + prnMsg(_('The page must be called with a group id'),'error'); + include('includes/footer.php'); + exit; + } + GetUsers($GroupId,$GroupName); + include('includes/footer.php'); + + +} +//Users remove one user from the group +if(isset($_GET['Remove'])){ + if(!empty($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ + $GroupName = trim($_GET['GroupName']); + }else{ + prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + + } + if(isset($_GET['UserId']) and mb_strlen($_GET['UserId'])<21 and !ContainsIllegalCharacters($_GET['UserId'])){ + $UserId = $_GET['UserId']; + }else{ + prnMsg(_('The User Id should be set and must be less than 21 and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + } + + if(isset($_GET['GroupId']) and is_numeric($_GET['GroupId'])){ + $GroupId = (int) $_GET['GroupId']; + if(isset($_GET['GroupName']) and mb_strlen($_GET['GroupName'])<=100 and !ContainsIllegalCharacters($_GET['GroupName'])){ + $GroupName = trim($_GET['GroupName']); + }else{ + prnMsg(_('The Group Name should be less than 100 and cannot contains illegal characters'),'error'); + include('includes/footer.php'); + exit; + } + + } + $sql = "DELETE FROM mailgroupdetails WHERE userid = '".$UserId."' AND groupname = '".$GroupName."'"; + $ErrMsg = 'Failed to delete the userid '.$UserId.' from group '.$GroupName; + $result = DB_query($sql,$ErrMsg); + GetUsers($GroupId,$GroupName); + + +} +if(!isset($_GET['Edit'])){//display the input form +?> +
+ + + + + +
+ + + + + + + + + + + + + + + + +
' . _('Edit') . ''; ?>' . _('Delete') . ''; ?>
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
      
+ diff --git a/Manufacturers.php b/Manufacturers.php index 939c382bb..fec066614 100644 --- a/Manufacturers.php +++ b/Manufacturers.php @@ -229,15 +229,7 @@ ' . _('Brands Image') . ' '; -$k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/BRAND-' . $myrow['manufacturers_id'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); if (extension_loaded('gd') && function_exists('gd_info') && file_exists($imagefile)){ @@ -253,7 +245,8 @@ $BrandImgLink = _('No Image'); } - printf('%s + printf(' + %s %s %s %s diff --git a/MaterialsNotUsed.php b/MaterialsNotUsed.php index a1ff8d671..22331459b 100644 --- a/MaterialsNotUsed.php +++ b/MaterialsNotUsed.php @@ -1,86 +1,81 @@ -' . _('Raw Materials Not Used in any BOM') . '

'; - echo '
'; - echo ''; - $TableHeader = ' - - - - - - - '; - echo $TableHeader; - $k = 0; //row colour counter - $i = 1; - while ($myrow = DB_fetch_array($result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $CodeLink = '' . $myrow['stockid'] . ''; - $LineValue = $myrow['qoh'] * $myrow['stdcost']; - $TotalValue = $TotalValue + $LineValue; - - printf(' - - - - - - ', - $i, - $CodeLink, - $myrow['description'], - locale_number_format($myrow['qoh'],$myrow['decimalplaces']), - locale_number_format($myrow['stdcost'],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LineValue,$_SESSION['CompanyRecord']['decimalplaces']) - ); - $i++; - } - - printf(' - - - ', - '', - _('Total').':', - locale_number_format($TotalValue,$_SESSION['CompanyRecord']['decimalplaces'])); - - echo '
' . _('#') . '' . _('Code') . '' . _('Description') . '' . _('QOH') . '' . _('Std Cost') . '' . _('Value') . '
%s%s%s%s%s%s
%s%s%s
-
- '; -} - -include ('includes/footer.php'); +' . _('Raw Materials Not Used in any BOM') . '

'; + echo '
'; + echo ''; + $TableHeader = ' + + + + + + + '; + echo $TableHeader; + $i = 1; + + while ($myrow = DB_fetch_array($result)) { + $CodeLink = '' . $myrow['stockid'] . ''; + $LineValue = $myrow['qoh'] * $myrow['stdcost']; + $TotalValue = $TotalValue + $LineValue; + + printf(' + + + + + + + ', + $i, + $CodeLink, + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['stdcost'],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LineValue,$_SESSION['CompanyRecord']['decimalplaces']) + ); + $i++; + } + + printf(' + + + + ', + '', + _('Total').':', + locale_number_format($TotalValue,$_SESSION['CompanyRecord']['decimalplaces'])); + + echo '
' . _('#') . '' . _('Code') . '' . _('Description') . '' . _('QOH') . '' . _('Std Cost') . '' . _('Value') . '
%s%s%s%s%s%s
%s%s%s
+
+ '; +} + +include ('includes/footer.php'); ?> \ No newline at end of file diff --git a/NoSalesItems.php b/NoSalesItems.php index ddf86413f..4088b9429 100644 --- a/NoSalesItems.php +++ b/NoSalesItems.php @@ -183,7 +183,7 @@ ORDER BY stockmaster.stockid"; } $result = DB_query($SQL); - echo '

' . _('No Sales Items') . '

'; + echo '

' . _('No Sales Items') . '

'; echo '
'; echo ''; @@ -200,16 +200,9 @@ echo ''; - $k = 0; //row colour counter + $i = 1; while ($myrow = DB_fetch_array($result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $QOHResult = DB_query("SELECT sum(quantity) FROM locstock INNER JOIN locationusers ON locationusers.loccode=locstock.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 @@ -220,7 +213,8 @@ $CodeLink = '' . $myrow['stockid'] . ''; if ($_POST['Location'][0] == 'All') { - printf(' + printf(' + @@ -237,7 +231,8 @@ $myrow['units'] //unit ); }else{ - printf(' + printf(' + diff --git a/OffersReceived.php b/OffersReceived.php index 95d57ed14..bfabfb68e 100644 --- a/OffersReceived.php +++ b/OffersReceived.php @@ -115,17 +115,12 @@ '; - $k=0; + echo 'The result has rows '.DB_num_rows($result) . '
'; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + diff --git a/OrderDetails.php b/OrderDetails.php index 026cf9acd..2c3f316c7 100644 --- a/OrderDetails.php +++ b/OrderDetails.php @@ -82,62 +82,63 @@ - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + - + - + +
%s
%s %s %s %s%s
%s %s %s %s' . _('Reject') . ' ' . _('Defer') . '
' . $myrow['offerid'] . '
' . $myrow['offerid'] . ' ' . $myrow['suppname'] . ' ' . $myrow['description'] . ' ' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '

' . _('Order Header Details For Order No').' '.$_GET['OrderNumber'] . '

' . _('Customer Code') . ':' . $myrow['debtorno'] . '' . _('Customer Name') . ':' . _('Customer Code') . ':' . $myrow['debtorno'] . '' . _('Customer Name') . ': ' . $myrow['name'] . '
' . _('Customer Reference') . ':' . $myrow['customerref'] . '' . _('Deliver To') . ':' . _('Customer Reference') . ':' . $myrow['customerref'] . '' . _('Deliver To') . ': ' . $myrow['deliverto'] . '
' . _('Ordered On') . ':' . ConvertSQLDate($myrow['orddate']) . '' . _('Delivery Address 1') . ':' . $myrow['deladd1'] . '' . _('Ordered On') . ':' . ConvertSQLDate($myrow['orddate']) . '' . _('Delivery Address 1') . ':' . $myrow['deladd1'] . '
' . _('Requested Delivery') . ':' . ConvertSQLDate($myrow['deliverydate']) . '' . _('Delivery Address 2') . ':' . $myrow['deladd2'] . '' . _('Requested Delivery') . ':' . ConvertSQLDate($myrow['deliverydate']) . '' . _('Delivery Address 2') . ':' . $myrow['deladd2'] . '
' . _('Order Currency') . ':' . $myrow['currcode'] . '' . _('Delivery Address 3') . ':' . $myrow['deladd3'] . '' . _('Order Currency') . ':' . $myrow['currcode'] . '' . _('Delivery Address 3') . ':' . $myrow['deladd3'] . '
' . _('Deliver From Location') . ':' . $myrow['fromstkloc'] . '' . _('Delivery Address 4') . ':' . $myrow['deladd4'] . '' . _('Deliver From Location') . ':' . $myrow['fromstkloc'] . '' . _('Delivery Address 4') . ':' . $myrow['deladd4'] . '
' . _('Telephone') . ':' . $myrow['contactphone'] . '' . _('Delivery Address 5') . ':' . $myrow['deladd5'] . '' . _('Telephone') . ':' . $myrow['contactphone'] . '' . _('Delivery Address 5') . ':' . $myrow['deladd5'] . '
' . _('Email') . ':' . $myrow['contactemail'] . '' . _('Delivery Address 6') . ':' . $myrow['deladd6'] . '' . _('Email') . ':' . $myrow['contactemail'] . '' . _('Delivery Address 6') . ':' . $myrow['deladd6'] . '
' . _('Freight Cost') . ':' . $myrow['freightcost'] . '' . _('Freight Cost') . ':' . $myrow['freightcost'] . '
' . _('Comments'). ': ' . _('Comments'). ': ' . $myrow['comments'] . '
' . _('Invoices') . ':
' . _('Invoices') . ': ' . $Inv . '
'; @@ -195,16 +196,8 @@ ' . _('Last Del') . '/' . _('Due Date') . ' ' . _('Narrative') . ' '; - $k=0; - while ($myrow=DB_fetch_array($LineItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } + while ($myrow=DB_fetch_array($LineItemsResult)) { if ($myrow['qtyinvoiced']>0){ $DisplayActualDeliveryDate = ConvertSQLDate($myrow['actualdispatchdate']); @@ -212,7 +205,8 @@ $DisplayActualDeliveryDate = '' . ConvertSQLDate($myrow['itemdue']) . ''; } - echo '' . $myrow['poline'] . ' + echo ' + ' . $myrow['poline'] . ' ' . $myrow['stkcode'] . ' ' . $myrow['description'] . ' ' . $myrow['quantity'] . ' diff --git a/OutstandingGRNs.php b/OutstandingGRNs.php index 65dff1095..a4e32c42f 100755 --- a/OutstandingGRNs.php +++ b/OutstandingGRNs.php @@ -167,7 +167,7 @@ $Title=_('Outstanding GRNs Report'); include('includes/header.php'); - echo '

' . _('Goods Received but not invoiced Yet') . '

'; + echo '

' . _('Goods Received but not invoiced Yet') . '

'; echo '
' . _('Shows the list of goods received not yet invoiced, both in supplier currency and home currency. When run for all suppliers, the total in home curency should match the GL Account for Goods received not invoiced.') . '
'; @@ -189,20 +189,13 @@ ' . '' . ' '; echo $TableHeader; - $k = 0; //row colour counter $i = 1; $TotalHomeCurrency = 0; while ($GRNs = DB_fetch_array($GRNsResult) ){ - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $QtyPending = $GRNs['qtyrecd'] - $GRNs['quantityinv']; $TotalHomeCurrency = $TotalHomeCurrency + ($QtyPending * $GRNs['stdcostunit']); - printf('%s + printf(' + %s %s %s %s @@ -257,7 +250,7 @@ $Title=_('Outstanding GRNs Report'); include('includes/header.php'); - echo '

' . $Title . '

'; + echo '

' . $Title . '

'; echo '
' . _('Shows the list of goods received not yet invoiced, both in supplier currency and home currency. When run for all suppliers the total in home curency should match the GL Account for Goods received not invoiced.') . '
'; diff --git a/PDFPrintLabel.php b/PDFPrintLabel.php index d440d19fc..feaa3ac49 100644 --- a/PDFPrintLabel.php +++ b/PDFPrintLabel.php @@ -1,359 +1,359 @@ -=1){ - - $Title = _('Print Labels'); - include('includes/header.php'); - - $SQL = "SELECT prices.stockid, - stockmaster.description, - stockmaster.barcode, - prices.price, - currencies.decimalplaces - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - INNER JOIN prices - ON stockmaster.stockid=prices.stockid - INNER JOIN currencies - ON prices.currabrev=currencies.currabrev - WHERE stockmaster.categoryid = '" . $_POST['StockCategory'] . "' - AND prices.typeabbrev='" . $_POST['SalesType'] . "' - AND prices.currabrev='" . $_POST['Currency'] . "' - AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' - AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') - AND prices.debtorno='' - ORDER BY prices.currabrev, - stockmaster.categoryid, - stockmaster.stockid, - prices.startdate"; - - $LabelsResult = DB_query($SQL,'','',false,false); - - if (DB_error_no() !=0) { - prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg(), 'error'); - echo '
' . _('Back to the menu'). ''; - if ($debug==1){ - prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); - } - include('includes/footer.php'); - exit; - } - if (DB_num_rows($LabelsResult)==0){ - prnMsg(_('There were no price labels to print out for the category specified'),'warn'); - echo '
' . _('Back') . ''; - include('includes/footer.php'); - exit; - } - - - echo ''; - echo ''; - echo ' - - - - - - - - '; - - $i=0; - while ($LabelRow = DB_fetch_array($LabelsResult)){ - echo ' - - - - - '; - echo ' - - - '; - $i++; - } - $i--; - echo '
' . _('Item Code') . '' . _('Item Description') . '' . _('Price') . '' . _('Print') . ' ?
-
' . $LabelRow['stockid'] . '' . $LabelRow['description'] . '' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . ''; - if (isset($_POST['SelectAll']) AND isset($_POST['CheckAll'])) { - echo ''; - } else { - echo ''; - } - echo '
- - - - - - - -
-
- - -
-
- -
'; - include('includes/footer.php'); - exit; -} - -$NoOfLabels = 0; -if (isset($_POST['PrintLabels']) AND isset($_POST['NoOfLabels']) AND $_POST['NoOfLabels']>0){ - - for ($i=0;$i < $_POST['NoOfLabels'];$i++){ - if (isset($_POST['PrintLabel'.$i])){ - $NoOfLabels++; - } - } - if ($NoOfLabels ==0){ - prnMsg(_('There are no labels selected to print'),'info'); - } -} -if (isset($_POST['PrintLabels']) AND $NoOfLabels>0) { - - $result = DB_query("SELECT description, - pagewidth*" . $PtsPerMM . " as page_width, - pageheight*" . $PtsPerMM . " as page_height, - width*" . $PtsPerMM . " as label_width, - height*" . $PtsPerMM . " as label_height, - rowheight*" . $PtsPerMM . " as label_rowheight, - columnwidth*" . $PtsPerMM . " as label_columnwidth, - topmargin*" . $PtsPerMM . " as label_topmargin, - leftmargin*" . $PtsPerMM . " as label_leftmargin - FROM labels - WHERE labelid='" . $_POST['LabelID'] . "'"); - $LabelDimensions = DB_fetch_array($result); - - $result = DB_query("SELECT fieldvalue, - vpos, - hpos, - fontsize, - barcode - FROM labelfields - WHERE labelid = '" . $_POST['LabelID'] . "'"); - $LabelFields = array(); - $i=0; - while ($LabelFieldRow = DB_fetch_array($result)){ - if ($LabelFieldRow['fieldvalue'] == 'itemcode'){ - $LabelFields[$i]['FieldValue'] = 'stockid'; - } elseif ($LabelFieldRow['fieldvalue'] == 'itemdescription'){ - $LabelFields[$i]['FieldValue'] = 'description'; - } else { - $LabelFields[$i]['FieldValue'] = $LabelFieldRow['fieldvalue']; - } - $LabelFields[$i]['VPos'] = $LabelFieldRow['vpos']*$PtsPerMM; - $LabelFields[$i]['HPos'] = $LabelFieldRow['hpos']*$PtsPerMM; - $LabelFields[$i]['FontSize'] = $LabelFieldRow['fontsize']; - $LabelFields[$i]['Barcode'] = $LabelFieldRow['barcode']; - $i++; - } - - $PaperSize = 'Custom'; // so PDF starter wont default the DocumentPaper - $DocumentPaper = array($LabelDimensions['page_width'],$LabelDimensions['page_height']); - include('includes/PDFStarter.php'); - $Top_Margin = $LabelDimensions['label_topmargin']; - $Left_Margin = $LabelDimensions['label_leftmargin']; - $Page_Height = $LabelDimensions['page_height']; - $Page_Width = $LabelDimensions['page_width']; - $Right_Margin =0; - $Bottom_Margin =0; - - $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); - $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - - - $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); - $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - - $PageNumber=1; - //go down first then accross - $YPos = $Page_Height - $Top_Margin; //top of current label - $XPos = $Left_Margin; // left of current label - - $TotalLabels = $NoOfLabels * $_POST['LabelsPerItem']; - $LabelsPrinted = 0; - for ($i=0;$i < $_POST['NoOfLabels'];$i++){ - if (isset($_POST['PrintLabel'.$i])){ - $NoOfLabels--; - for ($LabelNumber=0; $LabelNumber < $_POST['LabelsPerItem'];$LabelNumber++){ - foreach ($LabelFields as $Field){ - //print_r($Field); - if ($Field['FieldValue']== 'price'){ - $Value = $_POST['Price' . $i] . ' '. $_POST['Currency']; - } elseif ($Field['FieldValue']== 'stockid'){ - $Value = $_POST['StockID' . $i]; - } elseif ($Field['FieldValue']== 'description'){ - $Value = $_POST['Description' . $i]; - } elseif ($Field['FieldValue']== 'barcode'){ - $Value = $_POST['Barcode' . $i]; - } - if ($Field['FieldValue'] == 'price'){ //need to format for the number of decimal places - $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value); - }elseif ($Field['FieldValue'] == 'logo'){ - $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']); - - }elseif($Field['Barcode']==1) { - - $BarcodeImage = new code128(str_replace('_','',$Value)); - - ob_start(); - imagepng(imagepng($BarcodeImage->draw())); - $Image_String = ob_get_contents(); - ob_end_clean(); - - $pdf->addJpegFromFile('@' . $Image_String,$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']); - - } else { - $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value); - } - } // end loop through label fields - $LabelsPrinted++; - if ($LabelsPrinted < $TotalLabels){ // if there is another label to print - //setup $YPos and $XPos for the next label - if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){ - /* not enough space below the above label to print a new label - * so the above was the last label in the column - * need to start either a new column or new page - */ - if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) { - /* Not enough space to start a new column so we are into a new page - */ - $pdf->newPage(); - $PageNumber++; - $YPos = $Page_Height - $Top_Margin; //top of next label - $XPos = $Left_Margin; // left of next label - } else { - /* There is enough space for another column */ - $YPos = $Page_Height - $Top_Margin; //back to the top of next label column - $XPos += $LabelDimensions['label_columnwidth']; // left of next label - } - } else { - /* There is space below to print a label - */ - $YPos -= $LabelDimensions['label_rowheight']; //Top of next label - } - }//end if there is another label to print - } - } //this label is set to print - } //loop through labels selected to print - - - $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; - ob_clean(); - $pdf->OutputI($FileName); - $pdf->__destruct(); - -} else { /*The option to print PDF was not hit */ - - $Title= _('Price Labels'); - include('includes/header.php'); - - echo '

- ' . ' ' . _('Print Price Labels') . '

'; - - if (!function_exists('gd_info')) { - prnMsg(_('The GD module for PHP is required to print barcode labels. Your PHP installation is not capable currently. You will most likely experience problems with this script until the GD module is enabled.'),'error'); - } - - - if (!isset($_POST['StockCategory'])) { - - /*if $StockCategory is not set then show a form to allow input */ - - echo '
- - - - - - - - - '; - - echo ' - '; - - echo ' - - - - - '; - - echo' - '; - - echo '
' . _('Label to print') . ':
' . _('For Stock Category') .':
' . _('For Sales Type/Price List').':
' . _('For Currency').':
' . _('Effective As At') . ':'; - echo '
' . _('Number of labels per item') . ':
-
-
- -
-
- -
'; - - } - include('includes/footer.php'); - -} /*end of else not PrintPDF */ - +=1){ + + $Title = _('Print Labels'); + include('includes/header.php'); + + $SQL = "SELECT prices.stockid, + stockmaster.description, + stockmaster.barcode, + prices.price, + currencies.decimalplaces + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + INNER JOIN prices + ON stockmaster.stockid=prices.stockid + INNER JOIN currencies + ON prices.currabrev=currencies.currabrev + WHERE stockmaster.categoryid = '" . $_POST['StockCategory'] . "' + AND prices.typeabbrev='" . $_POST['SalesType'] . "' + AND prices.currabrev='" . $_POST['Currency'] . "' + AND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "' + AND (prices.enddate='0000-00-00' OR prices.enddate>'" . FormatDateForSQL($_POST['EffectiveDate']) . "') + AND prices.debtorno='' + ORDER BY prices.currabrev, + stockmaster.categoryid, + stockmaster.stockid, + prices.startdate"; + + $LabelsResult = DB_query($SQL,'','',false,false); + + if (DB_error_no() !=0) { + prnMsg( _('The Price Labels could not be retrieved by the SQL because'). ' - ' . DB_error_msg(), 'error'); + echo '
' . _('Back to the menu'). ''; + if ($debug==1){ + prnMsg(_('For debugging purposes the SQL used was:') . $SQL,'error'); + } + include('includes/footer.php'); + exit; + } + if (DB_num_rows($LabelsResult)==0){ + prnMsg(_('There were no price labels to print out for the category specified'),'warn'); + echo '
' . _('Back') . ''; + include('includes/footer.php'); + exit; + } + + + echo '
'; + echo ''; + echo ' + + + + + + + + '; + + $i=0; + while ($LabelRow = DB_fetch_array($LabelsResult)){ + echo ' + + + + + '; + echo ' + + + '; + $i++; + } + $i--; + echo '
' . _('Item Code') . '' . _('Item Description') . '' . _('Price') . '' . _('Print') . ' ?
+
' . $LabelRow['stockid'] . '' . $LabelRow['description'] . '' . locale_number_format($LabelRow['price'],$LabelRow['decimalplaces']) . ''; + if (isset($_POST['SelectAll']) AND isset($_POST['CheckAll'])) { + echo ''; + } else { + echo ''; + } + echo '
+ + + + + + + +
+
+ + +
+
+ +
'; + include('includes/footer.php'); + exit; +} + +$NoOfLabels = 0; +if (isset($_POST['PrintLabels']) AND isset($_POST['NoOfLabels']) AND $_POST['NoOfLabels']>0){ + + for ($i=0;$i < $_POST['NoOfLabels'];$i++){ + if (isset($_POST['PrintLabel'.$i])){ + $NoOfLabels++; + } + } + if ($NoOfLabels ==0){ + prnMsg(_('There are no labels selected to print'),'info'); + } +} +if (isset($_POST['PrintLabels']) AND $NoOfLabels>0) { + + $result = DB_query("SELECT description, + pagewidth*" . $PtsPerMM . " as page_width, + pageheight*" . $PtsPerMM . " as page_height, + width*" . $PtsPerMM . " as label_width, + height*" . $PtsPerMM . " as label_height, + rowheight*" . $PtsPerMM . " as label_rowheight, + columnwidth*" . $PtsPerMM . " as label_columnwidth, + topmargin*" . $PtsPerMM . " as label_topmargin, + leftmargin*" . $PtsPerMM . " as label_leftmargin + FROM labels + WHERE labelid='" . $_POST['LabelID'] . "'"); + $LabelDimensions = DB_fetch_array($result); + + $result = DB_query("SELECT fieldvalue, + vpos, + hpos, + fontsize, + barcode + FROM labelfields + WHERE labelid = '" . $_POST['LabelID'] . "'"); + $LabelFields = array(); + $i=0; + while ($LabelFieldRow = DB_fetch_array($result)){ + if ($LabelFieldRow['fieldvalue'] == 'itemcode'){ + $LabelFields[$i]['FieldValue'] = 'stockid'; + } elseif ($LabelFieldRow['fieldvalue'] == 'itemdescription'){ + $LabelFields[$i]['FieldValue'] = 'description'; + } else { + $LabelFields[$i]['FieldValue'] = $LabelFieldRow['fieldvalue']; + } + $LabelFields[$i]['VPos'] = $LabelFieldRow['vpos']*$PtsPerMM; + $LabelFields[$i]['HPos'] = $LabelFieldRow['hpos']*$PtsPerMM; + $LabelFields[$i]['FontSize'] = $LabelFieldRow['fontsize']; + $LabelFields[$i]['Barcode'] = $LabelFieldRow['barcode']; + $i++; + } + + $PaperSize = 'Custom'; // so PDF starter wont default the DocumentPaper + $DocumentPaper = array($LabelDimensions['page_width'],$LabelDimensions['page_height']); + include('includes/PDFStarter.php'); + $Top_Margin = $LabelDimensions['label_topmargin']; + $Left_Margin = $LabelDimensions['label_leftmargin']; + $Page_Height = $LabelDimensions['page_height']; + $Page_Width = $LabelDimensions['page_width']; + $Right_Margin =0; + $Bottom_Margin =0; + + $pdf->addInfo('Title', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->addInfo('Subject', $LabelDimensions['description'] . ' ' . _('Price Labels') ); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + + + $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + + $PageNumber=1; + //go down first then accross + $YPos = $Page_Height - $Top_Margin; //top of current label + $XPos = $Left_Margin; // left of current label + + $TotalLabels = $NoOfLabels * $_POST['LabelsPerItem']; + $LabelsPrinted = 0; + for ($i=0;$i < $_POST['NoOfLabels'];$i++){ + if (isset($_POST['PrintLabel'.$i])){ + $NoOfLabels--; + for ($LabelNumber=0; $LabelNumber < $_POST['LabelsPerItem'];$LabelNumber++){ + foreach ($LabelFields as $Field){ + //print_r($Field); + if ($Field['FieldValue']== 'price'){ + $Value = $_POST['Price' . $i] . ' '. $_POST['Currency']; + } elseif ($Field['FieldValue']== 'stockid'){ + $Value = $_POST['StockID' . $i]; + } elseif ($Field['FieldValue']== 'description'){ + $Value = $_POST['Description' . $i]; + } elseif ($Field['FieldValue']== 'barcode'){ + $Value = $_POST['Barcode' . $i]; + } + if ($Field['FieldValue'] == 'price'){ //need to format for the number of decimal places + $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value); + }elseif ($Field['FieldValue'] == 'logo'){ + $pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']); + + }elseif($Field['Barcode']==1) { + + $BarcodeImage = new code128(str_replace('_','',$Value)); + + ob_start(); + imagepng(imagepng($BarcodeImage->draw())); + $Image_String = ob_get_contents(); + ob_end_clean(); + + $pdf->addJpegFromFile('@' . $Image_String,$XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],'', $Field['FontSize']); + + } else { + $LeftOvers = $pdf->addTextWrap($XPos+$Field['HPos'],$YPos-$LabelDimensions['label_height']+$Field['VPos'],$LabelDimensions['label_width']-$Field['HPos'],$Field['FontSize'],$Value); + } + } // end loop through label fields + $LabelsPrinted++; + if ($LabelsPrinted < $TotalLabels){ // if there is another label to print + //setup $YPos and $XPos for the next label + if (($YPos - $LabelDimensions['label_rowheight']) < $LabelDimensions['label_height']){ + /* not enough space below the above label to print a new label + * so the above was the last label in the column + * need to start either a new column or new page + */ + if (($Page_Width - $XPos - $LabelDimensions['label_columnwidth']) < $LabelDimensions['label_width']) { + /* Not enough space to start a new column so we are into a new page + */ + $pdf->newPage(); + $PageNumber++; + $YPos = $Page_Height - $Top_Margin; //top of next label + $XPos = $Left_Margin; // left of next label + } else { + /* There is enough space for another column */ + $YPos = $Page_Height - $Top_Margin; //back to the top of next label column + $XPos += $LabelDimensions['label_columnwidth']; // left of next label + } + } else { + /* There is space below to print a label + */ + $YPos -= $LabelDimensions['label_rowheight']; //Top of next label + } + }//end if there is another label to print + } + } //this label is set to print + } //loop through labels selected to print + + + $FileName=$_SESSION['DatabaseName']. '_' . _('Price_Labels') . '_' . date('Y-m-d').'.pdf'; + ob_clean(); + $pdf->OutputI($FileName); + $pdf->__destruct(); + +} else { /*The option to print PDF was not hit */ + + $Title= _('Price Labels'); + include('includes/header.php'); + + echo '

+ ' . ' ' . _('Print Price Labels') . '

'; + + if (!function_exists('gd_info')) { + prnMsg(_('The GD module for PHP is required to print barcode labels. Your PHP installation is not capable currently. You will most likely experience problems with this script until the GD module is enabled.'),'error'); + } + + + if (!isset($_POST['StockCategory'])) { + + /*if $StockCategory is not set then show a form to allow input */ + + echo '
+ + + + + + + + + '; + + echo ' + '; + + echo ' + + + + + '; + + echo' + '; + + echo '
' . _('Label to print') . ':
' . _('For Stock Category') .':
' . _('For Sales Type/Price List').':
' . _('For Currency').':
' . _('Effective As At') . ':'; + echo '
' . _('Number of labels per item') . ':
+
+
+ +
+
+ +
'; + + } + include('includes/footer.php'); + +} /*end of else not PrintPDF */ + ?> \ No newline at end of file diff --git a/PDFWeeklyOrders.php b/PDFWeeklyOrders.php index 15d2ae701..8c22a2297 100644 --- a/PDFWeeklyOrders.php +++ b/PDFWeeklyOrders.php @@ -195,7 +195,7 @@ $attachment = $mail->getFile($filename); $mail->setText(_('Please find the weekly order report')); $mail->setSubject(_('Weekly Orders Report')); -$mail->addAttachment($attachment, $filename, 'application/pdf'); +$mail->addAttachment($attachment, $filename, 'application/pdf'); if($_SESSION['SmtpSetting']==0){ $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . '<' . $_SESSION['CompanyRecord']['email'] . '>'); $result = $mail->send($Recipients); diff --git a/POReport.php b/POReport.php index 2fdbd0ee3..5b2ff9029 100644 --- a/POReport.php +++ b/POReport.php @@ -553,18 +553,13 @@ function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$Suppli '; $linectr = 0; - $k = 0; + while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $linectr++; + // Detail for both DateType of Order - printf('%s + printf(' + %s %s %s %s @@ -642,19 +637,14 @@ function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$Suppli '; $linectr = 0; - $k = 0; + while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $linectr++; + // Detail for both DateType of Ship // In sql, had to alias grns.qtyrecd as quantityord so could use same name here - printf('%s + printf(' + %s %s %s %s @@ -774,20 +764,15 @@ function submit(&$db,$PartNumber,$PartNumberOp,$SupplierId,$SupplierIdOp,$Suppli $suppname = ' '; $linectr = 0; - $k=0; + while ($myrow = DB_fetch_array($result)) { $linectr++; if ($summarytype == 'orderno') { $suppname = $myrow['suppname']; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - printf('%s + + printf(' + %s %s %s %s diff --git a/PO_Header.php b/PO_Header.php index c26109aa3..03eb782c7 100644 --- a/PO_Header.php +++ b/PO_Header.php @@ -563,20 +563,13 @@ ' . _('Address') . ' ' . _('Currency') . ' '; + $j = 1; - $k = 0; - /*row counter to determine background colour */ while ($myrow = DB_fetch_array($result_SuppSelect)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + ' . $myrow['suppname'] . ''; for ($i = 1; $i <= 6; $i++) { diff --git a/PO_Items.php b/PO_Items.php index 307da231b..335f934e8 100644 --- a/PO_Items.php +++ b/PO_Items.php @@ -726,7 +726,6 @@ '; $_SESSION['PO'.$identifier]->Total = 0; - $k = 0; //row colour counter foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { @@ -743,15 +742,8 @@ $SuppPrice = locale_number_format(round(($POLine->Price *$POLine->ConversionFactor),($_SESSION['PO'.$identifier]->CurrDecimalPlaces+2)),($_SESSION['PO'.$identifier]->CurrDecimalPlaces+2)); } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $POLine->StockID . ' + echo ' + ' . $POLine->StockID . ' ' . locale_number_format($POLine->Quantity,$POLine->DecimalPlaces) . ' ' . $POLine->Units . ' @@ -1180,7 +1172,7 @@ $PageBar .= ''; else $PageBar .= ''; - $PageBar .= ''; + $PageBar .= ''; if($Offset<$ListPageMax) $PageBar .= ''; else @@ -1202,18 +1194,9 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $SupportedImgExt = array('png','jpg','jpeg'); $imagefilearray = (glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE)); @@ -1249,7 +1232,8 @@ $OrderUnits=$myrow['units']; $ConversionFactor =1; } - echo '' . $myrow['stockid'] . ' + echo ' + ' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['units'] . ' ' . $ConversionFactor . ' diff --git a/PO_OrderDetails.php b/PO_OrderDetails.php index bccb1b258..a512453d6 100644 --- a/PO_OrderDetails.php +++ b/PO_OrderDetails.php @@ -193,7 +193,6 @@ ' . _('Reqd Date'). ' '; -$k =0; //row colour counter $OrderTotal=0; $RecdTotal=0; @@ -213,13 +212,7 @@ AND Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']), $DisplayReqdDate)){ echo ''; } else { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } + echo ''; } printf ('%s diff --git a/PO_SelectOSPurchOrder.php b/PO_SelectOSPurchOrder.php index 29cdffe93..5c969fee8 100644 --- a/PO_SelectOSPurchOrder.php +++ b/PO_SelectOSPurchOrder.php @@ -305,7 +305,6 @@ ' . _('Units') . ' '; - $k = 0; //row colour counter $StocksStr = '('; $q = 0; while ($myrow = DB_fetch_array($StockItemsResult)){ @@ -327,16 +326,9 @@ while ($myrow = DB_fetch_array($StockItemsResult)) { $myrow['qoh'] = $QOH[$myrow['stockid']]; - if ($k == 1) { - echo ''; - $k = 0; - } //$k == 1 - else { - echo ''; - $k = 1; - } - printf(' + printf(' + %s %s %s @@ -615,7 +607,7 @@ ' . _('Receive') . ' '; $j = 1; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($PurchOrdersResult)) { $Bal = ''; if (isset($_POST['PODetails'])) { @@ -635,16 +627,6 @@ $BalRow = ''; } - if ($k == 1) { - /*alternate bgcolour of row for highlighting */ - echo ''; - $k = 0; - } //$k == 1 - else { - echo ''; - $k++; - } - $ModifyPage = $RootPath . '/PO_Header.php?ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['status'] == 'Printed') { $ReceiveOrder = '' . _('Receive') . ''; @@ -671,7 +653,8 @@ $MyUserRow = DB_fetch_array($UserResult); $InitiatorName = $MyUserRow['realname']; - echo '' . $myrow['orderno'] . ' + echo ' + ' . $myrow['orderno'] . ' ' . $FormatedOrderDate . ' ' . $FormatedDeliveryDate . ' ' . $InitiatorName . ' diff --git a/PaymentAllocations.php b/PaymentAllocations.php index bbe11bf26..c97e8a07c 100644 --- a/PaymentAllocations.php +++ b/PaymentAllocations.php @@ -71,17 +71,10 @@ echo $TableHeader; $j=1; -$k=0; //row colour counter while ($myrow = DB_fetch_array($Result)) { - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - - echo '' . $myrow['supplierno'] . ' + + echo ' + ' . $myrow['supplierno'] . ' ' . $myrow['suppreference'] . ' ' . ConvertSQLDate($myrow['trandate']) . ' ' . locale_number_format($myrow['alloc'],$myrow['currdecimalplaces']) . ' diff --git a/PaymentMethods.php b/PaymentMethods.php index 4b11c157d..0b5165768 100644 --- a/PaymentMethods.php +++ b/PaymentMethods.php @@ -212,18 +212,10 @@   '; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - echo '' . $myrow['paymentname'] . ' + echo ' + ' . $myrow['paymentname'] . ' ' . ($myrow['paymenttype'] ? _('Yes') : _('No')) . ' ' . ($myrow['receipttype'] ? _('Yes') : _('No')) . ' ' . ($myrow['usepreprintedstationery'] ? _('Yes') : _('No')) . ' @@ -239,7 +231,7 @@ if (isset($SelectedPaymentID)) { - echo ''; + echo ''; } echo '
'; diff --git a/PcAnalysis.php b/PcAnalysis.php index 7f7ef5426..53f39a96d 100644 --- a/PcAnalysis.php +++ b/PcAnalysis.php @@ -1,257 +1,257 @@ -= '" . beginning_of_month($MyRow['lastdate_in_period']). "' - AND date <= '" . $MyRow['lastdate_in_period'] . "') AS expense_period".$NumPeriod.", "; - } - // Creation of final part of SQL - $SQL = $SQL." pcexpenses.description - FROM pcexpenses - ORDER BY pcexpenses.codeexpense"; - - $Result = DB_query($SQL); - if (DB_num_rows($Result) != 0){ - - // Create new PHPExcel object - $objPHPExcel = new PHPExcel(); - - // Set document properties - $objPHPExcel->getProperties()->setCreator("webERP") - ->setLastModifiedBy("webERP") - ->setTitle("Petty Cash Expenses Analysis") - ->setSubject("Petty Cash Expenses Analysis") - ->setDescription("Petty Cash Expenses Analysis") - ->setKeywords("") - ->setCategory(""); - - // Formatting - - $objPHPExcel->getActiveSheet()->getStyle('C:AB')->getNumberFormat()->setFormatCode('#,##0.00'); - $objPHPExcel->getActiveSheet()->getStyle('4')->getFont()->setBold(true); - $objPHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setBold(true); - $objPHPExcel->getActiveSheet()->getStyle('A:B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); - - // Add title data - $objPHPExcel->setActiveSheetIndex(0); - $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Petty Cash Tab(s)'); - $objPHPExcel->getActiveSheet()->setCellValue('B2', $TabToShow); - $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Expense Code'); - $objPHPExcel->getActiveSheet()->setCellValue('B4', 'Description'); - - $objPHPExcel->getActiveSheet()->setCellValue('C4', 'Total 12 Months'); - $objPHPExcel->getActiveSheet()->setCellValue('D4', 'Average 12 Months'); - - $objPHPExcel->getActiveSheet()->setCellValue('E4', $LabelsArray[24]); - $objPHPExcel->getActiveSheet()->setCellValue('F4', $LabelsArray[23]); - $objPHPExcel->getActiveSheet()->setCellValue('G4', $LabelsArray[22]); - $objPHPExcel->getActiveSheet()->setCellValue('H4', $LabelsArray[21]); - $objPHPExcel->getActiveSheet()->setCellValue('I4', $LabelsArray[20]); - $objPHPExcel->getActiveSheet()->setCellValue('J4', $LabelsArray[19]); - $objPHPExcel->getActiveSheet()->setCellValue('K4', $LabelsArray[18]); - $objPHPExcel->getActiveSheet()->setCellValue('L4', $LabelsArray[17]); - $objPHPExcel->getActiveSheet()->setCellValue('M4', $LabelsArray[16]); - $objPHPExcel->getActiveSheet()->setCellValue('N4', $LabelsArray[15]); - $objPHPExcel->getActiveSheet()->setCellValue('O4', $LabelsArray[14]); - $objPHPExcel->getActiveSheet()->setCellValue('P4', $LabelsArray[13]); - $objPHPExcel->getActiveSheet()->setCellValue('Q4', $LabelsArray[12]); - $objPHPExcel->getActiveSheet()->setCellValue('R4', $LabelsArray[11]); - $objPHPExcel->getActiveSheet()->setCellValue('S4', $LabelsArray[10]); - $objPHPExcel->getActiveSheet()->setCellValue('T4', $LabelsArray[9]); - $objPHPExcel->getActiveSheet()->setCellValue('U4', $LabelsArray[8]); - $objPHPExcel->getActiveSheet()->setCellValue('V4', $LabelsArray[7]); - $objPHPExcel->getActiveSheet()->setCellValue('W4', $LabelsArray[6]); - $objPHPExcel->getActiveSheet()->setCellValue('X4', $LabelsArray[5]); - $objPHPExcel->getActiveSheet()->setCellValue('Y4', $LabelsArray[4]); - $objPHPExcel->getActiveSheet()->setCellValue('Z4', $LabelsArray[3]); - $objPHPExcel->getActiveSheet()->setCellValue('AA4', $LabelsArray[2]); - $objPHPExcel->getActiveSheet()->setCellValue('AB4', $LabelsArray[1]); - - // Add data - $i = 5; - while ($MyRow = DB_fetch_array($Result)) { - $objPHPExcel->setActiveSheetIndex(0); - $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $MyRow['codeexpense']); - $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $MyRow['description']); - - $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, '=SUM(Q'.$i.':AB'.$i.')'); - $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=AVERAGE(Q'.$i.':AB'.$i.')'); - - $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, -$MyRow['expense_period24']); - $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, -$MyRow['expense_period23']); - $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, -$MyRow['expense_period22']); - $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, -$MyRow['expense_period21']); - $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, -$MyRow['expense_period20']); - $objPHPExcel->getActiveSheet()->setCellValue('J'.$i, -$MyRow['expense_period19']); - $objPHPExcel->getActiveSheet()->setCellValue('K'.$i, -$MyRow['expense_period18']); - $objPHPExcel->getActiveSheet()->setCellValue('L'.$i, -$MyRow['expense_period17']); - $objPHPExcel->getActiveSheet()->setCellValue('M'.$i, -$MyRow['expense_period16']); - $objPHPExcel->getActiveSheet()->setCellValue('N'.$i, -$MyRow['expense_period15']); - $objPHPExcel->getActiveSheet()->setCellValue('O'.$i, -$MyRow['expense_period14']); - $objPHPExcel->getActiveSheet()->setCellValue('P'.$i, -$MyRow['expense_period13']); - $objPHPExcel->getActiveSheet()->setCellValue('Q'.$i, -$MyRow['expense_period12']); - $objPHPExcel->getActiveSheet()->setCellValue('R'.$i, -$MyRow['expense_period11']); - $objPHPExcel->getActiveSheet()->setCellValue('S'.$i, -$MyRow['expense_period10']); - $objPHPExcel->getActiveSheet()->setCellValue('T'.$i, -$MyRow['expense_period9']); - $objPHPExcel->getActiveSheet()->setCellValue('U'.$i, -$MyRow['expense_period8']); - $objPHPExcel->getActiveSheet()->setCellValue('V'.$i, -$MyRow['expense_period7']); - $objPHPExcel->getActiveSheet()->setCellValue('W'.$i, -$MyRow['expense_period6']); - $objPHPExcel->getActiveSheet()->setCellValue('X'.$i, -$MyRow['expense_period5']); - $objPHPExcel->getActiveSheet()->setCellValue('Y'.$i, -$MyRow['expense_period4']); - $objPHPExcel->getActiveSheet()->setCellValue('Z'.$i, -$MyRow['expense_period3']); - $objPHPExcel->getActiveSheet()->setCellValue('AA'.$i, -$MyRow['expense_period2']); - $objPHPExcel->getActiveSheet()->setCellValue('AB'.$i, -$MyRow['expense_period1']); - - $i++; - } - - // Freeze panes - $objPHPExcel->getActiveSheet()->freezePane('E5'); - - // Auto Size columns - for($col = 'A'; $col !== $objPHPExcel->getActiveSheet()->getHighestDataColumn(); $col++) { - $objPHPExcel->getActiveSheet() - ->getColumnDimension($col) - ->setAutoSize(true); -} - - // Rename worksheet - if ($TabToShow=='All'){ - $objPHPExcel->getActiveSheet()->setTitle('All Accounts'); - }else{ - $objPHPExcel->getActiveSheet()->setTitle($TabToShow); - } - // Set active sheet index to the first sheet, so Excel opens this as the first sheet - $objPHPExcel->setActiveSheetIndex(0); - - // Redirect output to a client’s web browser (Excel2007) - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - $File = 'PCExpensesAnalysis-' . Date('Y-m-d'). '.xlsx'; - header('Content-Disposition: attachment;filename="' . $File . '"'); - header('Cache-Control: max-age=0'); - // If you're serving to IE 9, then the following may be needed - header('Cache-Control: max-age=1'); - - // If you're serving to IE over SSL, then the following may be needed - header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past - header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified - header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 - header ('Pragma: public'); // HTTP/1.0 - - $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); - $objWriter->save('php://output'); - - }else{ - $Title = _('Excel file for Petty Cash Expenses Analysis'); - include('includes/header.php'); - prnMsg('There is no data to analyse'); - include('includes/footer.php'); - } - } -} // End of function submit() - - -function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### -{ -// Display form fields. This function is called the first time -// the page is called. - $Title = _('Excel file for Petty Cash Expenses Analysis'); - $ViewTopic = 'PettyCash';// Filename's id in ManualContents.php's TOC. - $BookMark = 'top';// Anchor's id in the manual's html document. - - include('includes/header.php'); - - echo '
-
-
'; - echo ''; - - echo '

- ' . ' ' . _('Excel file for Petty Cash Expenses Analysis') . ' -

'; - - echo ' - - - - '; - - echo ' - - - - - -
' . _('For Petty Cash Tabs') . ': -
 
 
-
'; - echo '
-
'; - include('includes/footer.php'); - -} // End of function display() - -function beginning_of_month($Date){ - $Date2 = explode("-",$Date); - $M = $Date2[1]; - $Y = $Date2[0]; - $FirstOfMonth = $Y . '-' . $M . '-01'; - return $FirstOfMonth; -} - += '" . beginning_of_month($MyRow['lastdate_in_period']). "' + AND date <= '" . $MyRow['lastdate_in_period'] . "') AS expense_period".$NumPeriod.", "; + } + // Creation of final part of SQL + $SQL = $SQL." pcexpenses.description + FROM pcexpenses + ORDER BY pcexpenses.codeexpense"; + + $Result = DB_query($SQL); + if (DB_num_rows($Result) != 0){ + + // Create new PHPExcel object + $objPHPExcel = new PHPExcel(); + + // Set document properties + $objPHPExcel->getProperties()->setCreator("webERP") + ->setLastModifiedBy("webERP") + ->setTitle("Petty Cash Expenses Analysis") + ->setSubject("Petty Cash Expenses Analysis") + ->setDescription("Petty Cash Expenses Analysis") + ->setKeywords("") + ->setCategory(""); + + // Formatting + + $objPHPExcel->getActiveSheet()->getStyle('C:AB')->getNumberFormat()->setFormatCode('#,##0.00'); + $objPHPExcel->getActiveSheet()->getStyle('4')->getFont()->setBold(true); + $objPHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setBold(true); + $objPHPExcel->getActiveSheet()->getStyle('A:B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); + + // Add title data + $objPHPExcel->setActiveSheetIndex(0); + $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Petty Cash Tab(s)'); + $objPHPExcel->getActiveSheet()->setCellValue('B2', $TabToShow); + $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Expense Code'); + $objPHPExcel->getActiveSheet()->setCellValue('B4', 'Description'); + + $objPHPExcel->getActiveSheet()->setCellValue('C4', 'Total 12 Months'); + $objPHPExcel->getActiveSheet()->setCellValue('D4', 'Average 12 Months'); + + $objPHPExcel->getActiveSheet()->setCellValue('E4', $LabelsArray[24]); + $objPHPExcel->getActiveSheet()->setCellValue('F4', $LabelsArray[23]); + $objPHPExcel->getActiveSheet()->setCellValue('G4', $LabelsArray[22]); + $objPHPExcel->getActiveSheet()->setCellValue('H4', $LabelsArray[21]); + $objPHPExcel->getActiveSheet()->setCellValue('I4', $LabelsArray[20]); + $objPHPExcel->getActiveSheet()->setCellValue('J4', $LabelsArray[19]); + $objPHPExcel->getActiveSheet()->setCellValue('K4', $LabelsArray[18]); + $objPHPExcel->getActiveSheet()->setCellValue('L4', $LabelsArray[17]); + $objPHPExcel->getActiveSheet()->setCellValue('M4', $LabelsArray[16]); + $objPHPExcel->getActiveSheet()->setCellValue('N4', $LabelsArray[15]); + $objPHPExcel->getActiveSheet()->setCellValue('O4', $LabelsArray[14]); + $objPHPExcel->getActiveSheet()->setCellValue('P4', $LabelsArray[13]); + $objPHPExcel->getActiveSheet()->setCellValue('Q4', $LabelsArray[12]); + $objPHPExcel->getActiveSheet()->setCellValue('R4', $LabelsArray[11]); + $objPHPExcel->getActiveSheet()->setCellValue('S4', $LabelsArray[10]); + $objPHPExcel->getActiveSheet()->setCellValue('T4', $LabelsArray[9]); + $objPHPExcel->getActiveSheet()->setCellValue('U4', $LabelsArray[8]); + $objPHPExcel->getActiveSheet()->setCellValue('V4', $LabelsArray[7]); + $objPHPExcel->getActiveSheet()->setCellValue('W4', $LabelsArray[6]); + $objPHPExcel->getActiveSheet()->setCellValue('X4', $LabelsArray[5]); + $objPHPExcel->getActiveSheet()->setCellValue('Y4', $LabelsArray[4]); + $objPHPExcel->getActiveSheet()->setCellValue('Z4', $LabelsArray[3]); + $objPHPExcel->getActiveSheet()->setCellValue('AA4', $LabelsArray[2]); + $objPHPExcel->getActiveSheet()->setCellValue('AB4', $LabelsArray[1]); + + // Add data + $i = 5; + while ($MyRow = DB_fetch_array($Result)) { + $objPHPExcel->setActiveSheetIndex(0); + $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $MyRow['codeexpense']); + $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $MyRow['description']); + + $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, '=SUM(Q'.$i.':AB'.$i.')'); + $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=AVERAGE(Q'.$i.':AB'.$i.')'); + + $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, -$MyRow['expense_period24']); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, -$MyRow['expense_period23']); + $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, -$MyRow['expense_period22']); + $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, -$MyRow['expense_period21']); + $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, -$MyRow['expense_period20']); + $objPHPExcel->getActiveSheet()->setCellValue('J'.$i, -$MyRow['expense_period19']); + $objPHPExcel->getActiveSheet()->setCellValue('K'.$i, -$MyRow['expense_period18']); + $objPHPExcel->getActiveSheet()->setCellValue('L'.$i, -$MyRow['expense_period17']); + $objPHPExcel->getActiveSheet()->setCellValue('M'.$i, -$MyRow['expense_period16']); + $objPHPExcel->getActiveSheet()->setCellValue('N'.$i, -$MyRow['expense_period15']); + $objPHPExcel->getActiveSheet()->setCellValue('O'.$i, -$MyRow['expense_period14']); + $objPHPExcel->getActiveSheet()->setCellValue('P'.$i, -$MyRow['expense_period13']); + $objPHPExcel->getActiveSheet()->setCellValue('Q'.$i, -$MyRow['expense_period12']); + $objPHPExcel->getActiveSheet()->setCellValue('R'.$i, -$MyRow['expense_period11']); + $objPHPExcel->getActiveSheet()->setCellValue('S'.$i, -$MyRow['expense_period10']); + $objPHPExcel->getActiveSheet()->setCellValue('T'.$i, -$MyRow['expense_period9']); + $objPHPExcel->getActiveSheet()->setCellValue('U'.$i, -$MyRow['expense_period8']); + $objPHPExcel->getActiveSheet()->setCellValue('V'.$i, -$MyRow['expense_period7']); + $objPHPExcel->getActiveSheet()->setCellValue('W'.$i, -$MyRow['expense_period6']); + $objPHPExcel->getActiveSheet()->setCellValue('X'.$i, -$MyRow['expense_period5']); + $objPHPExcel->getActiveSheet()->setCellValue('Y'.$i, -$MyRow['expense_period4']); + $objPHPExcel->getActiveSheet()->setCellValue('Z'.$i, -$MyRow['expense_period3']); + $objPHPExcel->getActiveSheet()->setCellValue('AA'.$i, -$MyRow['expense_period2']); + $objPHPExcel->getActiveSheet()->setCellValue('AB'.$i, -$MyRow['expense_period1']); + + $i++; + } + + // Freeze panes + $objPHPExcel->getActiveSheet()->freezePane('E5'); + + // Auto Size columns + for($col = 'A'; $col !== $objPHPExcel->getActiveSheet()->getHighestDataColumn(); $col++) { + $objPHPExcel->getActiveSheet() + ->getColumnDimension($col) + ->setAutoSize(true); +} + + // Rename worksheet + if ($TabToShow=='All'){ + $objPHPExcel->getActiveSheet()->setTitle('All Accounts'); + }else{ + $objPHPExcel->getActiveSheet()->setTitle($TabToShow); + } + // Set active sheet index to the first sheet, so Excel opens this as the first sheet + $objPHPExcel->setActiveSheetIndex(0); + + // Redirect output to a client’s web browser (Excel2007) + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + $File = 'PCExpensesAnalysis-' . Date('Y-m-d'). '.xlsx'; + header('Content-Disposition: attachment;filename="' . $File . '"'); + header('Cache-Control: max-age=0'); + // If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + + // If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified + header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 + header ('Pragma: public'); // HTTP/1.0 + + $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); + $objWriter->save('php://output'); + + }else{ + $Title = _('Excel file for Petty Cash Expenses Analysis'); + include('includes/header.php'); + prnMsg('There is no data to analyse'); + include('includes/footer.php'); + } + } +} // End of function submit() + + +function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### +{ +// Display form fields. This function is called the first time +// the page is called. + $Title = _('Excel file for Petty Cash Expenses Analysis'); + $ViewTopic = 'PettyCash';// Filename's id in ManualContents.php's TOC. + $BookMark = 'top';// Anchor's id in the manual's html document. + + include('includes/header.php'); + + echo '
+
+
'; + echo ''; + + echo '

+ ' . ' ' . _('Excel file for Petty Cash Expenses Analysis') . ' +

'; + + echo ' + + + + '; + + echo ' + + + + + +
' . _('For Petty Cash Tabs') . ': +
 
 
+
'; + echo '
+
'; + include('includes/footer.php'); + +} // End of function display() + +function beginning_of_month($Date){ + $Date2 = explode("-",$Date); + $M = $Date2[1]; + $Y = $Date2[0]; + $FirstOfMonth = $Y . '-' . $M . '-01'; + return $FirstOfMonth; +} + ?> \ No newline at end of file diff --git a/PcAssignCashTabToTab.php b/PcAssignCashTabToTab.php index fa5ef9625..657cce839 100644 --- a/PcAssignCashTabToTab.php +++ b/PcAssignCashTabToTab.php @@ -286,16 +286,7 @@ ' . _('Date Authorised') . ' '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $SQLDes="SELECT description FROM pcexpenses @@ -329,7 +320,8 @@ if (($MyRow['authorized'] == '0000-00-00') AND ($Description['0'] == 'ASSIGNCASH')){ // only cash assignations NOT authorized can be modified or deleted - echo '' . ConvertSQLDate($MyRow['date']) . ' + echo ' + ' . ConvertSQLDate($MyRow['date']) . ' ', $ExpenseCodeDes, ' ' . locale_number_format($MyRow['amount'],$CurrDecimalPlaces) . ' ' . $MyRow['notes'] . ' @@ -337,7 +329,8 @@ ' . $AuthorisedDate . ' '; }else{ - echo '' . ConvertSQLDate($MyRow['date']) . ' + echo ' + ' . ConvertSQLDate($MyRow['date']) . ' ', $ExpenseCodeDes, ' ' . locale_number_format($MyRow['amount'],$CurrDecimalPlaces) . ' ' . $MyRow['notes'] . ' @@ -375,7 +368,7 @@ echo ' - ' . _('Current balance') . ': + ' . _('Current balance') . ': ' . locale_number_format($SelectedTab['0'],$CurrDecimalPlaces) . ' diff --git a/PcAssignCashToTab.php b/PcAssignCashToTab.php index 070763048..06d88eaee 100644 --- a/PcAssignCashToTab.php +++ b/PcAssignCashToTab.php @@ -1,395 +1,390 @@ - - ', ' ', $Title, ' -

'; - /* actions to take once the user has clicked the submit button - ie the page has called itself with some user input */ - if ($_POST['Amount'] == 0) { - $InputError = 1; - prnMsg('
' . _('The Amount must be input'), 'error'); - } - $SQLLimit = "SELECT pctabs.tablimit, - pctabs.currency, - currencies.decimalplaces - FROM pctabs, - currencies - WHERE pctabs.currency = currencies.currabrev - AND pctabs.tabcode='" . $SelectedTabs . "'"; - $ResultLimit = DB_query($SQLLimit); - $Limit = DB_fetch_array($ResultLimit); - if (($_POST['CurrentAmount']) > $Limit['tablimit']){ - $InputError = 1; - prnMsg(_('Cash NOT assigned because PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'error'); - prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'error'); - } - if ($InputError !=1 and (($_POST['CurrentAmount'] + $_POST['Amount']) > $Limit['tablimit'])) { - prnMsg(_('Cash assigned but PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'warning'); - prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'warning'); - } - if ($InputError != 1 and isset($SelectedIndex)) { - $SQL = "UPDATE pcashdetails - SET date = '" . FormatDateForSQL($_POST['Date']) . "', - amount = '" . filter_number_format($_POST['Amount']) . "', - authorized = '0000-00-00', - notes = '" . $_POST['Notes'] . "', - WHERE counterindex = '" . $SelectedIndex . "'"; - $Msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); - } elseif ($InputError != 1) { - // Add new record on submit - $SQL = "INSERT INTO pcashdetails - (counterindex, - tabcode, - date, - codeexpense, - amount, - authorized, - posted, - notes) - VALUES (NULL, - '" . $_POST['SelectedTabs'] . "', - '" . FormatDateForSQL($_POST['Date']) . "', - 'ASSIGNCASH', - '" . filter_number_format($_POST['Amount']) . "', - '0000-00-00', - '0', - '" . $_POST['Notes'] . "', - )"; - $Msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); - } - if ($InputError != 1) { - //run the SQL from either of the above possibilites - $Result = DB_query($SQL); - prnMsg($Msg, 'success'); - unset($_POST['SelectedExpense']); - unset($_POST['Amount']); - unset($_POST['Notes']); - unset($_POST['SelectedTabs']); - unset($_POST['Date']); - } -} elseif (isset($_GET['delete'])) { - echo '

- ', ' ', $Title, ' -

'; - $SQL = "DELETE FROM pcashdetails - WHERE counterindex='" . $SelectedIndex . "'"; - $ErrMsg = _('The assignment of cash record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted'), 'success'); - unset($_GET['delete']); -} -if (!isset($SelectedTabs)) { - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - echo '

- ', ' ', $Title, ' -

'; - echo '
'; - echo ''; - $SQL = "SELECT tabcode - FROM pctabs - WHERE assigner='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; - $Result = DB_query($SQL); - echo ' - - - - '; - echo '
', _('Assign cash to petty cash tab'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} -//end of ifs and buts! -if (isset($_POST['Process']) or isset($SelectedTabs)) { - if (!isset($_POST['submit'])) { - echo '

- ', ' ', $Title, ' -

'; - } - echo ''; - - echo '
'; - echo ' - - - '; - echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; - - if (!isset($_GET['edit']) or isset($_POST['GO'])) { - if (isset($_POST['Cancel'])) { - unset($_POST['Amount']); - unset($_POST['Date']); - unset($_POST['Notes']); - } - if (!isset($Days)) { - $Days = 30; - } - /* Retrieve decimal places to display */ - $SqlDecimalPlaces = "SELECT decimalplaces - FROM currencies,pctabs - WHERE currencies.currabrev = pctabs.currency - AND tabcode='" . $SelectedTabs . "'"; - $Result = DB_query($SqlDecimalPlaces); - $MyRow = DB_fetch_array($Result); - $CurrDecimalPlaces = $MyRow['decimalplaces']; - $SQL = "SELECT counterindex, - tabcode, - tag, - date, - codeexpense, - amount, - authorized, - posted, - notes - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY) - ORDER BY date, - counterindex ASC"; - $Result = DB_query($SQL); - echo '
'; - echo ''; - - //Limit expenses history to X days - echo ' - - - -
', _('Detail of Tab Movements For Last'), ': - - ' . _('Days') . ' - -
'; - - echo ' - - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - $SQLdes = "SELECT description - FROM pcexpenses - WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; - $ResultDes = DB_query($SQLdes); - $Description = DB_fetch_array($ResultDes); - if (!isset($Description[0])) { - $ExpenseCodeDes = 'ASSIGNCASH'; - } else { - $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; - } - - if ($MyRow['authorized'] == '0000-00-00') { - $AuthorisedDate = _('Unauthorised'); - } else { - $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); - } - - //Generate download link for expense receipt, or show text if no receipt file is found. - $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions - $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($SelectedTabs); //Receipts upload directory - $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. - if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found - $ReceiptText = '' . _('Download attachment') . ''; - } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { - $ReceiptText = ''; - } else { - $ReceiptText = _('No attachment'); - } - - if (($MyRow['authorized'] == '0000-00-00') and ($ExpenseCodeDes == 'ASSIGNCASH')) { - // only cash assignations NOT authorized can be modified or deleted - echo ' - - - - - - - - '; - } else { - echo ' - - - - - - '; - } - } - //END WHILE LIST LOOP - $SQLamount = "SELECT sum(amount) - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "'"; - $ResultAmount = DB_query($SQLamount); - $Amount = DB_fetch_array($ResultAmount); - if (!isset($Amount['0'])) { - $Amount['0'] = 0; - } - echo ' - - - '; - echo '
', _('Date'), '', _('Expense Code'), '', _('Amount'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '', _('Edit'), '' . _('Delete') . '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
-
'; - } - if (!isset($_GET['delete'])) { - if (!isset($Amount['0'])) { - $Amount['0'] = 0; - } - echo '
'; - echo ''; - if (isset($_GET['edit'])) { - /* Retrieve decimal places to display */ - $SqlDecimalPlaces = "SELECT decimalplaces - FROM currencies,pctabs - WHERE currencies.currabrev = pctabs.currency - AND tabcode='" . $SelectedTabs . "'"; - $Result = DB_query($SqlDecimalPlaces); - $MyRow = DB_fetch_array($Result); - $CurrDecimalPlaces = $MyRow['decimalplaces']; - $SQL = "SELECT counterindex, - tabcode, - tag, - date, - codeexpense, - amount, - authorized, - posted, - notes, - FROM pcashdetails - WHERE counterindex='" . $SelectedIndex . "'"; - $Result = DB_query($SQL); - $MyRow = DB_fetch_array($Result); - $_POST['Date'] = ConvertSQLDate($MyRow['date']); - $_POST['SelectedExpense'] = $MyRow['codeexpense']; - $_POST['Amount'] = $MyRow['amount']; - $_POST['Notes'] = $MyRow['notes']; - echo ''; - echo ''; - echo ''; - echo ''; - } - /* Ricard: needs revision of this date initialization */ - if (!isset($_POST['Date'])) { - $_POST['Date'] = Date($_SESSION['DefaultDateFormat']); - } - echo '
'; //Main table - if (isset($_GET['SelectedIndex'])) { - echo ' - - '; - } else { - echo ' - - '; - } - echo ' - '; - echo ' - '; - if (!isset($_POST['Amount'])) { - $_POST['Amount'] = 0; - } - echo ' - - - '; - if (!isset($_POST['Notes'])) { - $_POST['Notes'] = ''; - } - echo ' - - - '; - echo '

', _('Update Cash Assignment'), '

', _('New Cash Assignment'), '

', _('Cash Assignment Date'), ': - -
', _('Amount'), ':
', _('Notes'), ':
'; // close main table - echo ''; - echo ''; - echo ''; - echo '
- - -
'; - echo '
'; - } // end if user wish to delete -} -include('includes/footer.php'); + + ', ' ', $Title, ' +

'; + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + if ($_POST['Amount'] == 0) { + $InputError = 1; + prnMsg('
' . _('The Amount must be input'), 'error'); + } + $SQLLimit = "SELECT pctabs.tablimit, + pctabs.currency, + currencies.decimalplaces + FROM pctabs, + currencies + WHERE pctabs.currency = currencies.currabrev + AND pctabs.tabcode='" . $SelectedTabs . "'"; + $ResultLimit = DB_query($SQLLimit); + $Limit = DB_fetch_array($ResultLimit); + if (($_POST['CurrentAmount']) > $Limit['tablimit']){ + $InputError = 1; + prnMsg(_('Cash NOT assigned because PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'error'); + prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'error'); + } + if ($InputError !=1 and (($_POST['CurrentAmount'] + $_POST['Amount']) > $Limit['tablimit'])) { + prnMsg(_('Cash assigned but PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'warning'); + prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'warning'); + } + if ($InputError != 1 and isset($SelectedIndex)) { + $SQL = "UPDATE pcashdetails + SET date = '" . FormatDateForSQL($_POST['Date']) . "', + amount = '" . filter_number_format($_POST['Amount']) . "', + authorized = '0000-00-00', + notes = '" . $_POST['Notes'] . "', + WHERE counterindex = '" . $SelectedIndex . "'"; + $Msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); + } elseif ($InputError != 1) { + // Add new record on submit + $SQL = "INSERT INTO pcashdetails + (counterindex, + tabcode, + date, + codeexpense, + amount, + authorized, + posted, + notes) + VALUES (NULL, + '" . $_POST['SelectedTabs'] . "', + '" . FormatDateForSQL($_POST['Date']) . "', + 'ASSIGNCASH', + '" . filter_number_format($_POST['Amount']) . "', + '0000-00-00', + '0', + '" . $_POST['Notes'] . "', + )"; + $Msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); + } + if ($InputError != 1) { + //run the SQL from either of the above possibilites + $Result = DB_query($SQL); + prnMsg($Msg, 'success'); + unset($_POST['SelectedExpense']); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); + } +} elseif (isset($_GET['delete'])) { + echo '

+ ', ' ', $Title, ' +

'; + $SQL = "DELETE FROM pcashdetails + WHERE counterindex='" . $SelectedIndex . "'"; + $ErrMsg = _('The assignment of cash record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted'), 'success'); + unset($_GET['delete']); +} +if (!isset($SelectedTabs)) { + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + echo '

+ ', ' ', $Title, ' +

'; + echo '
'; + echo ''; + $SQL = "SELECT tabcode + FROM pctabs + WHERE assigner='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; + $Result = DB_query($SQL); + echo ' + + + + '; + echo '
', _('Assign cash to petty cash tab'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} +//end of ifs and buts! +if (isset($_POST['Process']) or isset($SelectedTabs)) { + if (!isset($_POST['submit'])) { + echo '

+ ', ' ', $Title, ' +

'; + } + echo ''; + + echo '
'; + echo ' + + + '; + echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; + + if (!isset($_GET['edit']) or isset($_POST['GO'])) { + if (isset($_POST['Cancel'])) { + unset($_POST['Amount']); + unset($_POST['Date']); + unset($_POST['Notes']); + } + if (!isset($Days)) { + $Days = 30; + } + /* Retrieve decimal places to display */ + $SqlDecimalPlaces = "SELECT decimalplaces + FROM currencies,pctabs + WHERE currencies.currabrev = pctabs.currency + AND tabcode='" . $SelectedTabs . "'"; + $Result = DB_query($SqlDecimalPlaces); + $MyRow = DB_fetch_array($Result); + $CurrDecimalPlaces = $MyRow['decimalplaces']; + $SQL = "SELECT counterindex, + tabcode, + tag, + date, + codeexpense, + amount, + authorized, + posted, + notes + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "' + AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY) + ORDER BY date, + counterindex ASC"; + $Result = DB_query($SQL); + echo '
'; + echo ''; + + //Limit expenses history to X days + echo ' + + + +
', _('Detail of Tab Movements For Last'), ': + + ' . _('Days') . ' + +
'; + + echo ' + + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + + $SQLdes = "SELECT description + FROM pcexpenses + WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; + $ResultDes = DB_query($SQLdes); + $Description = DB_fetch_array($ResultDes); + if (!isset($Description[0])) { + $ExpenseCodeDes = 'ASSIGNCASH'; + } else { + $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; + } + + if ($MyRow['authorized'] == '0000-00-00') { + $AuthorisedDate = _('Unauthorised'); + } else { + $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); + } + + //Generate download link for expense receipt, or show text if no receipt file is found. + $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions + $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($SelectedTabs); //Receipts upload directory + $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. + if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found + $ReceiptText = '' . _('Download attachment') . ''; + } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { + $ReceiptText = ''; + } else { + $ReceiptText = _('No attachment'); + } + + if (($MyRow['authorized'] == '0000-00-00') and ($ExpenseCodeDes == 'ASSIGNCASH')) { + // only cash assignations NOT authorized can be modified or deleted + echo ' + + + + + + + + + '; + } else { + echo ' + + + + + + + '; + } + } + //END WHILE LIST LOOP + $SQLamount = "SELECT sum(amount) + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "'"; + $ResultAmount = DB_query($SQLamount); + $Amount = DB_fetch_array($ResultAmount); + if (!isset($Amount['0'])) { + $Amount['0'] = 0; + } + echo ' + + + '; + echo '
', _('Date'), '', _('Expense Code'), '', _('Amount'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '', _('Edit'), '' . _('Delete') . '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
+
'; + } + if (!isset($_GET['delete'])) { + if (!isset($Amount['0'])) { + $Amount['0'] = 0; + } + echo '
'; + echo ''; + if (isset($_GET['edit'])) { + /* Retrieve decimal places to display */ + $SqlDecimalPlaces = "SELECT decimalplaces + FROM currencies,pctabs + WHERE currencies.currabrev = pctabs.currency + AND tabcode='" . $SelectedTabs . "'"; + $Result = DB_query($SqlDecimalPlaces); + $MyRow = DB_fetch_array($Result); + $CurrDecimalPlaces = $MyRow['decimalplaces']; + $SQL = "SELECT counterindex, + tabcode, + tag, + date, + codeexpense, + amount, + authorized, + posted, + notes, + FROM pcashdetails + WHERE counterindex='" . $SelectedIndex . "'"; + $Result = DB_query($SQL); + $MyRow = DB_fetch_array($Result); + $_POST['Date'] = ConvertSQLDate($MyRow['date']); + $_POST['SelectedExpense'] = $MyRow['codeexpense']; + $_POST['Amount'] = $MyRow['amount']; + $_POST['Notes'] = $MyRow['notes']; + echo ''; + echo ''; + echo ''; + echo ''; + } + /* Ricard: needs revision of this date initialization */ + if (!isset($_POST['Date'])) { + $_POST['Date'] = Date($_SESSION['DefaultDateFormat']); + } + echo '
'; //Main table + if (isset($_GET['SelectedIndex'])) { + echo ' + + '; + } else { + echo ' + + '; + } + echo ' + '; + echo ' + '; + if (!isset($_POST['Amount'])) { + $_POST['Amount'] = 0; + } + echo ' + + + '; + if (!isset($_POST['Notes'])) { + $_POST['Notes'] = ''; + } + echo ' + + + '; + echo '

', _('Update Cash Assignment'), '

', _('New Cash Assignment'), '

', _('Cash Assignment Date'), ': + +
', _('Amount'), ':
', _('Notes'), ':
'; // close main table + echo ''; + echo ''; + echo ''; + echo '
+ + +
'; + echo '
'; + } // end if user wish to delete +} +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcAuthorizeCash.php b/PcAuthorizeCash.php index 356b88906..73213c10c 100644 --- a/PcAuthorizeCash.php +++ b/PcAuthorizeCash.php @@ -1,303 +1,297 @@ - - ', _('Authorisation of Assigned Cash '), ' -

'; - -if (isset($SelectedTabs)) { -echo '
'; -echo ' - - - '; -echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; -} - -if (isset($_POST['Submit']) or isset($_POST['update']) or isset($SelectedTabs) or isset($_POST['GO'])) { - echo '
'; - echo ''; - if (!isset($Days)) { - $Days = 30; - } - - //Limit expenses history to X days - echo ' - - - -
', _('Detail of Tab Movements For Last '), ': - - ', _('Days'), ' - -
'; - $SQL = "SELECT pcashdetails.counterindex, - pcashdetails.tabcode, - pcashdetails.date, - pcashdetails.codeexpense, - pcashdetails.amount, - pcashdetails.authorized, - pcashdetails.posted, - pcashdetails.notes, - pctabs.glaccountassignment, - pctabs.glaccountpcash, - pctabs.usercode, - pctabs.currency, - currencies.rate, - currencies.decimalplaces - FROM pcashdetails, pctabs, currencies - WHERE pcashdetails.tabcode = pctabs.tabcode - AND pctabs.currency = currencies.currabrev - AND pcashdetails.tabcode = '" . $SelectedTabs . "' - AND pcashdetails.date >= DATE_SUB(CURDATE(), INTERVAL '" . $Days . "' DAY) - AND pcashdetails.codeexpense='ASSIGNCASH' - ORDER BY pcashdetails.date, pcashdetails.counterindex ASC"; - $Result = DB_query($SQL); - echo ' - - - - - - - '; - $k = 0; //row colour counter - $CurrDecimalPlaces = 2; - while ($MyRow = DB_fetch_array($Result)) { - $CurrDecimalPlaces = $MyRow['decimalplaces']; - //update database if update pressed - if (isset($_POST['Submit']) and $_POST['Submit'] == _('Update') and isset($_POST[$MyRow['counterindex']])) { - $PeriodNo = GetPeriod(ConvertSQLDate($MyRow['date']), $db); - if ($MyRow['rate'] == 1) { // functional currency - $Amount = $MyRow['amount']; - } else { // other currencies - $Amount = $MyRow['amount'] / $MyRow['rate']; - } - if ($MyRow['codeexpense'] == 'ASSIGNCASH') { - $type = 2; - $AccountFrom = $MyRow['glaccountassignment']; - $AccountTo = $MyRow['glaccountpcash']; - $TagTo = 0; - } else { - $type = 1; - $Amount = -$Amount; - $AccountFrom = $MyRow['glaccountpcash']; - $SQLAccExp = "SELECT glaccount, - tag - FROM pcexpenses - WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; - $ResultAccExp = DB_query($SQLAccExp); - $MyRowAccExp = DB_fetch_array($ResultAccExp); - $AccountTo = $MyRowAccExp['glaccount']; - $TagTo = $MyRowAccExp['tag']; - } - //get typeno - $typeno = GetNextTransNo($type,$db); - //build narrative - $Narrative = _('PettyCash') . ' - ' . $MyRow['tabcode'] . ' - ' . $MyRow['codeexpense'] . ' - ' . DB_escape_string($MyRow['notes']); - //insert to gltrans - DB_Txn_Begin(); - $SQLFrom = "INSERT INTO `gltrans` (`counterindex`, - `type`, - `typeno`, - `chequeno`, - `trandate`, - `periodno`, - `account`, - `narrative`, - `amount`, - `posted`, - `jobref`, - `tag`) - VALUES (NULL, - '" . $type . "', - '" . $typeno . "', - 0, - '" . $MyRow['date'] . "', - '" . $PeriodNo . "', - '" . $AccountFrom . "', - '" . $Narrative . "', - '" . -$Amount . "', - 0, - '', - '" . $TagTo ."')"; - $ResultFrom = DB_Query($SQLFrom, '', '', true); - $SQLTo = "INSERT INTO `gltrans` (`counterindex`, - `type`, - `typeno`, - `chequeno`, - `trandate`, - `periodno`, - `account`, - `narrative`, - `amount`, - `posted`, - `jobref`, - `tag` - ) VALUES (NULL, - '" . $type . "', - '" . $typeno . "', - 0, - '" . $MyRow['date'] . "', - '" . $PeriodNo . "', - '" . $AccountTo . "', - '" . $Narrative . "', - '" . $Amount . "', - 0, - '', - '" . $TagTo ."' - )"; - $ResultTo = DB_Query($SQLTo, '', '', true); - if ($MyRow['codeexpense'] == 'ASSIGNCASH') { - // if it's a cash assignation we need to updated banktrans table as well. - $ReceiptTransNo = GetNextTransNo(2, $db); - $SQLBank = "INSERT INTO banktrans (transno, - type, - bankact, - ref, - exrate, - functionalexrate, - transdate, - banktranstype, - amount, - currcode - ) VALUES ( - '" . $ReceiptTransNo . "', - 1, - '" . $AccountFrom . "', - '" . $Narrative . "', - 1, - '" . $MyRow['rate'] . "', - '" . $MyRow['date'] . "', - 'Cash', - '" . -$MyRow['amount'] . "', - '" . $MyRow['currency'] . "' - )"; - $ErrMsg = _('Cannot insert a bank transaction because'); - $DbgMsg = _('Cannot insert a bank transaction with the SQL'); - $ResultBank = DB_query($SQLBank, $ErrMsg, $DbgMsg, true); - } - $SQL = "UPDATE pcashdetails - SET authorized = CURRENT_DATE, - posted = 1 - WHERE counterindex = '" . $MyRow['counterindex'] . "'"; - $Resultupdate = DB_query($SQL, '', '', true); - DB_Txn_Commit(); - prnMsg(_('Assigned cash has been correctly authorised'), 'success'); - unset($_POST['Submit']); - unset($SelectedTabs); - unset($_POST['SelectedTabs']); - } - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - echo ' - - - '; - if (isset($_POST[$MyRow['counterindex']])) { - echo ' - '; - } //end of looping - $SQLamount = "SELECT sum(amount) - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "' - AND codeexpense='ASSIGNCASH'"; - $ResultAmount = DB_query($SQLamount); - $Amount = DB_fetch_array($ResultAmount); - if (!isset($Amount['0'])) { - $Amount['0'] = 0; - } - echo ' - - - '; - // Do the postings - include('includes/GLPostings.inc'); - echo '
', _('Date'), '', _('Expense Code'), '', _('Amount'), '', _('Notes'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $MyRow['codeexpense'], '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '' . ConvertSQLDate(Date('Y-m-d')); - } else { - //compare against raw SQL format date, then convert for display. - if (($MyRow['authorized'] != '0000-00-00')) { - echo '', ConvertSQLDate($MyRow['authorized']); - } else { - echo ''; - } - } - echo ' -
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; - echo '
- -
-
'; -} else { - /*The option to submit was not hit so display form */ - echo '
'; - echo ''; - $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizer='" . $_SESSION['UserID'] . "'"; - $Result = DB_query($SQL); - echo ' - - - - '; - echo '
', _('Authorise cash assigned to petty cash tab'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} -/*end of else not submit */ -include('includes/footer.php'); + + ', _('Authorisation of Assigned Cash '), ' +

'; + +if (isset($SelectedTabs)) { +echo '
'; +echo ' + + + '; +echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; +} + +if (isset($_POST['Submit']) or isset($_POST['update']) or isset($SelectedTabs) or isset($_POST['GO'])) { + echo '
'; + echo ''; + if (!isset($Days)) { + $Days = 30; + } + + //Limit expenses history to X days + echo ' + + + +
', _('Detail of Tab Movements For Last '), ': + + ', _('Days'), ' + +
'; + $SQL = "SELECT pcashdetails.counterindex, + pcashdetails.tabcode, + pcashdetails.date, + pcashdetails.codeexpense, + pcashdetails.amount, + pcashdetails.authorized, + pcashdetails.posted, + pcashdetails.notes, + pctabs.glaccountassignment, + pctabs.glaccountpcash, + pctabs.usercode, + pctabs.currency, + currencies.rate, + currencies.decimalplaces + FROM pcashdetails, pctabs, currencies + WHERE pcashdetails.tabcode = pctabs.tabcode + AND pctabs.currency = currencies.currabrev + AND pcashdetails.tabcode = '" . $SelectedTabs . "' + AND pcashdetails.date >= DATE_SUB(CURDATE(), INTERVAL '" . $Days . "' DAY) + AND pcashdetails.codeexpense='ASSIGNCASH' + ORDER BY pcashdetails.date, pcashdetails.counterindex ASC"; + $Result = DB_query($SQL); + echo ' + + + + + + + '; + + $CurrDecimalPlaces = 2; + while ($MyRow = DB_fetch_array($Result)) { + $CurrDecimalPlaces = $MyRow['decimalplaces']; + //update database if update pressed + if (isset($_POST['Submit']) and $_POST['Submit'] == _('Update') and isset($_POST[$MyRow['counterindex']])) { + $PeriodNo = GetPeriod(ConvertSQLDate($MyRow['date']), $db); + if ($MyRow['rate'] == 1) { // functional currency + $Amount = $MyRow['amount']; + } else { // other currencies + $Amount = $MyRow['amount'] / $MyRow['rate']; + } + if ($MyRow['codeexpense'] == 'ASSIGNCASH') { + $type = 2; + $AccountFrom = $MyRow['glaccountassignment']; + $AccountTo = $MyRow['glaccountpcash']; + $TagTo = 0; + } else { + $type = 1; + $Amount = -$Amount; + $AccountFrom = $MyRow['glaccountpcash']; + $SQLAccExp = "SELECT glaccount, + tag + FROM pcexpenses + WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; + $ResultAccExp = DB_query($SQLAccExp); + $MyRowAccExp = DB_fetch_array($ResultAccExp); + $AccountTo = $MyRowAccExp['glaccount']; + $TagTo = $MyRowAccExp['tag']; + } + //get typeno + $typeno = GetNextTransNo($type,$db); + //build narrative + $Narrative = _('PettyCash') . ' - ' . $MyRow['tabcode'] . ' - ' . $MyRow['codeexpense'] . ' - ' . DB_escape_string($MyRow['notes']); + //insert to gltrans + DB_Txn_Begin(); + $SQLFrom = "INSERT INTO `gltrans` (`counterindex`, + `type`, + `typeno`, + `chequeno`, + `trandate`, + `periodno`, + `account`, + `narrative`, + `amount`, + `posted`, + `jobref`, + `tag`) + VALUES (NULL, + '" . $type . "', + '" . $typeno . "', + 0, + '" . $MyRow['date'] . "', + '" . $PeriodNo . "', + '" . $AccountFrom . "', + '" . $Narrative . "', + '" . -$Amount . "', + 0, + '', + '" . $TagTo ."')"; + $ResultFrom = DB_Query($SQLFrom, '', '', true); + $SQLTo = "INSERT INTO `gltrans` (`counterindex`, + `type`, + `typeno`, + `chequeno`, + `trandate`, + `periodno`, + `account`, + `narrative`, + `amount`, + `posted`, + `jobref`, + `tag` + ) VALUES (NULL, + '" . $type . "', + '" . $typeno . "', + 0, + '" . $MyRow['date'] . "', + '" . $PeriodNo . "', + '" . $AccountTo . "', + '" . $Narrative . "', + '" . $Amount . "', + 0, + '', + '" . $TagTo ."' + )"; + $ResultTo = DB_Query($SQLTo, '', '', true); + if ($MyRow['codeexpense'] == 'ASSIGNCASH') { + // if it's a cash assignation we need to updated banktrans table as well. + $ReceiptTransNo = GetNextTransNo(2, $db); + $SQLBank = "INSERT INTO banktrans (transno, + type, + bankact, + ref, + exrate, + functionalexrate, + transdate, + banktranstype, + amount, + currcode + ) VALUES ( + '" . $ReceiptTransNo . "', + 1, + '" . $AccountFrom . "', + '" . $Narrative . "', + 1, + '" . $MyRow['rate'] . "', + '" . $MyRow['date'] . "', + 'Cash', + '" . -$MyRow['amount'] . "', + '" . $MyRow['currency'] . "' + )"; + $ErrMsg = _('Cannot insert a bank transaction because'); + $DbgMsg = _('Cannot insert a bank transaction with the SQL'); + $ResultBank = DB_query($SQLBank, $ErrMsg, $DbgMsg, true); + } + $SQL = "UPDATE pcashdetails + SET authorized = CURRENT_DATE, + posted = 1 + WHERE counterindex = '" . $MyRow['counterindex'] . "'"; + $Resultupdate = DB_query($SQL, '', '', true); + DB_Txn_Commit(); + prnMsg(_('Assigned cash has been correctly authorised'), 'success'); + unset($_POST['Submit']); + unset($SelectedTabs); + unset($_POST['SelectedTabs']); + } + + echo ' + + + + '; + if (isset($_POST[$MyRow['counterindex']])) { + echo ' + '; + } //end of looping + $SQLamount = "SELECT sum(amount) + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "' + AND codeexpense='ASSIGNCASH'"; + $ResultAmount = DB_query($SQLamount); + $Amount = DB_fetch_array($ResultAmount); + if (!isset($Amount['0'])) { + $Amount['0'] = 0; + } + echo ' + + + '; + // Do the postings + include('includes/GLPostings.inc'); + echo '
', _('Date'), '', _('Expense Code'), '', _('Amount'), '', _('Notes'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $MyRow['codeexpense'], '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $MyRow['notes'], '' . ConvertSQLDate(Date('Y-m-d')); + } else { + //compare against raw SQL format date, then convert for display. + if (($MyRow['authorized'] != '0000-00-00')) { + echo '', ConvertSQLDate($MyRow['authorized']); + } else { + echo ''; + } + } + echo ' +
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; + echo '
+ +
+
'; +} else { + /*The option to submit was not hit so display form */ + echo '
'; + echo ''; + $SQL = "SELECT tabcode + FROM pctabs + WHERE authorizer='" . $_SESSION['UserID'] . "'"; + $Result = DB_query($SQL); + echo ' + + + + '; + echo '
', _('Authorise cash assigned to petty cash tab'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} +/*end of else not submit */ +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcAuthorizeExpenses.php b/PcAuthorizeExpenses.php index 1528abe1f..786906f19 100644 --- a/PcAuthorizeExpenses.php +++ b/PcAuthorizeExpenses.php @@ -1,406 +1,400 @@ - - ', _('Authorisation of Petty Cash Expenses'), ' -

'; - - -if (isset($SelectedTabs)) { - echo '
'; - echo ' - - - '; - echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; -} -if (isset($_POST['Submit']) or isset($_POST['update']) or isset($SelectedTabs) or isset($_POST['GO'])) { - echo '
'; - echo ''; - if (!isset($Days)) { - $Days = 30; - } - - //Limit expenses history to X days - echo ' - - - -
', _('Detail of Tab Movements For Last '), ': - - ', _('Days'), ' - -
'; - $SQL = "SELECT pcashdetails.counterindex, - pcashdetails.tabcode, - pcashdetails.tag, - pcashdetails.date, - pcashdetails.codeexpense, - pcashdetails.amount, - pcashdetails.authorized, - pcashdetails.posted, - pcashdetails.notes, - pctabs.glaccountassignment, - pctabs.glaccountpcash, - pctabs.usercode, - pctabs.currency, - currencies.rate, - currencies.decimalplaces - FROM pcashdetails, pctabs, currencies - WHERE pcashdetails.tabcode = pctabs.tabcode - AND pctabs.currency = currencies.currabrev - AND pcashdetails.tabcode = '" . $SelectedTabs . "' - AND pcashdetails.date >= DATE_SUB(CURDATE(), INTERVAL '" . $Days . "' DAY) - AND pcashdetails.codeexpense<>'ASSIGNCASH' - ORDER BY pcashdetails.date, pcashdetails.counterindex ASC"; - $Result = DB_query($SQL); - echo ' - - - - - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - $CurrDecimalPlaces = $MyRow['decimalplaces']; - //update database if update pressed - $PeriodNo = GetPeriod(ConvertSQLDate($MyRow['date']), $db); - $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; - $TagResult = DB_query($TagSQL); - $TagRow = DB_fetch_array($TagResult); - if ($MyRow['tag'] == 0) { - $TagRow['tagdescription'] = _('None'); - } - $TaxTotalSQL = "SELECT SUM(amount) as totaltax FROM pcashdetailtaxes WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; - $TaxTotalResult = DB_query($TaxTotalSQL); - $TaxTotalRow = DB_fetch_array($TaxTotalResult); - if ($MyRow['rate'] == 1) { // functional currency - $GrossAmount = $MyRow['amount']; - $NetAmount = $MyRow['amount'] - $TaxTotalRow['totaltax']; - } else { // other currencies - $GrossAmount = ($MyRow['amount']) / $MyRow['rate']; - $NetAmount = ($MyRow['amount'] - $TaxTotalRow['totaltax']) / $MyRow['rate']; - } - if ($MyRow['codeexpense'] == 'ASSIGNCASH') { - $Type = 2; - $AccountFrom = $MyRow['glaccountassignment']; - $AccountTo = $MyRow['glaccountpcash']; - $TagTo = 0; - $TagDescription = '0 - ' . _('None'); - } else { - $Type = 1; - $NetAmount = -$NetAmount; - $AccountFrom = $MyRow['glaccountpcash']; - $SQLAccExp = "SELECT glaccount, - tag - FROM pcexpenses - WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; - $ResultAccExp = DB_query($SQLAccExp); - $MyRowAccExp = DB_fetch_array($ResultAccExp); - $AccountTo = $MyRowAccExp['glaccount']; - $TagTo = $MyRow['tag']; - $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; - } - if (isset($_POST['Submit']) and $_POST['Submit'] == _('Update') and isset($_POST[$MyRow['counterindex']])) { - //get typeno - $TypeNo = GetNextTransNo($Type,$db); - //build narrative - $Narrative = _('PettyCash') . ' - ' . $MyRow['tabcode'] . ' - ' . $MyRow['codeexpense'] . ' - ' . DB_escape_string($MyRow['notes']); - //insert to gltrans - DB_Txn_Begin(); - $SQLFrom = "INSERT INTO `gltrans` (`counterindex`, - `type`, - `typeno`, - `chequeno`, - `trandate`, - `periodno`, - `account`, - `narrative`, - `amount`, - `posted`, - `jobref`, - `tag`) - VALUES (NULL, - '" . $Type . "', - '" . $TypeNo . "', - 0, - '" . $MyRow['date'] . "', - '" . $PeriodNo . "', - '" . $AccountFrom . "', - '" . $Narrative . "', - '" . $GrossAmount . "', - 0, - '', - '" . $TagTo ."')"; - $ResultFrom = DB_Query($SQLFrom, '', '', true); - $SQLTo = "INSERT INTO `gltrans` (`counterindex`, - `type`, - `typeno`, - `chequeno`, - `trandate`, - `periodno`, - `account`, - `narrative`, - `amount`, - `posted`, - `jobref`, - `tag`) - VALUES (NULL, - '" . $Type . "', - '" . $TypeNo . "', - 0, - '" . $MyRow['date'] . "', - '" . $PeriodNo . "', - '" . $AccountTo . "', - '" . $Narrative . "', - '" . $NetAmount . "', - 0, - '', - '" . $TagTo ."')"; - $ResultTo = DB_Query($SQLTo, '', '', true); - $TaxSQL = "SELECT counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - FROM pcashdetailtaxes - WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; - $TaxResult = DB_query($TaxSQL); - while ($MyTaxRow = DB_fetch_array($TaxResult)) { - $SQLTo = "INSERT INTO `gltrans` (`counterindex`, - `type`, - `typeno`, - `chequeno`, - `trandate`, - `periodno`, - `account`, - `narrative`, - `amount`, - `posted`, - `jobref`, - `tag`) - VALUES (NULL, - '" . $Type . "', - '" . $TypeNo . "', - 0, - '" . $MyRow['date'] . "', - '" . $PeriodNo . "', - '" . $MyTaxRow['purchtaxglaccount'] . "', - '" . $Narrative . "', - '" . -$MyTaxRow['amount'] . "', - 0, - '', - '" . $TagTo ."')"; - $ResultTax = DB_Query($SQLTo, '', '', true); - } - if ($MyRow['codeexpense'] == 'ASSIGNCASH') { - // if it's a cash assignation we need to updated banktrans table as well. - $ReceiptTransNo = GetNextTransNo(2); - $SQLBank = "INSERT INTO banktrans (transno, - type, - bankact, - ref, - exrate, - functionalexrate, - transdate, - banktranstype, - amount, - currcode - ) VALUES ( - '" . $ReceiptTransNo . "', - 2, - '" . $AccountFrom . "', - '" . $Narrative . "', - 1, - '" . $MyRow['rate'] . "', - '" . $MyRow['date'] . "', - 'Cash', - '" . -($MyRow['amount'] / $MyRow['rate']) . "', - '" . $MyRow['currency'] . "' - )"; - $ErrMsg = _('Cannot insert a bank transaction because'); - $DbgMsg = _('Cannot insert a bank transaction with the SQL'); - $ResultBank = DB_query($SQLBank, $ErrMsg, $DbgMsg, true); - } - $SQL = "UPDATE pcashdetails - SET authorized = CURRENT_DATE, - posted = 1 - WHERE counterindex = '" . $MyRow['counterindex'] . "'"; - $Resultupdate = DB_query($SQL, '', '', true); - DB_Txn_Commit(); - prnMsg(_('Expenses have been correctly authorised'), 'success'); - unset($_POST['Submit']); - unset($SelectedTabs); - unset($_POST['SelectedTabs']); - } - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - $SQLDes = "SELECT description - FROM pcexpenses - WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; - $ResultDes = DB_query($SQLDes); - $Description = DB_fetch_array($ResultDes); - if (!isset($Description[0])) { - $ExpenseCodeDes = 'ASSIGNCASH'; - } else { - $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; - } - - $TaxesDescription = ''; - $TaxesTaxAmount = ''; - $TaxSQL = "SELECT counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - FROM pcashdetailtaxes - WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; - $TaxResult = DB_query($TaxSQL); - while ($MyTaxRow = DB_fetch_array($TaxResult)) { - $TaxesDescription .= $MyTaxRow['description'] . '
'; - $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces) . '
'; - } - - //Generate download link for expense receipt, or show text if no receipt file is found. - $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions - $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($SelectedTabs); //Receipts upload directory - $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. - if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found - $ReceiptText = '' . _('Download attachment') . ''; - } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { - $ReceiptText = ''; - } else { - $ReceiptText = _('No attachment'); - } - - echo ' - - - - - - - '; - if (isset($_POST[$MyRow['counterindex']])) { - echo ' - '; - } //end of looping - $SQLamount = "SELECT sum(amount) - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "' - AND codeexpense<>'ASSIGNCASH'"; - $ResultAmount = DB_query($SQLamount); - $Amount = DB_fetch_array($ResultAmount); - if (!isset($Amount['0'])) { - $Amount['0'] = 0; - } - echo ' - - - '; - // Do the postings - include('includes/GLPostings.inc'); - echo '
', _('Date of Expense'), '', _('Expense Code'), '', _('Gross Amount'), '', _('Tax'), '', _('Tax Group'), '', _('Tag'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '' . ConvertSQLDate(Date('Y-m-d')); - } else { - //compare against raw SQL format date, then convert for display. - if (($MyRow['authorized'] != '0000-00-00')) { - echo '', ConvertSQLDate($MyRow['authorized']); - } else { - echo ''; - } - } - echo ' -
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; - echo '
- -
-
'; -} else { - /*The option to submit was not hit so display form */ - echo '
'; - echo ''; - echo ''; //Main table - $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizerexpenses='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; - $Result = DB_query($SQL); - echo ' - - - '; - echo '
', _('Authorise expenses on petty cash tab'), ': -
'; // close main table - DB_free_result($Result); - echo '
- - -
'; - echo '
'; -} -/*end of else not submit */ -include('includes/footer.php'); + + ', _('Authorisation of Petty Cash Expenses'), ' +

'; + + +if (isset($SelectedTabs)) { + echo '
'; + echo ' + + + '; + echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; +} +if (isset($_POST['Submit']) or isset($_POST['update']) or isset($SelectedTabs) or isset($_POST['GO'])) { + echo '
'; + echo ''; + if (!isset($Days)) { + $Days = 30; + } + + //Limit expenses history to X days + echo ' + + + +
', _('Detail of Tab Movements For Last '), ': + + ', _('Days'), ' + +
'; + $SQL = "SELECT pcashdetails.counterindex, + pcashdetails.tabcode, + pcashdetails.tag, + pcashdetails.date, + pcashdetails.codeexpense, + pcashdetails.amount, + pcashdetails.authorized, + pcashdetails.posted, + pcashdetails.notes, + pctabs.glaccountassignment, + pctabs.glaccountpcash, + pctabs.usercode, + pctabs.currency, + currencies.rate, + currencies.decimalplaces + FROM pcashdetails, pctabs, currencies + WHERE pcashdetails.tabcode = pctabs.tabcode + AND pctabs.currency = currencies.currabrev + AND pcashdetails.tabcode = '" . $SelectedTabs . "' + AND pcashdetails.date >= DATE_SUB(CURDATE(), INTERVAL '" . $Days . "' DAY) + AND pcashdetails.codeexpense<>'ASSIGNCASH' + ORDER BY pcashdetails.date, pcashdetails.counterindex ASC"; + $Result = DB_query($SQL); + echo ' + + + + + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + $CurrDecimalPlaces = $MyRow['decimalplaces']; + //update database if update pressed + $PeriodNo = GetPeriod(ConvertSQLDate($MyRow['date']), $db); + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; + $TagResult = DB_query($TagSQL); + $TagRow = DB_fetch_array($TagResult); + if ($MyRow['tag'] == 0) { + $TagRow['tagdescription'] = _('None'); + } + $TaxTotalSQL = "SELECT SUM(amount) as totaltax FROM pcashdetailtaxes WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; + $TaxTotalResult = DB_query($TaxTotalSQL); + $TaxTotalRow = DB_fetch_array($TaxTotalResult); + if ($MyRow['rate'] == 1) { // functional currency + $GrossAmount = $MyRow['amount']; + $NetAmount = $MyRow['amount'] - $TaxTotalRow['totaltax']; + } else { // other currencies + $GrossAmount = ($MyRow['amount']) / $MyRow['rate']; + $NetAmount = ($MyRow['amount'] - $TaxTotalRow['totaltax']) / $MyRow['rate']; + } + if ($MyRow['codeexpense'] == 'ASSIGNCASH') { + $Type = 2; + $AccountFrom = $MyRow['glaccountassignment']; + $AccountTo = $MyRow['glaccountpcash']; + $TagTo = 0; + $TagDescription = '0 - ' . _('None'); + } else { + $Type = 1; + $NetAmount = -$NetAmount; + $AccountFrom = $MyRow['glaccountpcash']; + $SQLAccExp = "SELECT glaccount, + tag + FROM pcexpenses + WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; + $ResultAccExp = DB_query($SQLAccExp); + $MyRowAccExp = DB_fetch_array($ResultAccExp); + $AccountTo = $MyRowAccExp['glaccount']; + $TagTo = $MyRow['tag']; + $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; + } + if (isset($_POST['Submit']) and $_POST['Submit'] == _('Update') and isset($_POST[$MyRow['counterindex']])) { + //get typeno + $TypeNo = GetNextTransNo($Type,$db); + //build narrative + $Narrative = _('PettyCash') . ' - ' . $MyRow['tabcode'] . ' - ' . $MyRow['codeexpense'] . ' - ' . DB_escape_string($MyRow['notes']); + //insert to gltrans + DB_Txn_Begin(); + $SQLFrom = "INSERT INTO `gltrans` (`counterindex`, + `type`, + `typeno`, + `chequeno`, + `trandate`, + `periodno`, + `account`, + `narrative`, + `amount`, + `posted`, + `jobref`, + `tag`) + VALUES (NULL, + '" . $Type . "', + '" . $TypeNo . "', + 0, + '" . $MyRow['date'] . "', + '" . $PeriodNo . "', + '" . $AccountFrom . "', + '" . $Narrative . "', + '" . $GrossAmount . "', + 0, + '', + '" . $TagTo ."')"; + $ResultFrom = DB_Query($SQLFrom, '', '', true); + $SQLTo = "INSERT INTO `gltrans` (`counterindex`, + `type`, + `typeno`, + `chequeno`, + `trandate`, + `periodno`, + `account`, + `narrative`, + `amount`, + `posted`, + `jobref`, + `tag`) + VALUES (NULL, + '" . $Type . "', + '" . $TypeNo . "', + 0, + '" . $MyRow['date'] . "', + '" . $PeriodNo . "', + '" . $AccountTo . "', + '" . $Narrative . "', + '" . $NetAmount . "', + 0, + '', + '" . $TagTo ."')"; + $ResultTo = DB_Query($SQLTo, '', '', true); + $TaxSQL = "SELECT counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + FROM pcashdetailtaxes + WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; + $TaxResult = DB_query($TaxSQL); + while ($MyTaxRow = DB_fetch_array($TaxResult)) { + $SQLTo = "INSERT INTO `gltrans` (`counterindex`, + `type`, + `typeno`, + `chequeno`, + `trandate`, + `periodno`, + `account`, + `narrative`, + `amount`, + `posted`, + `jobref`, + `tag`) + VALUES (NULL, + '" . $Type . "', + '" . $TypeNo . "', + 0, + '" . $MyRow['date'] . "', + '" . $PeriodNo . "', + '" . $MyTaxRow['purchtaxglaccount'] . "', + '" . $Narrative . "', + '" . -$MyTaxRow['amount'] . "', + 0, + '', + '" . $TagTo ."')"; + $ResultTax = DB_Query($SQLTo, '', '', true); + } + if ($MyRow['codeexpense'] == 'ASSIGNCASH') { + // if it's a cash assignation we need to updated banktrans table as well. + $ReceiptTransNo = GetNextTransNo(2); + $SQLBank = "INSERT INTO banktrans (transno, + type, + bankact, + ref, + exrate, + functionalexrate, + transdate, + banktranstype, + amount, + currcode + ) VALUES ( + '" . $ReceiptTransNo . "', + 2, + '" . $AccountFrom . "', + '" . $Narrative . "', + 1, + '" . $MyRow['rate'] . "', + '" . $MyRow['date'] . "', + 'Cash', + '" . -($MyRow['amount'] / $MyRow['rate']) . "', + '" . $MyRow['currency'] . "' + )"; + $ErrMsg = _('Cannot insert a bank transaction because'); + $DbgMsg = _('Cannot insert a bank transaction with the SQL'); + $ResultBank = DB_query($SQLBank, $ErrMsg, $DbgMsg, true); + } + $SQL = "UPDATE pcashdetails + SET authorized = CURRENT_DATE, + posted = 1 + WHERE counterindex = '" . $MyRow['counterindex'] . "'"; + $Resultupdate = DB_query($SQL, '', '', true); + DB_Txn_Commit(); + prnMsg(_('Expenses have been correctly authorised'), 'success'); + unset($_POST['Submit']); + unset($SelectedTabs); + unset($_POST['SelectedTabs']); + } + + $SQLDes = "SELECT description + FROM pcexpenses + WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; + $ResultDes = DB_query($SQLDes); + $Description = DB_fetch_array($ResultDes); + if (!isset($Description[0])) { + $ExpenseCodeDes = 'ASSIGNCASH'; + } else { + $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; + } + + $TaxesDescription = ''; + $TaxesTaxAmount = ''; + $TaxSQL = "SELECT counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + FROM pcashdetailtaxes + WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; + $TaxResult = DB_query($TaxSQL); + while ($MyTaxRow = DB_fetch_array($TaxResult)) { + $TaxesDescription .= $MyTaxRow['description'] . '
'; + $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces) . '
'; + } + + //Generate download link for expense receipt, or show text if no receipt file is found. + $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions + $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($SelectedTabs); //Receipts upload directory + $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. + if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found + $ReceiptText = '' . _('Download attachment') . ''; + } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { + $ReceiptText = ''; + } else { + $ReceiptText = _('No attachment'); + } + + echo ' + + + + + + + + '; + if (isset($_POST[$MyRow['counterindex']])) { + echo ' + '; + } //end of looping + $SQLamount = "SELECT sum(amount) + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "' + AND codeexpense<>'ASSIGNCASH'"; + $ResultAmount = DB_query($SQLamount); + $Amount = DB_fetch_array($ResultAmount); + if (!isset($Amount['0'])) { + $Amount['0'] = 0; + } + echo ' + + + '; + // Do the postings + include('includes/GLPostings.inc'); + echo '
', _('Date of Expense'), '', _('Expense Code'), '', _('Gross Amount'), '', _('Tax'), '', _('Tax Group'), '', _('Tag'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '' . ConvertSQLDate(Date('Y-m-d')); + } else { + //compare against raw SQL format date, then convert for display. + if (($MyRow['authorized'] != '0000-00-00')) { + echo '', ConvertSQLDate($MyRow['authorized']); + } else { + echo ''; + } + } + echo ' +
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; + echo '
+ +
+
'; +} else { + /*The option to submit was not hit so display form */ + echo '
'; + echo ''; + echo ''; //Main table + $SQL = "SELECT tabcode + FROM pctabs + WHERE authorizerexpenses='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; + $Result = DB_query($SQL); + echo ' + + + '; + echo '
', _('Authorise expenses on petty cash tab'), ': +
'; // close main table + DB_free_result($Result); + echo '
+ + +
'; + echo '
'; +} +/*end of else not submit */ +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcClaimExpensesFromTab.php b/PcClaimExpensesFromTab.php index 47eee7de7..957c9e51e 100644 --- a/PcClaimExpensesFromTab.php +++ b/PcClaimExpensesFromTab.php @@ -1,692 +1,687 @@ - $Value) { - if (substr($Index, 0, 5) == 'index') { - $Index = $Value; - $SQL = "UPDATE pcashdetailtaxes SET pccashdetail='" . $_POST['PcCashDetail' . $Index] . "', - calculationorder='" . $_POST['CalculationOrder' . $Index] . "', - description='" . $_POST['Description' . $Index] . "', - taxauthid='" . $_POST['TaxAuthority' . $Index] . "', - purchtaxglaccount='" . $_POST['TaxGLAccount' . $Index] . "', - taxontax='" . $_POST['TaxOnTax' . $Index] . "', - taxrate='" . $_POST['TaxRate' . $Index] . "', - amount='" . -$_POST['TaxAmount' . $Index] . "' - WHERE counterindex='" . $Index ."'"; - $Result = DB_query($SQL); - } - } - if (isset($_FILES['Receipt']) and $_FILES['Receipt']['name'] != '') { - $UploadOriginalName = $_FILES['Receipt']['name']; - $UploadTempName = $_FILES['Receipt']['tmp_name']; - $UploadSize = $_FILES['Receipt']['size']; - $UploadType = $_FILES['Receipt']['type']; - $UploadError = $_FILES['Receipt']['error']; - $UploadTheFile = 'Yes'; //Assume all is well to start off with, but check for the worst - $ReceiptSupportedMime = array('image/png','image/jpeg','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); //list of support mime types, corresponding to the list of support file extensions in $ReceiptSupportedExt - if ($UploadSize > ($_SESSION['MaxImageSize'] * 1024)) { //Server-side file size check. This will usually be caught by $UploadError == 2 (MAX_FILE_SIZE), but we must not trust the user. - prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); - $UploadTheFile = 'No'; - } elseif (!in_array($UploadType, $ReceiptSupportedMime) and $UploadError != 2) { //File type check. If $UploadError == 2, then $UploadType will be empty. - prnMsg(_('File type not accepted. Only the following file types can be attached') . ': ' . implode(', ', $ReceiptSupportedExt), 'warn'); - $UploadTheFile = 'No'; - } elseif ($UploadError == 1 ) { //upload_max_filesize error check - prnMsg(_('The uploaded file exceeds the upload_max_filesize directive in php.ini. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 2 ) { //Client-side file size error check (MAX_FILE_SIZE) - prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 3 ) { //Partial upload error check - prnMsg( _('The uploaded file was only partially uploaded. Please try again.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 4 ) { //No file uploaded error check - prnMsg( _('No file was uploaded'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 5 ) { //Undefined error check - prnMsg( _('Undefined error'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 6 ) { //Temp directory error check - prnMsg( _('A necessary temporary folder is missing. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 7 ) { //Disk write failure error check - prnMsg( _('Cannot write file to disk. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 8 ) { //Upload stopped by PHP extension error check - prnMsg( _('The file upload was stopped by a PHP extension. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } - if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist - mkdir($ReceiptFileDir, 0775, true); - } - $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file - $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number - $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; - $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. - unlink($ReceiptExistingFile); - } - move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. - } - } - prnMsg($Msg, 'success'); - } elseif ($InputError != 1) { - // First check the type is not being duplicated - // Add new record on submit - $SQL = "INSERT INTO pcashdetails (counterindex, - tabcode, - tag, - date, - codeexpense, - amount, - authorized, - posted, - notes) - VALUES (NULL, - '" . $_POST['SelectedTabs'] . "', - '" . $_POST['Tag'] . "', - '" . FormatDateForSQL($_POST['Date']) . "', - '" . $_POST['SelectedExpense'] . "', - '" . -filter_number_format($_POST['Amount']) . "', - 0, - 0, - '" . $_POST['Notes'] . "' - )"; - $Msg = _('The expense claim on tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); - $Result = DB_query($SQL); - $SelectedIndex = DB_Last_Insert_ID('pcashdetails', 'counterindex'); - foreach ($_POST as $Index => $Value) { - if (substr($Index, 0, 5) == 'index') { - $Index = $Value; - $SQL = "INSERT INTO pcashdetailtaxes (counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - ) VALUES ( - NULL, - '" . $SelectedIndex . "', - '" . $_POST['CalculationOrder' . $Index] . "', - '" . $_POST['Description' . $Index] . "', - '" . $_POST['TaxAuthority' . $Index] . "', - '" . $_POST['TaxGLAccount' . $Index] . "', - '" . $_POST['TaxOnTax' . $Index] . "', - '" . $_POST['TaxRate' . $Index] . "', - '" . -$_POST['TaxAmount' . $Index] . "' - )"; - $Result = DB_query($SQL); - } - } - if (isset($_FILES['Receipt']) and $_FILES['Receipt']['name'] != '') { - $UploadOriginalName = $_FILES['Receipt']['name']; - $UploadTempName = $_FILES['Receipt']['tmp_name']; - $UploadSize = $_FILES['Receipt']['size']; - $UploadType = $_FILES['Receipt']['type']; - $UploadError = $_FILES['Receipt']['error']; - $UploadTheFile = 'Yes'; //Assume all is well to start off with, but check for the worst - $ReceiptSupportedMime = array('image/png','image/jpeg','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); //list of support mime types, corresponding to the list of support file extensions in $ReceiptSupportedExt - if ($UploadSize > ($_SESSION['MaxImageSize'] * 1024)) { //Server-side file size check. This will usually be caught by $UploadError == 2 (MAX_FILE_SIZE), but we must not trust the user. - prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); - $UploadTheFile = 'No'; - } elseif (!in_array($UploadType, $ReceiptSupportedMime) and $UploadError != 2) { //File type check. If $UploadError == 2, then $UploadType will be empty. - prnMsg(_('File type not accepted. Only the following file types can be attached') . ': ' . implode(', ', $ReceiptSupportedExt), 'warn'); - $UploadTheFile = 'No'; - } elseif ($UploadError == 1 ) { //upload_max_filesize error check - prnMsg(_('The uploaded file exceeds the upload_max_filesize directive in php.ini. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 2 ) { //Client-side file size error check (MAX_FILE_SIZE) - prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 3 ) { //Partial upload error check - prnMsg( _('The uploaded file was only partially uploaded. Please try again.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 4 ) { //No file uploaded error check - prnMsg( _('No file was uploaded'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 5 ) { //Undefined error check - prnMsg( _('Undefined error'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 6 ) { //Temp directory error check - prnMsg( _('A necessary temporary folder is missing. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 7 ) { //Disk write failure error check - prnMsg( _('Cannot write file to disk. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } elseif ($UploadError == 8 ) { //Upload stopped by PHP extension error check - prnMsg( _('The file upload was stopped by a PHP extension. Please contact your system administrator.'), 'warn'); - $UploadTheFile ='No'; - } - if ($UploadTheFile == 'Yes') { //Passed all the above validation - if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist - mkdir($ReceiptFileDir, 0775, true); - } - $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file - $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number - $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; - $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. - unlink($ReceiptExistingFile); - } - move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. - } - } - prnMsg($Msg, 'success'); - } - if ($InputError != 1) { - unset($_POST['SelectedExpense']); - unset($_POST['Amount']); - unset($_POST['Tag']); - unset($_POST['Date']); - unset($_POST['Notes']); - unset($_FILES['Receipt']); - } -} elseif (isset($_GET['delete'])) { - $SQL = "DELETE FROM pcashdetails, pcashdetailtaxes - USING pcashdetails - INNER JOIN pcashdetailtaxes - ON pcashdetails.counterindex = pcashdetailtaxes.pccashdetail - WHERE pcashdetails.counterindex = '" . $SelectedIndex . "'"; - $ErrMsg = _('Petty Cash Expense record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('Petty Cash expense record') . ' ' . $SelectedTabs . ' ' . _('has been deleted'), 'success'); - //Delete receipt attachments. There should be only one per expenses, but check for all possible file extensions anyway. - $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory - foreach($ReceiptExistingFiles as $ReceiptExistingFile) { - unlink($ReceiptExistingFile); - } - unset($_GET['delete']); -} //end of get delete -if (!isset($SelectedTabs)) { - /* It could still be the first time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - echo '

- ', ' ', $Title, ' -

'; - echo '
'; - echo ''; - echo ' - - - - '; - echo '
', _('Clain expenses on petty cash tab'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} else { // isset($SelectedTabs) - echo ''; - echo '

- ', ' ', $Title, ' -

'; - if (!isset($_GET['edit']) or isset($_POST['GO'])) { - if (!isset($Days)) { - $Days = 30; - } - /* Retrieve decimal places to display */ - $SQLDecimalPlaces = "SELECT decimalplaces - FROM currencies,pctabs - WHERE currencies.currabrev = pctabs.currency - AND tabcode='" . $SelectedTabs . "'"; - $Result = DB_query($SQLDecimalPlaces); - $MyRow = DB_fetch_array($Result); - $CurrDecimalPlaces = $MyRow['decimalplaces']; - echo '
'; - echo ''; - echo '
'; - echo ' - - - '; - echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; - - //Limit expenses history to X days - echo ' - - - -
', _('Detail of Tab Movements For Last '), ': - - ', _('Days'), ' - -
'; - if (isset($_POST['Cancel'])) { - unset($_POST['SelectedExpense']); - unset($_POST['Amount']); - unset($_POST['Date']); - unset($_POST['Notes']); - unset($_FILES['Receipt']); - } - $SQL = "SELECT counterindex, - tabcode, - tag, - date, - codeexpense, - amount, - authorized, - posted, - notes - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY) - ORDER BY date, - counterindex ASC"; - $Result = DB_query($SQL); - echo ' - - - - - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $SQLDes = "SELECT description - FROM pcexpenses - WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; - $ResultDes = DB_query($SQLDes); - $Description = DB_fetch_array($ResultDes); - - if (!isset($Description[0])) { - $ExpenseCodeDes = 'ASSIGNCASH'; - } else { - $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; - } - - if ($MyRow['authorized'] == '0000-00-00') { - $AuthorisedDate = _('Unauthorised'); - } else { - $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); - } - - //Generate download link for expense receipt, or show text if no receipt file is found. - $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. - if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found - $ReceiptText = '' . _('Download attachment') . ''; - } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { - $ReceiptText = ''; - } else { - $ReceiptText = _('No attachment'); - } - - $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; - $TagResult = DB_query($TagSQL); - $TagRow = DB_fetch_array($TagResult); - if ($MyRow['tag'] == 0) { - $TagRow['tagdescription'] = _('None'); - } - $TagTo = $MyRow['tag']; - if ($ExpenseCodeDes == 'ASSIGNCASH') { - $TagDescription = ''; - } else { - $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; - } - - $TaxesDescription = ''; - $TaxesTaxAmount = ''; - $TaxSQL = "SELECT counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - FROM pcashdetailtaxes - WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; - $TaxResult = DB_query($TaxSQL); - while ($MyTaxRow = DB_fetch_array($TaxResult)) { - $TaxesDescription .= $MyTaxRow['description'] . '
'; - $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces) . '
'; - } - if (($MyRow['authorized'] == '0000-00-00') and ($ExpenseCodeDes != 'ASSIGNCASH')) { - // only movements NOT authorised can be modified or deleted - echo ' - - - - - - - - - - - '; - } else { - echo ' - - - - - - - - - '; - } - } - //END WHILE LIST LOOP - $SQLAmount = "SELECT sum(amount) - FROM pcashdetails - WHERE tabcode='" . $SelectedTabs . "'"; - $ResultAmount = DB_query($SQLAmount); - $Amount = DB_fetch_array($ResultAmount); - if (!isset($Amount['0'])) { - $Amount['0'] = 0; - } - echo ' - - - '; - echo '
', _('Date of Expense'), '', _('Expense Code'), '', _('Gross Amount'), '', _('Tax'), '', _('Tax Group'), '', _('Tag'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '' . _('Edit') . '' . _('Delete') . '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; - echo '
'; - } - if (!isset($_GET['delete'])) { - echo '
'; - echo ''; - if (isset($_GET['edit'])) { - $SQL = "SELECT counterindex, - tabcode, - tag, - date, - codeexpense, - amount, - authorized, - posted, - notes - FROM pcashdetails - WHERE counterindex='" . $SelectedIndex . "'"; - $Result = DB_query($SQL); - $MyRow = DB_fetch_array($Result); - $_POST['Date'] = ConvertSQLDate($MyRow['date']); - $_POST['SelectedExpense'] = $MyRow['codeexpense']; - $_POST['Amount'] = -$MyRow['amount']; - $_POST['Notes'] = $MyRow['notes']; - $_POST['Tag'] = $MyRow['tag']; - echo ''; - echo ''; - echo ''; - } //end of Get Edit - if (!isset($_POST['Date'])) { - $_POST['Date'] = Date($_SESSION['DefaultDateFormat']); - } - echo ''; - if (isset($_GET['SelectedIndex'])) { - echo ' - - '; - } else { - echo ' - - '; - } - echo ' - - - - - - - '; - if (!isset($_POST['Amount'])) { - $_POST['Amount'] = 0; - } - echo ' - - - '; - if (isset($_GET['edit'])) { - $SQL = "SELECT counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - FROM pcashdetailtaxes - WHERE pccashdetail='" . $SelectedIndex . "'"; - $TaxesResult = DB_query($SQL); - while ($MyTaxRow = DB_fetch_array($TaxesResult)) { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ' - - - '; - } - } else { - $SQL = "SELECT taxgrouptaxes.calculationorder, - taxauthorities.description, - taxgrouptaxes.taxauthid, - taxauthorities.purchtaxglaccount, - taxgrouptaxes.taxontax, - taxauthrates.taxrate - FROM taxauthrates - INNER JOIN taxgrouptaxes - ON taxauthrates.taxauthority=taxgrouptaxes.taxauthid - INNER JOIN taxauthorities - ON taxauthrates.taxauthority=taxauthorities.taxid - INNER JOIN taxgroups - ON taxgroups.taxgroupid=taxgrouptaxes.taxgroupid - INNER JOIN pctabs - ON pctabs.taxgroupid=taxgroups.taxgroupid - WHERE taxauthrates.taxcatid = " . $_SESSION['DefaultTaxCategory'] . " - AND pctabs.tabcode='" . $SelectedTabs . "' - ORDER BY taxgrouptaxes.calculationorder"; - $TaxResult = DB_query($SQL); - $i = 0; - while ($MyTaxRow = DB_fetch_array($TaxResult)) { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ' - - - '; - ++$i; - } - } - - //Select the tag - echo ' - - - '; - // End select tag - - //For the accept attribute of the file element, prefix dots to the front of each supported file extension. - $ReceiptSupportedExtDotPrefix = array_map(function($ReceiptSupportedExt) { - return '.' . $ReceiptSupportedExt; - }, $ReceiptSupportedExt); - echo ' - - - '; - - if (!isset($_POST['Notes'])) { - $_POST['Notes'] = ''; - } - echo ' - - - '; - - echo '

', _('Update Expense'), '

', _('New Expense'), '

', _('Date of Expense'), ': - -
', _('Expense Code'), ': - -
', _('Gross Amount'), ':
', $MyTaxRow['description'], ' - ', ($MyTaxRow['taxrate'] * 100), '%
', $MyTaxRow['description'], ' - ', ($MyTaxRow['taxrate'] * 100), '%:
', _('Tag'), ': -
', _('Attach Receipt'), ': - - -
', _('Notes'), ': - -
'; // close main table - echo ''; - echo ''; - echo '
- - -
'; - echo '
'; - } // end if user wish to delete -} -include('includes/footer.php'); + $Value) { + if (substr($Index, 0, 5) == 'index') { + $Index = $Value; + $SQL = "UPDATE pcashdetailtaxes SET pccashdetail='" . $_POST['PcCashDetail' . $Index] . "', + calculationorder='" . $_POST['CalculationOrder' . $Index] . "', + description='" . $_POST['Description' . $Index] . "', + taxauthid='" . $_POST['TaxAuthority' . $Index] . "', + purchtaxglaccount='" . $_POST['TaxGLAccount' . $Index] . "', + taxontax='" . $_POST['TaxOnTax' . $Index] . "', + taxrate='" . $_POST['TaxRate' . $Index] . "', + amount='" . -$_POST['TaxAmount' . $Index] . "' + WHERE counterindex='" . $Index ."'"; + $Result = DB_query($SQL); + } + } + if (isset($_FILES['Receipt']) and $_FILES['Receipt']['name'] != '') { + $UploadOriginalName = $_FILES['Receipt']['name']; + $UploadTempName = $_FILES['Receipt']['tmp_name']; + $UploadSize = $_FILES['Receipt']['size']; + $UploadType = $_FILES['Receipt']['type']; + $UploadError = $_FILES['Receipt']['error']; + $UploadTheFile = 'Yes'; //Assume all is well to start off with, but check for the worst + $ReceiptSupportedMime = array('image/png','image/jpeg','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); //list of support mime types, corresponding to the list of support file extensions in $ReceiptSupportedExt + if ($UploadSize > ($_SESSION['MaxImageSize'] * 1024)) { //Server-side file size check. This will usually be caught by $UploadError == 2 (MAX_FILE_SIZE), but we must not trust the user. + prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); + $UploadTheFile = 'No'; + } elseif (!in_array($UploadType, $ReceiptSupportedMime) and $UploadError != 2) { //File type check. If $UploadError == 2, then $UploadType will be empty. + prnMsg(_('File type not accepted. Only the following file types can be attached') . ': ' . implode(', ', $ReceiptSupportedExt), 'warn'); + $UploadTheFile = 'No'; + } elseif ($UploadError == 1 ) { //upload_max_filesize error check + prnMsg(_('The uploaded file exceeds the upload_max_filesize directive in php.ini. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 2 ) { //Client-side file size error check (MAX_FILE_SIZE) + prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 3 ) { //Partial upload error check + prnMsg( _('The uploaded file was only partially uploaded. Please try again.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 4 ) { //No file uploaded error check + prnMsg( _('No file was uploaded'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 5 ) { //Undefined error check + prnMsg( _('Undefined error'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 6 ) { //Temp directory error check + prnMsg( _('A necessary temporary folder is missing. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 7 ) { //Disk write failure error check + prnMsg( _('Cannot write file to disk. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 8 ) { //Upload stopped by PHP extension error check + prnMsg( _('The file upload was stopped by a PHP extension. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } + if ($UploadTheFile == 'Yes') { //Passed all the above validation + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + mkdir($ReceiptFileDir, 0775, true); + } + $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file + $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number + $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; + $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + unlink($ReceiptExistingFile); + } + move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. + } + } + prnMsg($Msg, 'success'); + } elseif ($InputError != 1) { + // First check the type is not being duplicated + // Add new record on submit + $SQL = "INSERT INTO pcashdetails (counterindex, + tabcode, + tag, + date, + codeexpense, + amount, + authorized, + posted, + notes) + VALUES (NULL, + '" . $_POST['SelectedTabs'] . "', + '" . $_POST['Tag'] . "', + '" . FormatDateForSQL($_POST['Date']) . "', + '" . $_POST['SelectedExpense'] . "', + '" . -filter_number_format($_POST['Amount']) . "', + 0, + 0, + '" . $_POST['Notes'] . "' + )"; + $Msg = _('The expense claim on tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); + $Result = DB_query($SQL); + $SelectedIndex = DB_Last_Insert_ID('pcashdetails', 'counterindex'); + foreach ($_POST as $Index => $Value) { + if (substr($Index, 0, 5) == 'index') { + $Index = $Value; + $SQL = "INSERT INTO pcashdetailtaxes (counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + ) VALUES ( + NULL, + '" . $SelectedIndex . "', + '" . $_POST['CalculationOrder' . $Index] . "', + '" . $_POST['Description' . $Index] . "', + '" . $_POST['TaxAuthority' . $Index] . "', + '" . $_POST['TaxGLAccount' . $Index] . "', + '" . $_POST['TaxOnTax' . $Index] . "', + '" . $_POST['TaxRate' . $Index] . "', + '" . -$_POST['TaxAmount' . $Index] . "' + )"; + $Result = DB_query($SQL); + } + } + if (isset($_FILES['Receipt']) and $_FILES['Receipt']['name'] != '') { + $UploadOriginalName = $_FILES['Receipt']['name']; + $UploadTempName = $_FILES['Receipt']['tmp_name']; + $UploadSize = $_FILES['Receipt']['size']; + $UploadType = $_FILES['Receipt']['type']; + $UploadError = $_FILES['Receipt']['error']; + $UploadTheFile = 'Yes'; //Assume all is well to start off with, but check for the worst + $ReceiptSupportedMime = array('image/png','image/jpeg','application/pdf','application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); //list of support mime types, corresponding to the list of support file extensions in $ReceiptSupportedExt + if ($UploadSize > ($_SESSION['MaxImageSize'] * 1024)) { //Server-side file size check. This will usually be caught by $UploadError == 2 (MAX_FILE_SIZE), but we must not trust the user. + prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); + $UploadTheFile = 'No'; + } elseif (!in_array($UploadType, $ReceiptSupportedMime) and $UploadError != 2) { //File type check. If $UploadError == 2, then $UploadType will be empty. + prnMsg(_('File type not accepted. Only the following file types can be attached') . ': ' . implode(', ', $ReceiptSupportedExt), 'warn'); + $UploadTheFile = 'No'; + } elseif ($UploadError == 1 ) { //upload_max_filesize error check + prnMsg(_('The uploaded file exceeds the upload_max_filesize directive in php.ini. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 2 ) { //Client-side file size error check (MAX_FILE_SIZE) + prnMsg(_('The uploaded file exceeds the maximum file size of') . ' ' . $_SESSION['MaxImageSize'] . 'KB', 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 3 ) { //Partial upload error check + prnMsg( _('The uploaded file was only partially uploaded. Please try again.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 4 ) { //No file uploaded error check + prnMsg( _('No file was uploaded'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 5 ) { //Undefined error check + prnMsg( _('Undefined error'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 6 ) { //Temp directory error check + prnMsg( _('A necessary temporary folder is missing. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 7 ) { //Disk write failure error check + prnMsg( _('Cannot write file to disk. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } elseif ($UploadError == 8 ) { //Upload stopped by PHP extension error check + prnMsg( _('The file upload was stopped by a PHP extension. Please contact your system administrator.'), 'warn'); + $UploadTheFile ='No'; + } + if ($UploadTheFile == 'Yes') { //Passed all the above validation + if (!file_exists($ReceiptFileDir)) { //Create the receipts directory if it doesn't already exist + mkdir($ReceiptFileDir, 0775, true); + } + $ReceiptFileExt = pathinfo($UploadOriginalName, PATHINFO_EXTENSION); //Grab the file extension of the uploaded file + $ReceiptFileName = $SelectedIndex . '.' . $ReceiptFileExt; //Rename the uploaded file with the expenses index number + $ReceiptFilePath = $ReceiptFileDir . '/' . $ReceiptFileName; + $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { // Overwrite existing files, and delete all other file types. + unlink($ReceiptExistingFile); + } + move_uploaded_file($UploadTempName, $ReceiptFilePath); //Move the uploaded file from the temp directory to the receipts directory. + } + } + prnMsg($Msg, 'success'); + } + if ($InputError != 1) { + unset($_POST['SelectedExpense']); + unset($_POST['Amount']); + unset($_POST['Tag']); + unset($_POST['Date']); + unset($_POST['Notes']); + unset($_FILES['Receipt']); + } +} elseif (isset($_GET['delete'])) { + $SQL = "DELETE FROM pcashdetails, pcashdetailtaxes + USING pcashdetails + INNER JOIN pcashdetailtaxes + ON pcashdetails.counterindex = pcashdetailtaxes.pccashdetail + WHERE pcashdetails.counterindex = '" . $SelectedIndex . "'"; + $ErrMsg = _('Petty Cash Expense record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('Petty Cash expense record') . ' ' . $SelectedTabs . ' ' . _('has been deleted'), 'success'); + //Delete receipt attachments. There should be only one per expenses, but check for all possible file extensions anyway. + $ReceiptExistingFiles = glob($ReceiptFileDir . '/' . $SelectedIndex . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE); //Find all existing receipt files for the expense, in case more than 1 file type is currently in the receipts directory + foreach($ReceiptExistingFiles as $ReceiptExistingFile) { + unlink($ReceiptExistingFile); + } + unset($_GET['delete']); +} //end of get delete +if (!isset($SelectedTabs)) { + /* It could still be the first time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + echo '

+ ', ' ', $Title, ' +

'; + echo '
'; + echo ''; + echo ' + + + + '; + echo '
', _('Clain expenses on petty cash tab'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} else { // isset($SelectedTabs) + echo ''; + echo '

+ ', ' ', $Title, ' +

'; + if (!isset($_GET['edit']) or isset($_POST['GO'])) { + if (!isset($Days)) { + $Days = 30; + } + /* Retrieve decimal places to display */ + $SQLDecimalPlaces = "SELECT decimalplaces + FROM currencies,pctabs + WHERE currencies.currabrev = pctabs.currency + AND tabcode='" . $SelectedTabs . "'"; + $Result = DB_query($SQLDecimalPlaces); + $MyRow = DB_fetch_array($Result); + $CurrDecimalPlaces = $MyRow['decimalplaces']; + echo '
'; + echo ''; + echo '
'; + echo ' + + + '; + echo '
' . _('Petty Cash Tab') . ':' . $SelectedTabs . '
'; + + //Limit expenses history to X days + echo ' + + + +
', _('Detail of Tab Movements For Last '), ': + + ', _('Days'), ' + +
'; + if (isset($_POST['Cancel'])) { + unset($_POST['SelectedExpense']); + unset($_POST['Amount']); + unset($_POST['Date']); + unset($_POST['Notes']); + unset($_FILES['Receipt']); + } + $SQL = "SELECT counterindex, + tabcode, + tag, + date, + codeexpense, + amount, + authorized, + posted, + notes + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "' + AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY) + ORDER BY date, + counterindex ASC"; + $Result = DB_query($SQL); + echo ' + + + + + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + $SQLDes = "SELECT description + FROM pcexpenses + WHERE codeexpense='" . $MyRow['codeexpense'] . "'"; + $ResultDes = DB_query($SQLDes); + $Description = DB_fetch_array($ResultDes); + + if (!isset($Description[0])) { + $ExpenseCodeDes = 'ASSIGNCASH'; + } else { + $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; + } + + if ($MyRow['authorized'] == '0000-00-00') { + $AuthorisedDate = _('Unauthorised'); + } else { + $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); + } + + //Generate download link for expense receipt, or show text if no receipt file is found. + $ReceiptFilePathMatched = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. + if (!empty($ReceiptFilePathMatched)) { //If no receipt file for the expenses is found + $ReceiptText = '' . _('Download attachment') . ''; + } elseif ($ExpenseCodeDes == 'ASSIGNCASH') { + $ReceiptText = ''; + } else { + $ReceiptText = _('No attachment'); + } + + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; + $TagResult = DB_query($TagSQL); + $TagRow = DB_fetch_array($TagResult); + if ($MyRow['tag'] == 0) { + $TagRow['tagdescription'] = _('None'); + } + $TagTo = $MyRow['tag']; + if ($ExpenseCodeDes == 'ASSIGNCASH') { + $TagDescription = ''; + } else { + $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; + } + + $TaxesDescription = ''; + $TaxesTaxAmount = ''; + $TaxSQL = "SELECT counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + FROM pcashdetailtaxes + WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; + $TaxResult = DB_query($TaxSQL); + while ($MyTaxRow = DB_fetch_array($TaxResult)) { + $TaxesDescription .= $MyTaxRow['description'] . '
'; + $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces) . '
'; + } + if (($MyRow['authorized'] == '0000-00-00') and ($ExpenseCodeDes != 'ASSIGNCASH')) { + // only movements NOT authorised can be modified or deleted + echo ' + + + + + + + + + + + + '; + } else { + echo ' + + + + + + + + + + '; + } + } + //END WHILE LIST LOOP + $SQLAmount = "SELECT sum(amount) + FROM pcashdetails + WHERE tabcode='" . $SelectedTabs . "'"; + $ResultAmount = DB_query($SQLAmount); + $Amount = DB_fetch_array($ResultAmount); + if (!isset($Amount['0'])) { + $Amount['0'] = 0; + } + echo ' + + + '; + echo '
', _('Date of Expense'), '', _('Expense Code'), '', _('Gross Amount'), '', _('Tax'), '', _('Tax Group'), '', _('Tag'), '', _('Notes'), '', _('Receipt Attachment'), '', _('Date Authorised'), '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '' . _('Edit') . '' . _('Delete') . '
', ConvertSQLDate($MyRow['date']), '', $ExpenseCodeDes, '', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '', $TaxesTaxAmount, '', $TaxesDescription, '', $TagDescription, '', $MyRow['notes'], '', $ReceiptText, '', $AuthorisedDate, '
', _('Current balance'), ':', locale_number_format($Amount['0'], $CurrDecimalPlaces), '
'; + echo '
'; + } + if (!isset($_GET['delete'])) { + echo '
'; + echo ''; + if (isset($_GET['edit'])) { + $SQL = "SELECT counterindex, + tabcode, + tag, + date, + codeexpense, + amount, + authorized, + posted, + notes + FROM pcashdetails + WHERE counterindex='" . $SelectedIndex . "'"; + $Result = DB_query($SQL); + $MyRow = DB_fetch_array($Result); + $_POST['Date'] = ConvertSQLDate($MyRow['date']); + $_POST['SelectedExpense'] = $MyRow['codeexpense']; + $_POST['Amount'] = -$MyRow['amount']; + $_POST['Notes'] = $MyRow['notes']; + $_POST['Tag'] = $MyRow['tag']; + echo ''; + echo ''; + echo ''; + } //end of Get Edit + if (!isset($_POST['Date'])) { + $_POST['Date'] = Date($_SESSION['DefaultDateFormat']); + } + echo ''; + if (isset($_GET['SelectedIndex'])) { + echo ' + + '; + } else { + echo ' + + '; + } + echo ' + + + + + + + '; + if (!isset($_POST['Amount'])) { + $_POST['Amount'] = 0; + } + echo ' + + + '; + if (isset($_GET['edit'])) { + $SQL = "SELECT counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + FROM pcashdetailtaxes + WHERE pccashdetail='" . $SelectedIndex . "'"; + $TaxesResult = DB_query($SQL); + while ($MyTaxRow = DB_fetch_array($TaxesResult)) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ' + + + '; + } + } else { + $SQL = "SELECT taxgrouptaxes.calculationorder, + taxauthorities.description, + taxgrouptaxes.taxauthid, + taxauthorities.purchtaxglaccount, + taxgrouptaxes.taxontax, + taxauthrates.taxrate + FROM taxauthrates + INNER JOIN taxgrouptaxes + ON taxauthrates.taxauthority=taxgrouptaxes.taxauthid + INNER JOIN taxauthorities + ON taxauthrates.taxauthority=taxauthorities.taxid + INNER JOIN taxgroups + ON taxgroups.taxgroupid=taxgrouptaxes.taxgroupid + INNER JOIN pctabs + ON pctabs.taxgroupid=taxgroups.taxgroupid + WHERE taxauthrates.taxcatid = " . $_SESSION['DefaultTaxCategory'] . " + AND pctabs.tabcode='" . $SelectedTabs . "' + ORDER BY taxgrouptaxes.calculationorder"; + $TaxResult = DB_query($SQL); + $i = 0; + while ($MyTaxRow = DB_fetch_array($TaxResult)) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ' + + + '; + ++$i; + } + } + + //Select the tag + echo ' + + + '; + // End select tag + + //For the accept attribute of the file element, prefix dots to the front of each supported file extension. + $ReceiptSupportedExtDotPrefix = array_map(function($ReceiptSupportedExt) { + return '.' . $ReceiptSupportedExt; + }, $ReceiptSupportedExt); + echo ' + + + '; + + if (!isset($_POST['Notes'])) { + $_POST['Notes'] = ''; + } + echo ' + + + '; + + echo '

', _('Update Expense'), '

', _('New Expense'), '

', _('Date of Expense'), ': + +
', _('Expense Code'), ': + +
', _('Gross Amount'), ':
', $MyTaxRow['description'], ' - ', ($MyTaxRow['taxrate'] * 100), '%
', $MyTaxRow['description'], ' - ', ($MyTaxRow['taxrate'] * 100), '%:
', _('Tag'), ': +
', _('Attach Receipt'), ': + + +
', _('Notes'), ': + +
'; // close main table + echo ''; + echo ''; + echo '
+ + +
'; + echo '
'; + } // end if user wish to delete +} +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcExpenses.php b/PcExpenses.php index 22f71771a..0e2634800 100644 --- a/PcExpenses.php +++ b/PcExpenses.php @@ -1,301 +1,295 @@ - - ', ' ', $Title, ' -

'; -if (isset($_POST['SelectedExpense'])) { - $SelectedExpense = mb_strtoupper($_POST['SelectedExpense']); -} elseif (isset($_GET['SelectedExpense'])) { - $SelectedExpense = mb_strtoupper($_GET['SelectedExpense']); -} -if (isset($_POST['Cancel'])) { - unset($SelectedExpense); - unset($_POST['CodeExpense']); - unset($_POST['Description']); - unset($_POST['GLAccount']); - unset($_POST['Tag']); -} -if (isset($Errors)) { - unset($Errors); -} -if (isset($_POST['submit'])) { - //initialise no input errors assumed initially before we test - $InputError = 0; - /* actions to take once the user has clicked the submit button - ie the page has called itself with some user input */ - //first off validate inputs sensible - if ($_POST['CodeExpense'] == '' or $_POST['CodeExpense'] == ' ' or $_POST['CodeExpense'] == ' ') { - $InputError = 1; - prnMsg(_('The Expense type code cannot be an empty string or spaces'), 'error'); - } elseif (mb_strlen($_POST['CodeExpense']) > 20) { - $InputError = 1; - prnMsg(_('The expense code must be twenty characters or less long'), 'error'); - } elseif (ContainsIllegalCharacters($_POST['CodeExpense'])) { - $InputError = 1; - prnMsg(_('The expense code cannot contain any of the following characters ') . '" \' - &', 'error'); - } elseif (ContainsIllegalCharacters($_POST['Description'])) { - $InputError = 1; - prnMsg(_('The expense description cannot contain any of the following characters ') . '" \' - &', 'error'); - } elseif (mb_strlen($_POST['Description']) > 50) { - $InputError = 1; - prnMsg(_('The tab code must be fifty characters or less long'), 'error'); - } elseif (mb_strlen($_POST['Description']) == 0) { - $InputError = 1; - echo prnMsg(_('The tab code description must be entered'), 'error'); - } elseif ($_POST['GLAccount'] == '') { - $InputError = 1; - } elseif ($_POST['TaxCategory'] === '0') { - $InputError = 1; - echo prnMsg(_('A tax category must be selected from the list'), 'error'); - } - if (isset($SelectedExpense) and $InputError != 1) { - $SQL = "UPDATE pcexpenses - SET description = '" . $_POST['Description'] . "', - glaccount = '" . $_POST['GLAccount'] . "', - tag = '" . $_POST['Tag'] . "', - taxcatid='" . $_POST['TaxCategory'] . "' - WHERE codeexpense = '" . $SelectedExpense . "'"; - $Msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); - } elseif ($InputError != 1) { - // First check the type is not being duplicated - $CheckSQL = "SELECT count(*) - FROM pcexpenses - WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; - $CheckResult = DB_query($CheckSQL); - $CheckRow = DB_fetch_row($CheckResult); - if ($CheckRow[0] > 0) { - $InputError = 1; - prnMsg(_('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO pcexpenses - (codeexpense, - description, - glaccount, - tag, - taxcatid) - VALUES ('" . $_POST['CodeExpense'] . "', - '" . $_POST['Description'] . "', - '" . $_POST['GLAccount'] . "', - '" . $_POST['Tag'] . "', - '" . $_POST['TaxCategory'] . "' - )"; - $Msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); - $CheckSQL = "SELECT count(codeexpense) - FROM pcexpenses"; - $Result = DB_query($CheckSQL); - $row = DB_fetch_row($Result); - } - } - if ($InputError != 1) { - //run the SQL from either of the above possibilites - $Result = DB_query($SQL); - prnMsg($Msg, 'success'); - unset($SelectedExpense); - unset($_POST['CodeExpense']); - unset($_POST['Description']); - unset($_POST['GLAccount']); - unset($_POST['Tag']); - unset($_POST['TaxGroup']); - } -} elseif (isset($_GET['delete'])) { - // PREVENT DELETES IF DEPENDENT RECORDS IN 'PcTabExpenses' - $SQL = "SELECT COUNT(*) - FROM pctabexpenses - WHERE codeexpense='" . $SelectedExpense . "'"; - $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); - $Result = DB_query($SQL, $ErrMsg); - $MyRow = DB_fetch_row($Result); - if ($MyRow[0] > 0) { - prnMsg(_('Cannot delete this petty cash expense because it is used in some tab types') . '
' . _('There are') . ' ' . $MyRow[0] . ' ' . _('tab types using this expense code'), 'error'); - } else { - $SQL = "DELETE FROM pcexpenses - WHERE codeexpense='" . $SelectedExpense . "'"; - $ErrMsg = _('The expense type record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted'), 'success'); - unset($SelectedExpense); - unset($_GET['delete']); - } //end if tab type used in transactions -} -if (!isset($SelectedExpense)) { - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedExpense will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - $SQL = "SELECT codeexpense, - description, - glaccount, - tag, - taxcatid - FROM pcexpenses"; - $Result = DB_query($SQL); - echo ' - - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $SQLdesc = "SELECT accountname - FROM chartmaster - WHERE accountcode='" . $MyRow['glaccount'] . "'"; - $ResultDes = DB_query($SQLdesc); - $Description = DB_fetch_array($ResultDes); - $SqlDescTag = "SELECT tagdescription - FROM tags - WHERE tagref='" . $MyRow['tag'] . "'"; - $ResultDesTag = DB_query($SqlDescTag); - $DescriptionTag = DB_fetch_array($ResultDesTag); - $SqlTaxCat = "SELECT taxcatname - FROM taxcategories - WHERE taxcatid='" . $MyRow['taxcatid'] . "'"; - $ResultTaxCat = DB_query($SqlTaxCat); - $DescriptionTaxCat = DB_fetch_array($ResultTaxCat); - echo ' - - - - - - - - '; - } - //END WHILE LIST LOOP - echo '
', _('Expense Code'), '', _('Description'), '', _('Account Code'), '', _('Account Description'), '', _('Tag'), '', _('Tax Category'), '
', $MyRow['codeexpense'], '', $MyRow['description'], '', $MyRow['glaccount'], '', $Description['accountname'], '', $DescriptionTag['tagdescription'], '', $DescriptionTaxCat['taxcatname'], '', _('Edit'), '' . _('Delete') . '
'; -} -//end of ifs and buts! -if (isset($SelectedExpense)) { - echo ''; -} -if (!isset($_GET['delete'])) { - echo '
'; - echo ''; - // The user wish to EDIT an existing type - if (isset($SelectedExpense) and $SelectedExpense != '') { - $SQL = "SELECT codeexpense, - description, - glaccount, - tag, - taxcatid - FROM pcexpenses - WHERE codeexpense='" . $SelectedExpense . "'"; - $Result = DB_query($SQL); - $MyRow = DB_fetch_array($Result); - $_POST['CodeExpense'] = $MyRow['codeexpense']; - $_POST['Description'] = $MyRow['description']; - $_POST['GLAccount'] = $MyRow['glaccount']; - $_POST['Tag'] = $MyRow['tag']; - $_POST['TaxCategory'] = $MyRow['taxcatid']; - echo ''; - echo ''; - // We dont allow the user to change an existing type code - echo ' - - - - '; - } else { - // This is a new type so the user may volunteer a type code - echo '
', _('Expense Code'), ':', $_POST['CodeExpense'], '
- - - - '; - } - if (!isset($_POST['Description'])) { - $_POST['Description'] = ''; - } - echo ' - - - '; - echo ' - - - '; - //Select the tag - echo ' - - - '; - // End select tag - $SQL = "SELECT taxcatid, - taxcatname - FROM taxcategories"; - $Result = DB_query($SQL); - echo ' - - - '; - echo '
', _('Expense Code'), ':
', _('Description'), ':
', _('Account Code'), ': -
', _('Tag'), ': -
', _('Tax Category'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} // end if user wish to delete -include('includes/footer.php'); + + ', ' ', $Title, ' +

'; +if (isset($_POST['SelectedExpense'])) { + $SelectedExpense = mb_strtoupper($_POST['SelectedExpense']); +} elseif (isset($_GET['SelectedExpense'])) { + $SelectedExpense = mb_strtoupper($_GET['SelectedExpense']); +} +if (isset($_POST['Cancel'])) { + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); + unset($_POST['Tag']); +} +if (isset($Errors)) { + unset($Errors); +} +if (isset($_POST['submit'])) { + //initialise no input errors assumed initially before we test + $InputError = 0; + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + //first off validate inputs sensible + if ($_POST['CodeExpense'] == '' or $_POST['CodeExpense'] == ' ' or $_POST['CodeExpense'] == ' ') { + $InputError = 1; + prnMsg(_('The Expense type code cannot be an empty string or spaces'), 'error'); + } elseif (mb_strlen($_POST['CodeExpense']) > 20) { + $InputError = 1; + prnMsg(_('The expense code must be twenty characters or less long'), 'error'); + } elseif (ContainsIllegalCharacters($_POST['CodeExpense'])) { + $InputError = 1; + prnMsg(_('The expense code cannot contain any of the following characters ') . '" \' - &', 'error'); + } elseif (ContainsIllegalCharacters($_POST['Description'])) { + $InputError = 1; + prnMsg(_('The expense description cannot contain any of the following characters ') . '" \' - &', 'error'); + } elseif (mb_strlen($_POST['Description']) > 50) { + $InputError = 1; + prnMsg(_('The tab code must be fifty characters or less long'), 'error'); + } elseif (mb_strlen($_POST['Description']) == 0) { + $InputError = 1; + echo prnMsg(_('The tab code description must be entered'), 'error'); + } elseif ($_POST['GLAccount'] == '') { + $InputError = 1; + } elseif ($_POST['TaxCategory'] === '0') { + $InputError = 1; + echo prnMsg(_('A tax category must be selected from the list'), 'error'); + } + if (isset($SelectedExpense) and $InputError != 1) { + $SQL = "UPDATE pcexpenses + SET description = '" . $_POST['Description'] . "', + glaccount = '" . $_POST['GLAccount'] . "', + tag = '" . $_POST['Tag'] . "', + taxcatid='" . $_POST['TaxCategory'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; + $Msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); + } elseif ($InputError != 1) { + // First check the type is not being duplicated + $CheckSQL = "SELECT count(*) + FROM pcexpenses + WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; + $CheckResult = DB_query($CheckSQL); + $CheckRow = DB_fetch_row($CheckResult); + if ($CheckRow[0] > 0) { + $InputError = 1; + prnMsg(_('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO pcexpenses + (codeexpense, + description, + glaccount, + tag, + taxcatid) + VALUES ('" . $_POST['CodeExpense'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['GLAccount'] . "', + '" . $_POST['Tag'] . "', + '" . $_POST['TaxCategory'] . "' + )"; + $Msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); + $CheckSQL = "SELECT count(codeexpense) + FROM pcexpenses"; + $Result = DB_query($CheckSQL); + $row = DB_fetch_row($Result); + } + } + if ($InputError != 1) { + //run the SQL from either of the above possibilites + $Result = DB_query($SQL); + prnMsg($Msg, 'success'); + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); + unset($_POST['Tag']); + unset($_POST['TaxGroup']); + } +} elseif (isset($_GET['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'PcTabExpenses' + $SQL = "SELECT COUNT(*) + FROM pctabexpenses + WHERE codeexpense='" . $SelectedExpense . "'"; + $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); + $Result = DB_query($SQL, $ErrMsg); + $MyRow = DB_fetch_row($Result); + if ($MyRow[0] > 0) { + prnMsg(_('Cannot delete this petty cash expense because it is used in some tab types') . '
' . _('There are') . ' ' . $MyRow[0] . ' ' . _('tab types using this expense code'), 'error'); + } else { + $SQL = "DELETE FROM pcexpenses + WHERE codeexpense='" . $SelectedExpense . "'"; + $ErrMsg = _('The expense type record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted'), 'success'); + unset($SelectedExpense); + unset($_GET['delete']); + } //end if tab type used in transactions +} +if (!isset($SelectedExpense)) { + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedExpense will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + $SQL = "SELECT codeexpense, + description, + glaccount, + tag, + taxcatid + FROM pcexpenses"; + $Result = DB_query($SQL); + echo ' + + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + $SQLdesc = "SELECT accountname + FROM chartmaster + WHERE accountcode='" . $MyRow['glaccount'] . "'"; + $ResultDes = DB_query($SQLdesc); + $Description = DB_fetch_array($ResultDes); + $SqlDescTag = "SELECT tagdescription + FROM tags + WHERE tagref='" . $MyRow['tag'] . "'"; + $ResultDesTag = DB_query($SqlDescTag); + $DescriptionTag = DB_fetch_array($ResultDesTag); + $SqlTaxCat = "SELECT taxcatname + FROM taxcategories + WHERE taxcatid='" . $MyRow['taxcatid'] . "'"; + $ResultTaxCat = DB_query($SqlTaxCat); + $DescriptionTaxCat = DB_fetch_array($ResultTaxCat); + echo ' + + + + + + + + + '; + } + //END WHILE LIST LOOP + echo '
', _('Expense Code'), '', _('Description'), '', _('Account Code'), '', _('Account Description'), '', _('Tag'), '', _('Tax Category'), '
', $MyRow['codeexpense'], '', $MyRow['description'], '', $MyRow['glaccount'], '', $Description['accountname'], '', $DescriptionTag['tagdescription'], '', $DescriptionTaxCat['taxcatname'], '', _('Edit'), '' . _('Delete') . '
'; +} +//end of ifs and buts! +if (isset($SelectedExpense)) { + echo ''; +} +if (!isset($_GET['delete'])) { + echo '
'; + echo ''; + // The user wish to EDIT an existing type + if (isset($SelectedExpense) and $SelectedExpense != '') { + $SQL = "SELECT codeexpense, + description, + glaccount, + tag, + taxcatid + FROM pcexpenses + WHERE codeexpense='" . $SelectedExpense . "'"; + $Result = DB_query($SQL); + $MyRow = DB_fetch_array($Result); + $_POST['CodeExpense'] = $MyRow['codeexpense']; + $_POST['Description'] = $MyRow['description']; + $_POST['GLAccount'] = $MyRow['glaccount']; + $_POST['Tag'] = $MyRow['tag']; + $_POST['TaxCategory'] = $MyRow['taxcatid']; + echo ''; + echo ''; + // We dont allow the user to change an existing type code + echo ' + + + + '; + } else { + // This is a new type so the user may volunteer a type code + echo '
', _('Expense Code'), ':', $_POST['CodeExpense'], '
+ + + + '; + } + if (!isset($_POST['Description'])) { + $_POST['Description'] = ''; + } + echo ' + + + '; + echo ' + + + '; + //Select the tag + echo ' + + + '; + // End select tag + $SQL = "SELECT taxcatid, + taxcatname + FROM taxcategories"; + $Result = DB_query($SQL); + echo ' + + + '; + echo '
', _('Expense Code'), ':
', _('Description'), ':
', _('Account Code'), ': +
', _('Tag'), ': +
', _('Tax Category'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} // end if user wish to delete +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcExpensesTypeTab.php b/PcExpensesTypeTab.php index 545525d18..124eb92a2 100644 --- a/PcExpensesTypeTab.php +++ b/PcExpensesTypeTab.php @@ -1,194 +1,188 @@ - - ', ' ', $Title, ' -

'; -if (isset($_POST['SelectedCode'])) { - $SelectedCode = mb_strtoupper($_POST['SelectedCode']); -} elseif (isset($_GET['SelectedCode'])) { - $SelectedCode = mb_strtoupper($_GET['SelectedCode']); -} else { - $SelectedCode = ''; -} -if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedCode) or mb_strpos($SelectedCode, ' ') > 0)) { - $InputError = 1; - prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'), 'error'); -} -if (isset($_POST['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_POST['SelectedTab']); -} elseif (isset($_GET['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_GET['SelectedTab']); -} -if (isset($_POST['Cancel'])) { - unset($SelectedTab); - unset($SelectedCode); -} -if (isset($_POST['Process'])) { - if ($_POST['SelectedTab'] == '') { - echo prnMsg(_('You have not selected a tab to maintain the expenses on'), 'error'); - echo '
'; - unset($SelectedTab); - unset($_POST['SelectedTab']); - } -} -if (isset($_POST['submit'])) { - $InputError = 0; - if ($_POST['SelectedExpense'] == '') { - $InputError = 1; - echo prnMsg(_('You have not selected an expense to add to this tab'), 'error'); - echo '
'; - unset($SelectedTab); - } - if ($InputError != 1) { - // First check the type is not being duplicated - $CheckSQL = "SELECT count(*) - FROM pctabexpenses - WHERE typetabcode= '" . $_POST['SelectedTab'] . "' - AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; - $CheckResult = DB_query($CheckSQL); - $CheckRow = DB_fetch_row($CheckResult); - if ($CheckRow[0] > 0) { - $InputError = 1; - prnMsg(_('The Expense') . ' ' . $_POST['codeexpense'] . ' ' . _('already exists in this Type of Tab'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO pctabexpenses (typetabcode, - codeexpense) - VALUES ('" . $_POST['SelectedTab'] . "', - '" . $_POST['SelectedExpense'] . "')"; - $Msg = _('Expense code') . ': ' . $_POST['SelectedExpense'] . ' ' . _('for Type of Tab') . ': ' . $_POST['SelectedTab'] . ' ' . _('has been created'); - $CheckSQL = "SELECT count(typetabcode) - FROM pctypetabs"; - $Result = DB_query($CheckSQL); - $row = DB_fetch_row($Result); - } - } - if ($InputError != 1) { - //run the SQL from either of the above possibilites - $Result = DB_query($SQL); - prnMsg($Msg, 'success'); - unset($_POST['SelectedExpense']); - } -} elseif (isset($_GET['delete'])) { - $SQL = "DELETE FROM pctabexpenses - WHERE typetabcode='" . $SelectedTab . "' - AND codeexpense='" . $SelectedCode . "'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('Expense code') . ' ' . $SelectedCode . ' ' . _('for type of tab') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); - unset($_GET['delete']); -} -if (!isset($SelectedTab)) { - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedCode will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - echo '
'; - echo ''; - echo ''; //Main table - echo ' - - - '; - echo '
', _('Select Type of Tab'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} -//end of ifs and buts! -if (isset($_POST['process']) or isset($SelectedTab)) { - echo ''; - echo '
'; - echo ''; - echo ''; - $SQL = "SELECT pctabexpenses.codeexpense, - pcexpenses.description - FROM pctabexpenses - INNER JOIN pcexpenses - ON pctabexpenses.codeexpense=pcexpenses.codeexpense - WHERE pctabexpenses.typetabcode='" . $SelectedTab . "' - ORDER BY pctabexpenses.codeexpense ASC"; - $Result = DB_query($SQL); - echo ' - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' - - - '; - } - //END WHILE LIST LOOP - echo '
-

', _('Expense Codes for Type of Tab '), ' ', $SelectedTab, '

-
', _('Expense Code'), '', _('Description'), '
', $MyRow['codeexpense'], '', $MyRow['description'], '' . _('Delete') . '
'; - if (!isset($_GET['delete'])) { - echo ''; //Main table - echo ' - - - '; - echo '
', _('Select Expense Code'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; - } // end if user wish to delete -} -include('includes/footer.php'); + + ', ' ', $Title, ' +

'; +if (isset($_POST['SelectedCode'])) { + $SelectedCode = mb_strtoupper($_POST['SelectedCode']); +} elseif (isset($_GET['SelectedCode'])) { + $SelectedCode = mb_strtoupper($_GET['SelectedCode']); +} else { + $SelectedCode = ''; +} +if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedCode) or mb_strpos($SelectedCode, ' ') > 0)) { + $InputError = 1; + prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'), 'error'); +} +if (isset($_POST['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_GET['SelectedTab']); +} +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($SelectedCode); +} +if (isset($_POST['Process'])) { + if ($_POST['SelectedTab'] == '') { + echo prnMsg(_('You have not selected a tab to maintain the expenses on'), 'error'); + echo '
'; + unset($SelectedTab); + unset($_POST['SelectedTab']); + } +} +if (isset($_POST['submit'])) { + $InputError = 0; + if ($_POST['SelectedExpense'] == '') { + $InputError = 1; + echo prnMsg(_('You have not selected an expense to add to this tab'), 'error'); + echo '
'; + unset($SelectedTab); + } + if ($InputError != 1) { + // First check the type is not being duplicated + $CheckSQL = "SELECT count(*) + FROM pctabexpenses + WHERE typetabcode= '" . $_POST['SelectedTab'] . "' + AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; + $CheckResult = DB_query($CheckSQL); + $CheckRow = DB_fetch_row($CheckResult); + if ($CheckRow[0] > 0) { + $InputError = 1; + prnMsg(_('The Expense') . ' ' . $_POST['codeexpense'] . ' ' . _('already exists in this Type of Tab'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO pctabexpenses (typetabcode, + codeexpense) + VALUES ('" . $_POST['SelectedTab'] . "', + '" . $_POST['SelectedExpense'] . "')"; + $Msg = _('Expense code') . ': ' . $_POST['SelectedExpense'] . ' ' . _('for Type of Tab') . ': ' . $_POST['SelectedTab'] . ' ' . _('has been created'); + $CheckSQL = "SELECT count(typetabcode) + FROM pctypetabs"; + $Result = DB_query($CheckSQL); + $row = DB_fetch_row($Result); + } + } + if ($InputError != 1) { + //run the SQL from either of the above possibilites + $Result = DB_query($SQL); + prnMsg($Msg, 'success'); + unset($_POST['SelectedExpense']); + } +} elseif (isset($_GET['delete'])) { + $SQL = "DELETE FROM pctabexpenses + WHERE typetabcode='" . $SelectedTab . "' + AND codeexpense='" . $SelectedCode . "'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('Expense code') . ' ' . $SelectedCode . ' ' . _('for type of tab') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); + unset($_GET['delete']); +} +if (!isset($SelectedTab)) { + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedCode will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + echo '
'; + echo ''; + echo ''; //Main table + echo ' + + + '; + echo '
', _('Select Type of Tab'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} +//end of ifs and buts! +if (isset($_POST['process']) or isset($SelectedTab)) { + echo ''; + echo '
'; + echo ''; + echo ''; + $SQL = "SELECT pctabexpenses.codeexpense, + pcexpenses.description + FROM pctabexpenses + INNER JOIN pcexpenses + ON pctabexpenses.codeexpense=pcexpenses.codeexpense + WHERE pctabexpenses.typetabcode='" . $SelectedTab . "' + ORDER BY pctabexpenses.codeexpense ASC"; + $Result = DB_query($SQL); + echo ' + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + echo ' + + + + '; + } + //END WHILE LIST LOOP + echo '
+

', _('Expense Codes for Type of Tab '), ' ', $SelectedTab, '

+
', _('Expense Code'), '', _('Description'), '
', $MyRow['codeexpense'], '', $MyRow['description'], '' . _('Delete') . '
'; + if (!isset($_GET['delete'])) { + echo ''; //Main table + echo ' + + + '; + echo '
', _('Select Expense Code'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; + } // end if user wish to delete +} +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcReportExpense.php b/PcReportExpense.php index f5e950e84..428be89cd 100644 --- a/PcReportExpense.php +++ b/PcReportExpense.php @@ -146,17 +146,8 @@ ' . _('Date Authorised') . ' '; - $k=0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { $CurrDecimalPlaces = $MyRow['decimalplaces']; - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $TaxesDescription = ''; $TaxesTaxAmount = ''; $TaxSQL = "SELECT counterindex, @@ -198,7 +189,8 @@ } */ - echo '', ConvertSQLDate($MyRow['date']), ' + echo ' + ', ConvertSQLDate($MyRow['date']), ' ', $MyRow['tabcode'], ' ', $MyRow['currency'], ' ', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), ' diff --git a/PcReportTab.php b/PcReportTab.php index 3a97dd85e..34663881d 100644 --- a/PcReportTab.php +++ b/PcReportTab.php @@ -474,16 +474,7 @@ ' . _('Date Authorised') . ' '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($TabDetail)) { - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; $TagResult = DB_query($TagSQL); @@ -542,7 +533,8 @@ $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; } - echo '', ConvertSQLDate($MyRow['date']), ' + echo ' + ', ConvertSQLDate($MyRow['date']), ' ', $ExpenseCodeDes, ' ', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), ' ', $TaxesTaxAmount, ' @@ -566,7 +558,7 @@ $Amount[0] = 0; } - echo '' . _('Balance at') . ' ' .$_POST['ToDate'] . ': + echo '' . _('Balance at') . ' ' .$_POST['ToDate'] . ': ' . locale_number_format($Amount[0],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . $Tabs['currency'] . ''; echo ''; diff --git a/PcTabExpensesList.php b/PcTabExpensesList.php index 9ad4c67e8..4250edc68 100644 --- a/PcTabExpensesList.php +++ b/PcTabExpensesList.php @@ -1,312 +1,312 @@ -= '" . FormatDateForSQL($FromDate) . "' - AND pcashdetails.date <= '" . FormatDateForSQL($ToDate) . "' - ORDER BY pcashdetails.date, - pcashdetails.counterindex"; - $Result = DB_query($SQL); - - if (DB_num_rows($Result) != 0){ - - // Create new PHPExcel object - $objPHPExcel = new PHPExcel(); - - // Set document properties - $objPHPExcel->getProperties()->setCreator("webERP") - ->setLastModifiedBy("webERP") - ->setTitle("PC Tab Expenses List") - ->setSubject("PC Tab Expenses List") - ->setDescription("PC Tab Expenses List") - ->setKeywords("") - ->setCategory(""); - - // Formatting - - $objPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setWrapText(true); - $objPHPExcel->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); - $objPHPExcel->getActiveSheet()->getStyle('B5')->getNumberFormat()->setFormatCode('#,##0.00'); - $objPHPExcel->getActiveSheet()->getStyle('C:E')->getNumberFormat()->setFormatCode('#,##0.00'); - $objPHPExcel->getActiveSheet()->getStyle('E1:E2')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); - $objPHPExcel->getActiveSheet()->getStyle('I')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); - $objPHPExcel->getActiveSheet()->getStyle('A:I')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); - $objPHPExcel->getActiveSheet()->getStyle('10')->getFont()->setBold(true); - $objPHPExcel->getActiveSheet()->getStyle('A1:A8')->getFont()->setBold(true); - $objPHPExcel->getActiveSheet()->getStyle('D1:D2')->getFont()->setBold(true); - - // Add title data - $objPHPExcel->setActiveSheetIndex(0); - $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Tab Code'); - $objPHPExcel->getActiveSheet()->setCellValue('B1', $MyTab['tabcode']); - $objPHPExcel->getActiveSheet()->setCellValue('A2', 'User Code'); - $objPHPExcel->getActiveSheet()->setCellValue('B2', $MyTab['usercode']); - $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Type of Tab'); - $objPHPExcel->getActiveSheet()->setCellValue('B3', $MyTab['typetabcode']); - $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Currency'); - $objPHPExcel->getActiveSheet()->setCellValue('B4', $MyTab['currency']); - $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Limit'); - $objPHPExcel->getActiveSheet()->setCellValue('B5', $MyTab['tablimit']); - $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Cash Assigner'); - $objPHPExcel->getActiveSheet()->setCellValue('B6', $MyTab['assigner']); - $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Authorizer - Cash'); - $objPHPExcel->getActiveSheet()->setCellValue('B7', $MyTab['authorizer']); - $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Authorizer - Expenses'); - $objPHPExcel->getActiveSheet()->setCellValue('B8', $MyTab['authorizerexpenses']); - - $objPHPExcel->getActiveSheet()->setCellValue('D1', 'From'); - $objPHPExcel->getActiveSheet()->setCellValue('E1', $FromDate); - $objPHPExcel->getActiveSheet()->setCellValue('D2', 'To'); - $objPHPExcel->getActiveSheet()->setCellValue('E2', $ToDate); - - $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date'); - $objPHPExcel->getActiveSheet()->setCellValue('B10', 'Expense Code'); - $objPHPExcel->getActiveSheet()->setCellValue('C10', 'Gross Amount'); - $objPHPExcel->getActiveSheet()->setCellValue('D10', 'Balance'); - $objPHPExcel->getActiveSheet()->setCellValue('E10', 'Tax'); - $objPHPExcel->getActiveSheet()->setCellValue('F10', 'Tax Group'); - $objPHPExcel->getActiveSheet()->setCellValue('G10', 'Tag'); - $objPHPExcel->getActiveSheet()->setCellValue('H10', 'Notes'); - $objPHPExcel->getActiveSheet()->setCellValue('I10', 'Date Authorized'); - - $objPHPExcel->getActiveSheet()->setCellValue('B11', 'Previous Balance'); - $objPHPExcel->getActiveSheet()->setCellValue('D11', $MyPreviousBalance['previous']); - - // Add data - $i = 12; - while ($MyRow = DB_fetch_array($Result)) { - - $SQLDes = "SELECT description - FROM pcexpenses - WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; - $ResultDes = DB_query($SQLDes); - $Description=DB_fetch_array($ResultDes); - if (!isset($Description[0])) { - $ExpenseCodeDes = 'ASSIGNCASH'; - } else { - $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; - } - - $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; - $TagResult = DB_query($TagSQL); - $TagRow = DB_fetch_array($TagResult); - if ($MyRow['tag'] == 0) { - $TagRow['tagdescription'] = _('None'); - } - $TagTo = $MyRow['tag']; - $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; - - $TaxesDescription = ''; - $TaxesTaxAmount = ''; - $TaxSQL = "SELECT counterindex, - pccashdetail, - calculationorder, - description, - taxauthid, - purchtaxglaccount, - taxontax, - taxrate, - amount - FROM pcashdetailtaxes - WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; - $TaxResult = DB_query($TaxSQL); - while ($MyTaxRow = DB_fetch_array($TaxResult)) { - $TaxesDescription .= $MyTaxRow['description']; - $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces); - } - - //Generate download link for expense receipt, or show text if no receipt file is found. - $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions - $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($TabToShow); //Receipts upload directory - $ReceiptFilePath = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. - if (empty($ReceiptFilePath)) { //If no receipt file for the expenses is found - $ReceiptText = _('No attachment'); - } else { - $ReceiptText = '' . _('Download attachment') . ''; - } - - if ($MyRow['authorized'] == '0000-00-00') { - $AuthorisedDate = _('Unauthorised'); - } else { - $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); - } - - $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, ConvertSQLDate($MyRow['date'])); - $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $ExpenseCodeDes); - $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, $MyRow['amount']); - $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=D'.($i-1).'+C'.$i.''); - $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, $TaxesTaxAmount); - $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, $TaxesDescription); - $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, $TagDescription); - $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, $MyRow['notes']); - $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, $AuthorisedDate); - - $i++; - } - - // Freeze panes - $objPHPExcel->getActiveSheet()->freezePane('A11'); - - // Auto Size columns - foreach(range('A','I') as $columnID) { - $objPHPExcel->getActiveSheet()->getColumnDimension($columnID) - ->setAutoSize(true); - } - - // Rename worksheet - $objPHPExcel->getActiveSheet()->setTitle($TabToShow); - // Set active sheet index to the first sheet, so Excel opens this as the first sheet - $objPHPExcel->setActiveSheetIndex(0); - - // Redirect output to a client’s web browser (Excel2007) - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - $File = 'ExpensesList-' . $TabToShow. '.xlsx'; - header('Content-Disposition: attachment;filename="' . $File . '"'); - header('Cache-Control: max-age=0'); - // If you're serving to IE 9, then the following may be needed - header('Cache-Control: max-age=1'); - - // If you're serving to IE over SSL, then the following may be needed - header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past - header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified - header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 - header ('Pragma: public'); // HTTP/1.0 - - $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); - $objWriter->save('php://output'); - - }else{ - $Title = _('Excel file for Petty Cash Tab Expenses List'); - include('includes/header.php'); - prnMsg('There is no data to analyse'); - include('includes/footer.php'); - } - } -} // End of function submit() - - -function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### -{ -// Display form fields. This function is called the first time -// the page is called. - $Title = _('Excel file for Petty Cash Tab Expenses List'); - $ViewTopic = 'PettyCash';// Filename's id in ManualContents.php's TOC. - $BookMark = 'top';// Anchor's id in the manual's html document. - - include('includes/header.php'); - - echo '
-
-
'; - echo ''; - - echo '

- ' . ' ' . _('Excel file for Petty Cash Tab Expenses List') . ' -

'; - - # Sets default date range for current month - if (!isset($_POST['FromDate'])){ - $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'], mktime(0,0,0,Date('m'),1,Date('Y'))); - } - if (!isset($_POST['ToDate'])){ - $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); - } - - echo ' - - - - '; - - echo ' - - - '; - - echo ' - - - - - -
' . _('For Petty Cash Tab') . ': -
' . _('Date Range') . ': - ' . _('To') . ':
 
 
-
'; - echo '
-
'; - include('includes/footer.php'); - -} // End of function display() - -function beginning_of_month($Date){ - $Date2 = explode("-",$Date); - $M = $Date2[1]; - $Y = $Date2[0]; - $FirstOfMonth = $Y . '-' . $M . '-01'; - return $FirstOfMonth; -} - += '" . FormatDateForSQL($FromDate) . "' + AND pcashdetails.date <= '" . FormatDateForSQL($ToDate) . "' + ORDER BY pcashdetails.date, + pcashdetails.counterindex"; + $Result = DB_query($SQL); + + if (DB_num_rows($Result) != 0){ + + // Create new PHPExcel object + $objPHPExcel = new PHPExcel(); + + // Set document properties + $objPHPExcel->getProperties()->setCreator("webERP") + ->setLastModifiedBy("webERP") + ->setTitle("PC Tab Expenses List") + ->setSubject("PC Tab Expenses List") + ->setDescription("PC Tab Expenses List") + ->setKeywords("") + ->setCategory(""); + + // Formatting + + $objPHPExcel->getActiveSheet()->getStyle('A')->getAlignment()->setWrapText(true); + $objPHPExcel->getActiveSheet()->getStyle('A')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + $objPHPExcel->getActiveSheet()->getStyle('B5')->getNumberFormat()->setFormatCode('#,##0.00'); + $objPHPExcel->getActiveSheet()->getStyle('C:E')->getNumberFormat()->setFormatCode('#,##0.00'); + $objPHPExcel->getActiveSheet()->getStyle('E1:E2')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + $objPHPExcel->getActiveSheet()->getStyle('I')->getNumberFormat()->setFormatCode('dd/mm/yyyy'); + $objPHPExcel->getActiveSheet()->getStyle('A:I')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); + $objPHPExcel->getActiveSheet()->getStyle('10')->getFont()->setBold(true); + $objPHPExcel->getActiveSheet()->getStyle('A1:A8')->getFont()->setBold(true); + $objPHPExcel->getActiveSheet()->getStyle('D1:D2')->getFont()->setBold(true); + + // Add title data + $objPHPExcel->setActiveSheetIndex(0); + $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Tab Code'); + $objPHPExcel->getActiveSheet()->setCellValue('B1', $MyTab['tabcode']); + $objPHPExcel->getActiveSheet()->setCellValue('A2', 'User Code'); + $objPHPExcel->getActiveSheet()->setCellValue('B2', $MyTab['usercode']); + $objPHPExcel->getActiveSheet()->setCellValue('A3', 'Type of Tab'); + $objPHPExcel->getActiveSheet()->setCellValue('B3', $MyTab['typetabcode']); + $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Currency'); + $objPHPExcel->getActiveSheet()->setCellValue('B4', $MyTab['currency']); + $objPHPExcel->getActiveSheet()->setCellValue('A5', 'Limit'); + $objPHPExcel->getActiveSheet()->setCellValue('B5', $MyTab['tablimit']); + $objPHPExcel->getActiveSheet()->setCellValue('A6', 'Cash Assigner'); + $objPHPExcel->getActiveSheet()->setCellValue('B6', $MyTab['assigner']); + $objPHPExcel->getActiveSheet()->setCellValue('A7', 'Authorizer - Cash'); + $objPHPExcel->getActiveSheet()->setCellValue('B7', $MyTab['authorizer']); + $objPHPExcel->getActiveSheet()->setCellValue('A8', 'Authorizer - Expenses'); + $objPHPExcel->getActiveSheet()->setCellValue('B8', $MyTab['authorizerexpenses']); + + $objPHPExcel->getActiveSheet()->setCellValue('D1', 'From'); + $objPHPExcel->getActiveSheet()->setCellValue('E1', $FromDate); + $objPHPExcel->getActiveSheet()->setCellValue('D2', 'To'); + $objPHPExcel->getActiveSheet()->setCellValue('E2', $ToDate); + + $objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date'); + $objPHPExcel->getActiveSheet()->setCellValue('B10', 'Expense Code'); + $objPHPExcel->getActiveSheet()->setCellValue('C10', 'Gross Amount'); + $objPHPExcel->getActiveSheet()->setCellValue('D10', 'Balance'); + $objPHPExcel->getActiveSheet()->setCellValue('E10', 'Tax'); + $objPHPExcel->getActiveSheet()->setCellValue('F10', 'Tax Group'); + $objPHPExcel->getActiveSheet()->setCellValue('G10', 'Tag'); + $objPHPExcel->getActiveSheet()->setCellValue('H10', 'Notes'); + $objPHPExcel->getActiveSheet()->setCellValue('I10', 'Date Authorized'); + + $objPHPExcel->getActiveSheet()->setCellValue('B11', 'Previous Balance'); + $objPHPExcel->getActiveSheet()->setCellValue('D11', $MyPreviousBalance['previous']); + + // Add data + $i = 12; + while ($MyRow = DB_fetch_array($Result)) { + + $SQLDes = "SELECT description + FROM pcexpenses + WHERE codeexpense = '" . $MyRow['codeexpense'] . "'"; + $ResultDes = DB_query($SQLDes); + $Description=DB_fetch_array($ResultDes); + if (!isset($Description[0])) { + $ExpenseCodeDes = 'ASSIGNCASH'; + } else { + $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0]; + } + + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['tag'] . "'"; + $TagResult = DB_query($TagSQL); + $TagRow = DB_fetch_array($TagResult); + if ($MyRow['tag'] == 0) { + $TagRow['tagdescription'] = _('None'); + } + $TagTo = $MyRow['tag']; + $TagDescription = $TagTo . ' - ' . $TagRow['tagdescription']; + + $TaxesDescription = ''; + $TaxesTaxAmount = ''; + $TaxSQL = "SELECT counterindex, + pccashdetail, + calculationorder, + description, + taxauthid, + purchtaxglaccount, + taxontax, + taxrate, + amount + FROM pcashdetailtaxes + WHERE pccashdetail='" . $MyRow['counterindex'] . "'"; + $TaxResult = DB_query($TaxSQL); + while ($MyTaxRow = DB_fetch_array($TaxResult)) { + $TaxesDescription .= $MyTaxRow['description']; + $TaxesTaxAmount .= locale_number_format($MyTaxRow['amount'], $CurrDecimalPlaces); + } + + //Generate download link for expense receipt, or show text if no receipt file is found. + $ReceiptSupportedExt = array('png','jpg','jpeg','pdf','doc','docx','xls','xlsx'); //Supported file extensions + $ReceiptFileDir = $PathPrefix . 'companies/' . $_SESSION['DatabaseName'] . '/expenses_receipts/' . mb_strtolower($TabToShow); //Receipts upload directory + $ReceiptFilePath = reset(glob($ReceiptFileDir . '/' . $MyRow['counterindex'] . '.{' . implode(',', $ReceiptSupportedExt) . '}', GLOB_BRACE)); //Find the relevant receipt file for the expense. There should only be one (file type), but limit to one result just in case. + if (empty($ReceiptFilePath)) { //If no receipt file for the expenses is found + $ReceiptText = _('No attachment'); + } else { + $ReceiptText = '' . _('Download attachment') . ''; + } + + if ($MyRow['authorized'] == '0000-00-00') { + $AuthorisedDate = _('Unauthorised'); + } else { + $AuthorisedDate = ConvertSQLDate($MyRow['authorized']); + } + + $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, ConvertSQLDate($MyRow['date'])); + $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $ExpenseCodeDes); + $objPHPExcel->getActiveSheet()->setCellValue('C'.$i, $MyRow['amount']); + $objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=D'.($i-1).'+C'.$i.''); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, $TaxesTaxAmount); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, $TaxesDescription); + $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, $TagDescription); + $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, $MyRow['notes']); + $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, $AuthorisedDate); + + $i++; + } + + // Freeze panes + $objPHPExcel->getActiveSheet()->freezePane('A11'); + + // Auto Size columns + foreach(range('A','I') as $columnID) { + $objPHPExcel->getActiveSheet()->getColumnDimension($columnID) + ->setAutoSize(true); + } + + // Rename worksheet + $objPHPExcel->getActiveSheet()->setTitle($TabToShow); + // Set active sheet index to the first sheet, so Excel opens this as the first sheet + $objPHPExcel->setActiveSheetIndex(0); + + // Redirect output to a client’s web browser (Excel2007) + header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); + $File = 'ExpensesList-' . $TabToShow. '.xlsx'; + header('Content-Disposition: attachment;filename="' . $File . '"'); + header('Cache-Control: max-age=0'); + // If you're serving to IE 9, then the following may be needed + header('Cache-Control: max-age=1'); + + // If you're serving to IE over SSL, then the following may be needed + header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified + header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 + header ('Pragma: public'); // HTTP/1.0 + + $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); + $objWriter->save('php://output'); + + }else{ + $Title = _('Excel file for Petty Cash Tab Expenses List'); + include('includes/header.php'); + prnMsg('There is no data to analyse'); + include('includes/footer.php'); + } + } +} // End of function submit() + + +function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### +{ +// Display form fields. This function is called the first time +// the page is called. + $Title = _('Excel file for Petty Cash Tab Expenses List'); + $ViewTopic = 'PettyCash';// Filename's id in ManualContents.php's TOC. + $BookMark = 'top';// Anchor's id in the manual's html document. + + include('includes/header.php'); + + echo '
+
+
'; + echo ''; + + echo '

+ ' . ' ' . _('Excel file for Petty Cash Tab Expenses List') . ' +

'; + + # Sets default date range for current month + if (!isset($_POST['FromDate'])){ + $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'], mktime(0,0,0,Date('m'),1,Date('Y'))); + } + if (!isset($_POST['ToDate'])){ + $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']); + } + + echo ' + + + + '; + + echo ' + + + '; + + echo ' + + + + + +
' . _('For Petty Cash Tab') . ': +
' . _('Date Range') . ': + ' . _('To') . ':
 
 
+
'; + echo '
+
'; + include('includes/footer.php'); + +} // End of function display() + +function beginning_of_month($Date){ + $Date2 = explode("-",$Date); + $M = $Date2[1]; + $Y = $Date2[0]; + $FirstOfMonth = $Y . '-' . $M . '-01'; + return $FirstOfMonth; +} + ?> \ No newline at end of file diff --git a/PcTabs.php b/PcTabs.php index a1dc2fc6a..2a868b8fc 100644 --- a/PcTabs.php +++ b/PcTabs.php @@ -1,480 +1,474 @@ - - ', ' ', $Title, ' -

'; -if (isset($_POST['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_POST['SelectedTab']); -} elseif (isset($_GET['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_GET['SelectedTab']); -} -if (isset($_POST['Cancel'])) { - unset($SelectedTab); - unset($_POST['TabCode']); - unset($_POST['SelectUser']); - unset($_POST['SelectTabs']); - unset($_POST['SelectCurrency']); - unset($_POST['TabLimit']); - unset($_POST['SelectAssigner']); - unset($_POST['SelectAuthoriserCash']); - unset($_POST['SelectAuthoriserExpenses']); - unset($_POST['GLAccountCash']); - unset($_POST['GLAccountPcashTab']); -} -if (isset($_POST['Submit'])) { - //initialise no input errors assumed initially before we test - $InputError = 0; - /* actions to take once the user has clicked the submit button - ie the page has called itself with some user input */ - //first off validate inputs sensible - if ($_POST['TabCode'] == '' or $_POST['TabCode'] == ' ' or $_POST['TabCode'] == ' ') { - $InputError = 1; - prnMsg('
' . _('The Tab code cannot be an empty string or spaces'), 'error'); - } elseif (mb_strlen($_POST['TabCode']) > 20) { - $InputError = 1; - echo prnMsg(_('The Tab code must be twenty characters or less long'), 'error'); - } elseif (($_POST['SelectUser']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a User for this tab'), 'error'); - } elseif (($_POST['SelectTabs']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a type of tab from the list'), 'error'); - } elseif (($_POST['SelectAssigner']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a User to assign cash to this tab'), 'error'); - } elseif (($_POST['SelectAuthoriserCash']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a User to authorise this tab'), 'error'); - } elseif (($_POST['GLAccountCash']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'), 'error'); - } elseif (($_POST['GLAccountPcashTab']) == '') { - $InputError = 1; - echo prnMsg(_('You must select a General ledger code for this petty cash tab'), 'error'); - } elseif (($_POST['TaxGroup']) === '0') { - $InputError = 1; - echo prnMsg(_('You must select a tax group'), 'error'); - } - if (isset($SelectedTab) and $InputError != 1) { - $SQL = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', - typetabcode = '" . $_POST['SelectTabs'] . "', - currency = '" . $_POST['SelectCurrency'] . "', - tablimit = '" . filter_number_format($_POST['TabLimit']) . "', - assigner = '" . $_POST['SelectAssigner'] . "', - authorizer = '" . $_POST['SelectAuthoriserCash'] . "', - authorizerexpenses = '" . $_POST['SelectAuthoriserExpenses'] . "', - glaccountassignment = '" . $_POST['GLAccountCash'] . "', - glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "', - defaulttag = '" . $_POST['DefaultTag'] . "', - taxgroupid='" . $_POST['TaxGroup'] . "' - WHERE tabcode = '" . $SelectedTab . "'"; - $Msg = _('The Petty Cash Tab') . ' ' . $SelectedTab . ' ' . _('has been updated'); - } elseif ($InputError != 1) { - // First check the type is not being duplicated - $CheckSQL = "SELECT count(*) - FROM pctabs - WHERE tabcode = '" . $_POST['TabCode'] . "'"; - $CheckResult = DB_query($CheckSQL); - $CheckRow = DB_fetch_row($CheckResult); - if ($CheckRow[0] > 0) { - $InputError = 1; - prnMsg(_('The Tab ') . ' ' . $_POST['TabCode'] . ' ' . _(' already exists'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO pctabs (tabcode, - usercode, - typetabcode, - currency, - tablimit, - assigner, - authorizer, - authorizerexpenses, - glaccountassignment, - glaccountpcash, - defaulttag, - taxgroupid) - VALUES ('" . $_POST['TabCode'] . "', - '" . $_POST['SelectUser'] . "', - '" . $_POST['SelectTabs'] . "', - '" . $_POST['SelectCurrency'] . "', - '" . filter_number_format($_POST['TabLimit']) . "', - '" . $_POST['SelectAssigner'] . "', - '" . $_POST['SelectAuthoriserCash'] . "', - '" . $_POST['SelectAuthoriserExpenses'] . "', - '" . $_POST['GLAccountCash'] . "', - '" . $_POST['GLAccountPcashTab'] . "', - '" . $_POST['DefaultTag'] . "', - '" . $_POST['TaxGroup'] . "' - )"; - $Msg = _('The Petty Cash Tab') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); - } - } - if ($InputError != 1) { - //run the SQL from either of the above possibilites - $Result = DB_query($SQL); - prnMsg($Msg, 'success'); - unset($SelectedTab); - unset($_POST['SelectUser']); - unset($_POST['TabCode']); - unset($_POST['SelectTabs']); - unset($_POST['SelectCurrency']); - unset($_POST['TabLimit']); - unset($_POST['SelectAssigner']); - unset($_POST['SelectAuthoriserCash']); - unset($_POST['GLAccountCash']); - unset($_POST['GLAccountPcashTab']); - unset($_POST['TaxGroup']); - } -} elseif (isset($_GET['delete'])) { - $SQL = "DELETE FROM pctabs WHERE tabcode='" . $SelectedTab . "'"; - $ErrMsg = _('The Tab record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('The Petty Cash Tab') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); - unset($SelectedTab); - unset($_GET['delete']); -} -if (!isset($SelectedTab)) { - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTab will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - $SQL = "SELECT tabcode, - usercode, - typetabdescription, - currabrev, - tablimit, - assigner, - authorizer, - authorizerexpenses, - glaccountassignment, - glaccountpcash, - defaulttag, - currencies.decimalplaces, - chartmaster1.accountname AS glactassigntname, - chartmaster2.accountname AS glactpcashname, - taxgroupdescription - FROM pctabs - INNER JOIN currencies - ON pctabs.currency=currencies.currabrev - INNER JOIN pctypetabs - ON pctabs.typetabcode=pctypetabs.typetabcode - INNER JOIN chartmaster AS chartmaster1 ON - pctabs.glaccountassignment = chartmaster1.accountcode - INNER JOIN chartmaster AS chartmaster2 ON - pctabs.glaccountpcash = chartmaster2.accountcode - INNER JOIN taxgroups - ON pctabs.taxgroupid=taxgroups.taxgroupid - ORDER BY tabcode"; - $Result = DB_query($SQL); - if (DB_num_rows($Result) > 0) { - echo ' - - - - - - - - - - - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['defaulttag'] . "'"; - $TagResult = DB_query($TagSQL); - $TagRow = DB_fetch_array($TagResult); - echo ' - - - - - - - - - - - - - - '; - } - //END WHILE LIST LOOP - echo '
', _('Tab Code'), '', _('User Name'), '', _('Type Of Tab'), '', _('Currency'), '', _('Limit'), '', _('Cash Assigner'), '', _('Authoriser - Cash'), '', _('Authoriser - Expenses'), '', _('GL Account For Cash Assignment'), '', _('GL Account Petty Cash Tab'), '', _('Default Tag'), '', _('Tax Group'), '
', $MyRow['tabcode'], '', $MyRow['usercode'], '', $MyRow['typetabdescription'], '', $MyRow['currabrev'], '', locale_number_format($MyRow['tablimit'], $MyRow['decimalplaces']), '', $MyRow['assigner'], '', $MyRow['authorizer'], '', $MyRow['authorizerexpenses'], '', $MyRow['glaccountassignment'] . ' - ' . $MyRow['glactassigntname'], '', $MyRow['glaccountpcash'] . ' - ' . $MyRow['glactpcashname'], '', $TagRow['tagdescription'], '', $MyRow['taxgroupdescription'], '' . _('Edit') . '' . _('Delete') . '
'; - } //if there are tabs to show -} -//end of ifs and buts! -if (isset($SelectedTab)) { - echo ''; -} -if (!isset($_GET['delete'])) { - echo '
'; - echo ''; - if (isset($SelectedTab) and $SelectedTab != '') { - $SQL = "SELECT tabcode, - usercode, - typetabcode, - currency, - tablimit, - assigner, - authorizer, - authorizerexpenses, - glaccountassignment, - glaccountpcash, - defaulttag, - taxgroupid - FROM pctabs - WHERE tabcode='" . $SelectedTab . "'"; - $Result = DB_query($SQL); - $MyRow = DB_fetch_array($Result); - $_POST['TabCode'] = $MyRow['tabcode']; - $_POST['SelectUser'] = $MyRow['usercode']; - $_POST['SelectTabs'] = $MyRow['typetabcode']; - $_POST['SelectCurrency'] = $MyRow['currency']; - $_POST['TabLimit'] = locale_number_format($MyRow['tablimit']); - $_POST['SelectAssigner'] = $MyRow['assigner']; - $_POST['SelectAuthoriserCash'] = $MyRow['authorizer']; - $_POST['SelectAuthoriserExpenses'] = $MyRow['authorizerexpenses']; - $_POST['GLAccountCash'] = $MyRow['glaccountassignment']; - $_POST['GLAccountPcashTab'] = $MyRow['glaccountpcash']; - $_POST['DefaultTag'] = $MyRow['defaulttag']; - $_POST['TaxGroup'] = $MyRow['taxgroupid']; - echo ''; - echo ''; - echo ' - - - - '; - } else { - // This is a new type so the user may volunteer a type code - echo '
', _('Tab Code'), ':', $_POST['TabCode'], '
- - - - '; - } - if (!isset($_POST['typetabdescription'])) { - $_POST['typetabdescription'] = ''; - } - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - if (!isset($_POST['TabLimit'])) { - $_POST['TabLimit'] = 0; - } - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - //Select the tag - $SQL = "SELECT tagref, - tagdescription - FROM tags - ORDER BY tagref"; - $Result = DB_query($SQL); - echo ' - - - '; - // End select tag - $SQL = "SELECT taxgroupid, - taxgroupdescription - FROM taxgroups - ORDER BY taxgroupdescription"; - $Result = DB_query($SQL); - echo ' - - - '; - // End select tag - echo '
', _('Tab Code'), ':
', _('User Name'), ': -
', _('Type Of Tab'), ': -
', _('Currency'), ': -
', _('Limit Of Tab'), ': - -
', _('Cash Assigner'), ': -
', _('Authoriser - Cash'), ': -
', _('Authoriser - Expenses'), ': -
', _('GL Account Cash Assignment'), ': -
', _('GL Account Petty Cash Tab'), ': -
', _('Default Tag'), ': -
', _('Tax Group'), ': -
'; // close main table - echo '
- - -
'; - echo '
'; -} // end if user wish to delete -include('includes/footer.php'); + + ', ' ', $Title, ' +

'; +if (isset($_POST['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_GET['SelectedTab']); +} +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($_POST['TabCode']); + unset($_POST['SelectUser']); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAssigner']); + unset($_POST['SelectAuthoriserCash']); + unset($_POST['SelectAuthoriserExpenses']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); +} +if (isset($_POST['Submit'])) { + //initialise no input errors assumed initially before we test + $InputError = 0; + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + //first off validate inputs sensible + if ($_POST['TabCode'] == '' or $_POST['TabCode'] == ' ' or $_POST['TabCode'] == ' ') { + $InputError = 1; + prnMsg('
' . _('The Tab code cannot be an empty string or spaces'), 'error'); + } elseif (mb_strlen($_POST['TabCode']) > 20) { + $InputError = 1; + echo prnMsg(_('The Tab code must be twenty characters or less long'), 'error'); + } elseif (($_POST['SelectUser']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a User for this tab'), 'error'); + } elseif (($_POST['SelectTabs']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a type of tab from the list'), 'error'); + } elseif (($_POST['SelectAssigner']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a User to assign cash to this tab'), 'error'); + } elseif (($_POST['SelectAuthoriserCash']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a User to authorise this tab'), 'error'); + } elseif (($_POST['GLAccountCash']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'), 'error'); + } elseif (($_POST['GLAccountPcashTab']) == '') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for this petty cash tab'), 'error'); + } elseif (($_POST['TaxGroup']) === '0') { + $InputError = 1; + echo prnMsg(_('You must select a tax group'), 'error'); + } + if (isset($SelectedTab) and $InputError != 1) { + $SQL = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', + typetabcode = '" . $_POST['SelectTabs'] . "', + currency = '" . $_POST['SelectCurrency'] . "', + tablimit = '" . filter_number_format($_POST['TabLimit']) . "', + assigner = '" . $_POST['SelectAssigner'] . "', + authorizer = '" . $_POST['SelectAuthoriserCash'] . "', + authorizerexpenses = '" . $_POST['SelectAuthoriserExpenses'] . "', + glaccountassignment = '" . $_POST['GLAccountCash'] . "', + glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "', + defaulttag = '" . $_POST['DefaultTag'] . "', + taxgroupid='" . $_POST['TaxGroup'] . "' + WHERE tabcode = '" . $SelectedTab . "'"; + $Msg = _('The Petty Cash Tab') . ' ' . $SelectedTab . ' ' . _('has been updated'); + } elseif ($InputError != 1) { + // First check the type is not being duplicated + $CheckSQL = "SELECT count(*) + FROM pctabs + WHERE tabcode = '" . $_POST['TabCode'] . "'"; + $CheckResult = DB_query($CheckSQL); + $CheckRow = DB_fetch_row($CheckResult); + if ($CheckRow[0] > 0) { + $InputError = 1; + prnMsg(_('The Tab ') . ' ' . $_POST['TabCode'] . ' ' . _(' already exists'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO pctabs (tabcode, + usercode, + typetabcode, + currency, + tablimit, + assigner, + authorizer, + authorizerexpenses, + glaccountassignment, + glaccountpcash, + defaulttag, + taxgroupid) + VALUES ('" . $_POST['TabCode'] . "', + '" . $_POST['SelectUser'] . "', + '" . $_POST['SelectTabs'] . "', + '" . $_POST['SelectCurrency'] . "', + '" . filter_number_format($_POST['TabLimit']) . "', + '" . $_POST['SelectAssigner'] . "', + '" . $_POST['SelectAuthoriserCash'] . "', + '" . $_POST['SelectAuthoriserExpenses'] . "', + '" . $_POST['GLAccountCash'] . "', + '" . $_POST['GLAccountPcashTab'] . "', + '" . $_POST['DefaultTag'] . "', + '" . $_POST['TaxGroup'] . "' + )"; + $Msg = _('The Petty Cash Tab') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); + } + } + if ($InputError != 1) { + //run the SQL from either of the above possibilites + $Result = DB_query($SQL); + prnMsg($Msg, 'success'); + unset($SelectedTab); + unset($_POST['SelectUser']); + unset($_POST['TabCode']); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAssigner']); + unset($_POST['SelectAuthoriserCash']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); + unset($_POST['TaxGroup']); + } +} elseif (isset($_GET['delete'])) { + $SQL = "DELETE FROM pctabs WHERE tabcode='" . $SelectedTab . "'"; + $ErrMsg = _('The Tab record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('The Petty Cash Tab') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); + unset($SelectedTab); + unset($_GET['delete']); +} +if (!isset($SelectedTab)) { + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTab will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + $SQL = "SELECT tabcode, + usercode, + typetabdescription, + currabrev, + tablimit, + assigner, + authorizer, + authorizerexpenses, + glaccountassignment, + glaccountpcash, + defaulttag, + currencies.decimalplaces, + chartmaster1.accountname AS glactassigntname, + chartmaster2.accountname AS glactpcashname, + taxgroupdescription + FROM pctabs + INNER JOIN currencies + ON pctabs.currency=currencies.currabrev + INNER JOIN pctypetabs + ON pctabs.typetabcode=pctypetabs.typetabcode + INNER JOIN chartmaster AS chartmaster1 ON + pctabs.glaccountassignment = chartmaster1.accountcode + INNER JOIN chartmaster AS chartmaster2 ON + pctabs.glaccountpcash = chartmaster2.accountcode + INNER JOIN taxgroups + ON pctabs.taxgroupid=taxgroups.taxgroupid + ORDER BY tabcode"; + $Result = DB_query($SQL); + if (DB_num_rows($Result) > 0) { + echo ' + + + + + + + + + + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + $TagSQL = "SELECT tagdescription FROM tags WHERE tagref='" . $MyRow['defaulttag'] . "'"; + $TagResult = DB_query($TagSQL); + $TagRow = DB_fetch_array($TagResult); + echo ' + + + + + + + + + + + + + + + '; + } + //END WHILE LIST LOOP + echo '
', _('Tab Code'), '', _('User Name'), '', _('Type Of Tab'), '', _('Currency'), '', _('Limit'), '', _('Cash Assigner'), '', _('Authoriser - Cash'), '', _('Authoriser - Expenses'), '', _('GL Account For Cash Assignment'), '', _('GL Account Petty Cash Tab'), '', _('Default Tag'), '', _('Tax Group'), '
', $MyRow['tabcode'], '', $MyRow['usercode'], '', $MyRow['typetabdescription'], '', $MyRow['currabrev'], '', locale_number_format($MyRow['tablimit'], $MyRow['decimalplaces']), '', $MyRow['assigner'], '', $MyRow['authorizer'], '', $MyRow['authorizerexpenses'], '', $MyRow['glaccountassignment'] . ' - ' . $MyRow['glactassigntname'], '', $MyRow['glaccountpcash'] . ' - ' . $MyRow['glactpcashname'], '', $TagRow['tagdescription'], '', $MyRow['taxgroupdescription'], '' . _('Edit') . '' . _('Delete') . '
'; + } //if there are tabs to show +} +//end of ifs and buts! +if (isset($SelectedTab)) { + echo ''; +} +if (!isset($_GET['delete'])) { + echo '
'; + echo ''; + if (isset($SelectedTab) and $SelectedTab != '') { + $SQL = "SELECT tabcode, + usercode, + typetabcode, + currency, + tablimit, + assigner, + authorizer, + authorizerexpenses, + glaccountassignment, + glaccountpcash, + defaulttag, + taxgroupid + FROM pctabs + WHERE tabcode='" . $SelectedTab . "'"; + $Result = DB_query($SQL); + $MyRow = DB_fetch_array($Result); + $_POST['TabCode'] = $MyRow['tabcode']; + $_POST['SelectUser'] = $MyRow['usercode']; + $_POST['SelectTabs'] = $MyRow['typetabcode']; + $_POST['SelectCurrency'] = $MyRow['currency']; + $_POST['TabLimit'] = locale_number_format($MyRow['tablimit']); + $_POST['SelectAssigner'] = $MyRow['assigner']; + $_POST['SelectAuthoriserCash'] = $MyRow['authorizer']; + $_POST['SelectAuthoriserExpenses'] = $MyRow['authorizerexpenses']; + $_POST['GLAccountCash'] = $MyRow['glaccountassignment']; + $_POST['GLAccountPcashTab'] = $MyRow['glaccountpcash']; + $_POST['DefaultTag'] = $MyRow['defaulttag']; + $_POST['TaxGroup'] = $MyRow['taxgroupid']; + echo ''; + echo ''; + echo ' + + + + '; + } else { + // This is a new type so the user may volunteer a type code + echo '
', _('Tab Code'), ':', $_POST['TabCode'], '
+ + + + '; + } + if (!isset($_POST['typetabdescription'])) { + $_POST['typetabdescription'] = ''; + } + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + if (!isset($_POST['TabLimit'])) { + $_POST['TabLimit'] = 0; + } + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + //Select the tag + $SQL = "SELECT tagref, + tagdescription + FROM tags + ORDER BY tagref"; + $Result = DB_query($SQL); + echo ' + + + '; + // End select tag + $SQL = "SELECT taxgroupid, + taxgroupdescription + FROM taxgroups + ORDER BY taxgroupdescription"; + $Result = DB_query($SQL); + echo ' + + + '; + // End select tag + echo '
', _('Tab Code'), ':
', _('User Name'), ': +
', _('Type Of Tab'), ': +
', _('Currency'), ': +
', _('Limit Of Tab'), ': + +
', _('Cash Assigner'), ': +
', _('Authoriser - Cash'), ': +
', _('Authoriser - Expenses'), ': +
', _('GL Account Cash Assignment'), ': +
', _('GL Account Petty Cash Tab'), ': +
', _('Default Tag'), ': +
', _('Tax Group'), ': +
'; // close main table + echo '
+ + +
'; + echo '
'; +} // end if user wish to delete +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PcTypeTabs.php b/PcTypeTabs.php index 44fab7f33..fff3787e4 100644 --- a/PcTypeTabs.php +++ b/PcTypeTabs.php @@ -1,182 +1,176 @@ - - ', ' ', $Title, ' -

'; -if (isset($_POST['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_POST['SelectedTab']); -} elseif (isset($_GET['SelectedTab'])) { - $SelectedTab = mb_strtoupper($_GET['SelectedTab']); -} -if (isset($_POST['submit'])) { - /* 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 - $InputError = 0; - if ($_POST['TypeTabCode'] == '') { - $InputError = 1; - prnMsg(_('The Tabs type code cannot be an empty string'), 'error'); - } elseif (mb_strlen($_POST['TypeTabCode']) > 20) { - $InputError = 1; - echo prnMsg(_('The tab code must be twenty characters or less long'), 'error'); - } elseif (ContainsIllegalCharacters($_POST['TypeTabCode']) or mb_strpos($_POST['TypeTabCode'], ' ') > 0) { - $InputError = 1; - prnMsg(_('The petty cash tab type code cannot contain any of the illegal characters'), 'error'); - } elseif (mb_strlen($_POST['TypeTabDescription']) > 50) { - $InputError = 1; - echo prnMsg(_('The tab code must be Fifty characters or less long'), 'error'); - } - if (isset($SelectedTab) and $InputError != 1) { - $SQL = "UPDATE pctypetabs - SET typetabdescription = '" . $_POST['TypeTabDescription'] . "' - WHERE typetabcode = '" . $SelectedTab . "'"; - $Msg = _('The Tabs type') . ' ' . $SelectedTab . ' ' . _('has been updated'); - } elseif ($InputError != 1) { - // First check the type is not being duplicated - $checkSql = "SELECT count(*) - FROM pctypetabs - WHERE typetabcode = '" . $_POST['TypeTabCode'] . "'"; - $checkresult = DB_query($checkSql); - $checkrow = DB_fetch_row($checkresult); - if ($checkrow[0] > 0) { - $InputError = 1; - prnMsg(_('The Tab type ') . $_POST['TypeAbbrev'] . _(' already exist.'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO pctypetabs - (typetabcode, - typetabdescription) - VALUES ('" . $_POST['TypeTabCode'] . "', - '" . $_POST['TypeTabDescription'] . "')"; - $Msg = _('Tabs type') . ' ' . $_POST['TypeTabCode'] . ' ' . _('has been created'); - } - } - if ($InputError != 1) { - //run the SQL from either of the above possibilites - $Result = DB_query($SQL); - prnMsg($Msg, 'success'); - echo '
'; - unset($SelectedTab); - unset($_POST['TypeTabCode']); - unset($_POST['TypeTabDescription']); - } -} elseif (isset($_GET['delete'])) { - // PREVENT DELETES IF DEPENDENT RECORDS IN 'PcTabExpenses' - $SQLPcTabExpenses = "SELECT COUNT(*) - FROM pctabexpenses - WHERE typetabcode='" . $SelectedTab . "'"; - $ErrMsg = _('The number of tabs using this Tab type could not be retrieved'); - $ResultPcTabExpenses = DB_query($SQLPcTabExpenses, $ErrMsg); - $MyRowPcTabExpenses = DB_fetch_row($ResultPcTabExpenses); - $SqlPcTabs = "SELECT COUNT(*) - FROM pctabs - WHERE typetabcode='" . $SelectedTab . "'"; - $ErrMsg = _('The number of tabs using this Tab type could not be retrieved'); - $ResultPcTabs = DB_query($SqlPcTabs, $ErrMsg); - $MyRowPcTabs = DB_fetch_row($ResultPcTabs); - if ($MyRowPcTabExpenses[0] > 0 or $MyRowPcTabs[0] > 0) { - prnMsg(_('Cannot delete this tab type because tabs have been created using this tab type'), 'error'); - echo '
'; - echo ''; - echo '
'; - echo '
'; - include('includes/footer.php'); - exit; - } else { - $SQL = "DELETE FROM pctypetabs WHERE typetabcode='" . $SelectedTab . "'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('Tab type') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); - unset($SelectedTab); - unset($_GET['delete']); - } //end if tab type used in transactions -} -if (!isset($SelectedTab)) { - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTab will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true and the list of sales types will be displayed with - links to delete or edit each. These will call the same page again and allow update/input - or deletion of the records*/ - $SQL = "SELECT typetabcode, - typetabdescription - FROM pctypetabs"; - $Result = DB_query($SQL); - echo ' - - - - '; - $k = 0; //row colour counter - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' - - - - '; - } - //END WHILE LIST LOOP - echo '
', _('Type Of Tab'), '', _('Description'), '
', $MyRow['typetabcode'], '', $MyRow['typetabdescription'], '' . _('Edit') . '' . _('Delete') . '
'; -} -//end of ifs and buts! -if (isset($SelectedTab)) { - echo ''; -} -if (!isset($_GET['delete'])) { - echo '
'; - echo ''; - if (isset($SelectedTab) and $SelectedTab != '') { - $SQL = "SELECT typetabcode, - typetabdescription - FROM pctypetabs - WHERE typetabcode='" . $SelectedTab . "'"; - $Result = DB_query($SQL); - $MyRow = DB_fetch_array($Result); - $_POST['TypeTabCode'] = $MyRow['typetabcode']; - $_POST['TypeTabDescription'] = $MyRow['typetabdescription']; - echo ' - - - - - - '; - // We dont allow the user to change an existing type code - } else { - // This is a new type so the user may volunteer a type code - echo '
', _('Code Of Type Of Tab'), ':', $_POST['TypeTabCode'], '
- - - - '; - } - if (!isset($_POST['TypeTabDescription'])) { - $_POST['TypeTabDescription'] = ''; - } - echo ' - - - '; - echo '
', _('Code Of Type Of Tab'), ':
', _('Description Of Type of Tab'), ':
'; // close main table - echo '
- - -
-
'; -} // end if user wish to delete -include('includes/footer.php'); + + ', ' ', $Title, ' +

'; +if (isset($_POST['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])) { + $SelectedTab = mb_strtoupper($_GET['SelectedTab']); +} +if (isset($_POST['submit'])) { + /* 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 + $InputError = 0; + if ($_POST['TypeTabCode'] == '') { + $InputError = 1; + prnMsg(_('The Tabs type code cannot be an empty string'), 'error'); + } elseif (mb_strlen($_POST['TypeTabCode']) > 20) { + $InputError = 1; + echo prnMsg(_('The tab code must be twenty characters or less long'), 'error'); + } elseif (ContainsIllegalCharacters($_POST['TypeTabCode']) or mb_strpos($_POST['TypeTabCode'], ' ') > 0) { + $InputError = 1; + prnMsg(_('The petty cash tab type code cannot contain any of the illegal characters'), 'error'); + } elseif (mb_strlen($_POST['TypeTabDescription']) > 50) { + $InputError = 1; + echo prnMsg(_('The tab code must be Fifty characters or less long'), 'error'); + } + if (isset($SelectedTab) and $InputError != 1) { + $SQL = "UPDATE pctypetabs + SET typetabdescription = '" . $_POST['TypeTabDescription'] . "' + WHERE typetabcode = '" . $SelectedTab . "'"; + $Msg = _('The Tabs type') . ' ' . $SelectedTab . ' ' . _('has been updated'); + } elseif ($InputError != 1) { + // First check the type is not being duplicated + $checkSql = "SELECT count(*) + FROM pctypetabs + WHERE typetabcode = '" . $_POST['TypeTabCode'] . "'"; + $checkresult = DB_query($checkSql); + $checkrow = DB_fetch_row($checkresult); + if ($checkrow[0] > 0) { + $InputError = 1; + prnMsg(_('The Tab type ') . $_POST['TypeAbbrev'] . _(' already exist.'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO pctypetabs + (typetabcode, + typetabdescription) + VALUES ('" . $_POST['TypeTabCode'] . "', + '" . $_POST['TypeTabDescription'] . "')"; + $Msg = _('Tabs type') . ' ' . $_POST['TypeTabCode'] . ' ' . _('has been created'); + } + } + if ($InputError != 1) { + //run the SQL from either of the above possibilites + $Result = DB_query($SQL); + prnMsg($Msg, 'success'); + echo '
'; + unset($SelectedTab); + unset($_POST['TypeTabCode']); + unset($_POST['TypeTabDescription']); + } +} elseif (isset($_GET['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'PcTabExpenses' + $SQLPcTabExpenses = "SELECT COUNT(*) + FROM pctabexpenses + WHERE typetabcode='" . $SelectedTab . "'"; + $ErrMsg = _('The number of tabs using this Tab type could not be retrieved'); + $ResultPcTabExpenses = DB_query($SQLPcTabExpenses, $ErrMsg); + $MyRowPcTabExpenses = DB_fetch_row($ResultPcTabExpenses); + $SqlPcTabs = "SELECT COUNT(*) + FROM pctabs + WHERE typetabcode='" . $SelectedTab . "'"; + $ErrMsg = _('The number of tabs using this Tab type could not be retrieved'); + $ResultPcTabs = DB_query($SqlPcTabs, $ErrMsg); + $MyRowPcTabs = DB_fetch_row($ResultPcTabs); + if ($MyRowPcTabExpenses[0] > 0 or $MyRowPcTabs[0] > 0) { + prnMsg(_('Cannot delete this tab type because tabs have been created using this tab type'), 'error'); + echo '
'; + echo ''; + echo '
'; + echo '
'; + include('includes/footer.php'); + exit; + } else { + $SQL = "DELETE FROM pctypetabs WHERE typetabcode='" . $SelectedTab . "'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('Tab type') . ' ' . $SelectedTab . ' ' . _('has been deleted'), 'success'); + unset($SelectedTab); + unset($_GET['delete']); + } //end if tab type used in transactions +} +if (!isset($SelectedTab)) { + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTab will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true and the list of sales types will be displayed with + links to delete or edit each. These will call the same page again and allow update/input + or deletion of the records*/ + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs"; + $Result = DB_query($SQL); + echo ' + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + echo ' + + + + + '; + } + //END WHILE LIST LOOP + echo '
', _('Type Of Tab'), '', _('Description'), '
', $MyRow['typetabcode'], '', $MyRow['typetabdescription'], '' . _('Edit') . '' . _('Delete') . '
'; +} +//end of ifs and buts! +if (isset($SelectedTab)) { + echo ''; +} +if (!isset($_GET['delete'])) { + echo '
'; + echo ''; + if (isset($SelectedTab) and $SelectedTab != '') { + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs + WHERE typetabcode='" . $SelectedTab . "'"; + $Result = DB_query($SQL); + $MyRow = DB_fetch_array($Result); + $_POST['TypeTabCode'] = $MyRow['typetabcode']; + $_POST['TypeTabDescription'] = $MyRow['typetabdescription']; + echo ' + + + + + + '; + // We dont allow the user to change an existing type code + } else { + // This is a new type so the user may volunteer a type code + echo '
', _('Code Of Type Of Tab'), ':', $_POST['TypeTabCode'], '
+ + + + '; + } + if (!isset($_POST['TypeTabDescription'])) { + $_POST['TypeTabDescription'] = ''; + } + echo ' + + + '; + echo '
', _('Code Of Type Of Tab'), ':
', _('Description Of Type of Tab'), ':
'; // close main table + echo '
+ + +
+
'; +} // end if user wish to delete +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/PeriodsInquiry.php b/PeriodsInquiry.php index 96638ba1e..28ab3de4a 100644 --- a/PeriodsInquiry.php +++ b/PeriodsInquiry.php @@ -34,17 +34,11 @@ echo ''; echo ''; echo $TableHeader; - $k=0; $j=0; + while ($myrow=DB_fetch_array($PeriodsResult)){ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + '; $j++; diff --git a/PriceMatrix.php b/PriceMatrix.php index b437839cc..57742118a 100644 --- a/PriceMatrix.php +++ b/PriceMatrix.php @@ -1,391 +1,384 @@ -' . ' ' . $Title . '


'; - -if (isset($_POST['submit'])) { - - //initialise no input errors assumed initially before we test - $InputError = 0; - if(isset($_POST['StockID'])){ - $StockID = trim(strtoupper($_POST['StockID'])); - } - if (!is_numeric(filter_number_format($_POST['QuantityBreak']))){ - prnMsg( _('The quantity break must be entered as a positive number'),'error'); - $InputError =1; - } - - if (filter_number_format($_POST['QuantityBreak'])<=0){ - prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $StockID . ' ' . _('at which the price will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn'); - $InputError =1; - } - if (!is_numeric(filter_number_format($_POST['Price']))){ - prnMsg( _('The price must be entered as a positive number'),'warn'); - $InputError =1; - } - if (!Is_Date($_POST['StartDate'])){ - $InputError = 1; - prnMsg(_('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); - } - if (!Is_Date($_POST['EndDate'])){ - $InputError = 1; - prnMsg(_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); - if (Date1GreaterThanDate2($_POST['StartDate'],$_POST['EndDate'])){ - $InputError = 1; - prnMsg(_('The end date is expected to be after the start date, enter an end date after the start date for this price'),'error'); - } - } - - - if(Is_Date($_POST['EndDate'])){ - $SQLEndDate = FormatDateForSQL($_POST['EndDate']); - } - if(Is_Date($_POST['StartDate'])){ - $SQLStartDate = FormatDateForSQL($_POST['StartDate']); - } - $sql = "SELECT COUNT(salestype) - FROM pricematrix - WHERE stockid='".$StockID."' - AND startdate='".$SQLStartDate."' - AND enddate='".$SQLEndDate."' - AND salestype='".$_POST['SalesType']."' - AND currabrev='".$_POST['CurrAbrev']."' - AND quantitybreak='".$_POST['QuantityBreak']."'"; - $result = DB_query($sql); - $myrow = DB_fetch_row($result); - if ($myrow[0]!=0 AND !isset($_POST['OldTypeAbbrev']) AND !isset($_POST['OldCurrAbrev'])){ - prnMsg(_('This price has already been entered. To change it you should edit it'),'warn'); - $InputError = 1; - } - - if (isset($_POST['OldTypeAbbrev']) AND isset($_POST['OldCurrAbrev']) AND mb_strlen($StockID)>1 AND $InputError !=1){ - - /* Update existing prices */ - $sql = "UPDATE pricematrix SET - salestype='" . $_POST['SalesType'] . "', - currabrev='" . $_POST['CurrAbrev'] . "', - price='" . filter_number_format($_POST['Price']) . "', - startdate='" . $SQLStartDate . "', - enddate='" . $SQLEndDate . "', - quantitybreak='" . filter_number_format($_POST['QuantityBreak']) . "' - WHERE stockid='" . $StockID . "' - AND startdate='" . $_POST['OldStartDate'] . "' - AND enddate='" . $_POST['OldEndDate'] . "' - AND salestype='" . $_POST['OldTypeAbbrev'] . "' - AND currabrev='" . $_POST['OldCurrAbrev'] . "' - AND quantitybreak='" . filter_number_format($_POST['OldQuantityBreak']) . "'"; - - $ErrMsg = _('Could not be update the existing prices'); - $result = DB_query($sql,$ErrMsg); - - ReSequenceEffectiveDates ($StockID, $_POST['SalesType'],$_POST['CurrAbrev'],$_POST['QuantityBreak'],$db); - - prnMsg(_('The price has been updated'),'success'); - } elseif ($InputError != 1) { - - /* actions to take once the user has clicked the submit button - ie the page has called itself with some user input */ - - $sql = "INSERT INTO pricematrix (salestype, - stockid, - quantitybreak, - price, - currabrev, - startdate, - enddate) - VALUES('" . $_POST['SalesType'] . "', - '" . $_POST['StockID'] . "', - '" . filter_number_format($_POST['QuantityBreak']) . "', - '" . filter_number_format($_POST['Price']) . "', - '" . $_POST['CurrAbrev'] . "', - '" . $SQLStartDate . "', - '" . $SQLEndDate . "')"; - $ErrMsg = _('Failed to insert price data'); - $result = DB_query($sql,$ErrMsg); - prnMsg( _('The price matrix record has been added'),'success'); - echo '
'; - unset($_POST['StockID']); - unset($_POST['SalesType']); - unset($_POST['QuantityBreak']); - unset($_POST['Price']); - unset($_POST['CurrAbrev']); - unset($_POST['StartDate']); - unset($_POST['EndDate']); - unset($SQLEndDate); - unset($SQLStartDate); - } -} elseif (isset($_GET['Delete']) and $_GET['Delete']=='yes') { -/*the link to delete a selected record was clicked instead of the submit button */ - - $sql="DELETE FROM pricematrix - WHERE stockid='" .$_GET['StockID'] . "' - AND salestype='" . $_GET['SalesType'] . "' - AND quantitybreak='" . $_GET['QuantityBreak']."' - AND price='" . $_GET['Price'] . "' - AND startdate='" . $_GET['StartDate'] . "' - AND enddate='" . $_GET['EndDate'] . "'"; - $ErrMsg = _('Failed to delete price data'); - $result = DB_query($sql,$ErrMsg); - prnMsg( _('The price matrix record has been deleted'),'success'); - echo '
'; -} - -echo ''; -echo '
'; -echo ''; -if (isset($_GET['Edit'])){ - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - $_POST['StartDate'] = $_GET['StartDate']; - $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; - $_POST['Price'] = $_GET['Price']; - $_POST['CurrAbrev'] = $_GET['CurrAbrev']; - $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); - $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']); - $_POST['QuantityBreak'] = $_GET['QuantityBreak']; -} -$SQL = "SELECT currabrev FROM currencies"; -$result = DB_query($SQL); -require_once('includes/CurrenciesArray.php'); -echo '
' . $myrow['periodno'] . '
' . $myrow['periodno'] . ' ' . ConvertSQLDate($myrow['lastdate_in_period']) . '
'; -echo ' - '; - -$sql = "SELECT typeabbrev, - sales_type - FROM salestypes"; - -$result = DB_query($sql); - -echo ''; -if(isset($_GET['StockID'])){ - $StockID = trim($_GET['StockID']); -}elseif(isset($_POST['StockID'])){ - $StockID = trim(strtoupper($_POST['StockID'])); -}elseif(!isset($StockID)){ - prnMsg(_('You must select a stock item first before set a price maxtrix'),'error'); - include('includes/footer.php'); - exit; -} -echo ''; -if (!isset($_POST['StartDate'])){ - $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); -} -if (!isset($_POST['EndDate'])){ - $_POST['EndDate'] = GetMySQLMaxDate(); -} -if (!isset($_POST['QuantityBreak'])) { - $_POST['QuantityBreak'] = 0; -} -if (!isset($_POST['Price'])) { - $_POST['Price'] = 0; -} -echo ' - '; -echo ' - - - - - - - - -
' . _('Currency') . ':
' . _('Customer Price List') . ' (' . _('Sales Type') . '):'; - -echo '
'. _('Price Effective From Date') . ':
' . _('Price Effective To Date') . ':'; - - -echo '
' . _('Quantity Break') . '
' . _('Price') . ' :
-
-
- -
-
'; - -$sql = "SELECT sales_type, - salestype, - stockid, - startdate, - enddate, - quantitybreak, - price, - currencies.currabrev, - currencies.currency, - currencies.decimalplaces AS currdecimalplaces - FROM pricematrix INNER JOIN salestypes - ON pricematrix.salestype=salestypes.typeabbrev - INNER JOIN currencies - ON pricematrix.currabrev=currencies.currabrev - WHERE pricematrix.stockid='" . $StockID . "' - ORDER BY pricematrix.currabrev, - salestype, - stockid, - quantitybreak"; - -$result = DB_query($sql); - -echo ''; -echo ' - - - - - - - '; - -$k=0; //row colour counter - -while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&StockID=' . $myrow['stockid'] . '&QuantityBreak=' . $myrow['quantitybreak'].'&Price=' . $myrow['price'] . '&currabrev=' . $myrow['currabrev'].'&StartDate='.$myrow['startdate'].'&EndDate='.$myrow['enddate']; - $EditURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Edit=yes&StockID=' . $myrow['stockid'] . '&TypeAbbrev=' . $myrow['salestype'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . locale_number_format($myrow['price'], $myrow['currdecimalplaces']) . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'].'&QuantityBreak=' . $myrow['quantitybreak']; - - if (in_array(5, $_SESSION['AllowedPageSecurityTokens'])){ - printf(' - - - - - - - - ', - $myrow['currency'], - $myrow['sales_type'], - ConvertSQLDate($myrow['startdate']), - ConvertSQLDate($myrow['enddate']), - $myrow['quantitybreak'], - $myrow['price'] , - $DeleteURL, - $EditURL); - }else { - printf(' - - - - - - ', - $myrow['currency'], - $myrow['sales_type'], - ConvertSQLDate($myrow['startdate']), - ConvertSQLDate($myrow['enddate']), - $myrow['quantitybreak'], - $myrow['price']); - - } - -} - -echo '
' . _('Currency') . '' . _('Sales Type') . '' . _('Price Effective From Date') . '' . _('Price Effective To Date') .'' . _('Quantity Break') . '' . _('Sell Price') . '
%s%s%s%s%s%s' . _('Delete') . ''._('Edit').'
%s%s%s%s%s%s
-
- '; - -include('includes/footer.php'); - -function GetMySQLMaxDate () { - switch ($_SESSION['DefaultDateFormat']){ - case 'd/m/Y': - return '31/12/9999'; - case 'd.m.Y': - return '31.12.9999'; - case 'm/d/Y': - return '12/31/9999'; - case 'Y-m-d': - return '9999-12-31'; - case 'Y/m/d': - return '9999/12/31'; - } -} -function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $QuantityBreak,$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. - 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 - * - * After further discussion (Ricard) if the new price has a blank end date - i.e. no end then the pre-existing price with no end date should be changed to have an end date just prior to the new default (no end date) price commencing - */ - //this is just the case where debtorno='' - see the Prices_Customer.php script for customer special prices - $SQL = "SELECT price, - startdate, - enddate - FROM pricematrix - WHERE stockid='" . $Item . "' - AND currabrev='" . $CurrAbbrev . "' - AND salestype='" . $PriceList . "' - AND quantitybreak='".$QuantityBreak."' - ORDER BY startdate, enddate"; - $result = DB_query($SQL); - - while ($myrow = DB_fetch_array($result)){ - if (isset($NextStartDate)){ - if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']),$NextStartDate)){ - $NextStartDate = ConvertSQLDate($myrow['startdate']); - //Only if the previous enddate is after the new start date do we need to look at updates - if (Date1GreaterThanDate2(ConvertSQLDate($EndDate),ConvertSQLDate($myrow['startdate']))) { - /*Need to make the end date the new start date less 1 day */ - $SQL = "UPDATE pricematrix SET enddate = '" . FormatDateForSQL(DateAdd($NextStartDate,'d',-1)) . "' - WHERE stockid ='" .$Item . "' - AND currabrev='" . $CurrAbbrev . "' - AND salestype='" . $PriceList . "' - AND startdate ='" . $StartDate . "' - AND enddate = '" . $EndDate . "' - AND quantitybreak ='" . $QuantityBreak . "'"; - $UpdateResult = DB_query($SQL); - } - } //end of if startdate after NextStartDate - we have a new NextStartDate - } //end of if set NextStartDate - else { - $NextStartDate = ConvertSQLDate($myrow['startdate']); - } - $StartDate = $myrow['startdate']; - $EndDate = $myrow['enddate']; - $Price = $myrow['price']; - } // end of loop around all prices - - - -} // end function ReSequenceEffectiveDates - -?> +' . ' ' . $Title . '


'; + +if (isset($_POST['submit'])) { + + //initialise no input errors assumed initially before we test + $InputError = 0; + if(isset($_POST['StockID'])){ + $StockID = trim(strtoupper($_POST['StockID'])); + } + if (!is_numeric(filter_number_format($_POST['QuantityBreak']))){ + prnMsg( _('The quantity break must be entered as a positive number'),'error'); + $InputError =1; + } + + if (filter_number_format($_POST['QuantityBreak'])<=0){ + prnMsg( _('The quantity of all items on an order in the discount category') . ' ' . $StockID . ' ' . _('at which the price will apply is 0 or less than 0') . '. ' . _('Positive numbers are expected for this entry'),'warn'); + $InputError =1; + } + if (!is_numeric(filter_number_format($_POST['Price']))){ + prnMsg( _('The price must be entered as a positive number'),'warn'); + $InputError =1; + } + if (!Is_Date($_POST['StartDate'])){ + $InputError = 1; + prnMsg(_('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); + } + if (!Is_Date($_POST['EndDate'])){ + $InputError = 1; + prnMsg(_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); + if (Date1GreaterThanDate2($_POST['StartDate'],$_POST['EndDate'])){ + $InputError = 1; + prnMsg(_('The end date is expected to be after the start date, enter an end date after the start date for this price'),'error'); + } + } + + + if(Is_Date($_POST['EndDate'])){ + $SQLEndDate = FormatDateForSQL($_POST['EndDate']); + } + if(Is_Date($_POST['StartDate'])){ + $SQLStartDate = FormatDateForSQL($_POST['StartDate']); + } + $sql = "SELECT COUNT(salestype) + FROM pricematrix + WHERE stockid='".$StockID."' + AND startdate='".$SQLStartDate."' + AND enddate='".$SQLEndDate."' + AND salestype='".$_POST['SalesType']."' + AND currabrev='".$_POST['CurrAbrev']."' + AND quantitybreak='".$_POST['QuantityBreak']."'"; + $result = DB_query($sql); + $myrow = DB_fetch_row($result); + if ($myrow[0]!=0 AND !isset($_POST['OldTypeAbbrev']) AND !isset($_POST['OldCurrAbrev'])){ + prnMsg(_('This price has already been entered. To change it you should edit it'),'warn'); + $InputError = 1; + } + + if (isset($_POST['OldTypeAbbrev']) AND isset($_POST['OldCurrAbrev']) AND mb_strlen($StockID)>1 AND $InputError !=1){ + + /* Update existing prices */ + $sql = "UPDATE pricematrix SET + salestype='" . $_POST['SalesType'] . "', + currabrev='" . $_POST['CurrAbrev'] . "', + price='" . filter_number_format($_POST['Price']) . "', + startdate='" . $SQLStartDate . "', + enddate='" . $SQLEndDate . "', + quantitybreak='" . filter_number_format($_POST['QuantityBreak']) . "' + WHERE stockid='" . $StockID . "' + AND startdate='" . $_POST['OldStartDate'] . "' + AND enddate='" . $_POST['OldEndDate'] . "' + AND salestype='" . $_POST['OldTypeAbbrev'] . "' + AND currabrev='" . $_POST['OldCurrAbrev'] . "' + AND quantitybreak='" . filter_number_format($_POST['OldQuantityBreak']) . "'"; + + $ErrMsg = _('Could not be update the existing prices'); + $result = DB_query($sql,$ErrMsg); + + ReSequenceEffectiveDates ($StockID, $_POST['SalesType'],$_POST['CurrAbrev'],$_POST['QuantityBreak'],$db); + + prnMsg(_('The price has been updated'),'success'); + } elseif ($InputError != 1) { + + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + + $sql = "INSERT INTO pricematrix (salestype, + stockid, + quantitybreak, + price, + currabrev, + startdate, + enddate) + VALUES('" . $_POST['SalesType'] . "', + '" . $_POST['StockID'] . "', + '" . filter_number_format($_POST['QuantityBreak']) . "', + '" . filter_number_format($_POST['Price']) . "', + '" . $_POST['CurrAbrev'] . "', + '" . $SQLStartDate . "', + '" . $SQLEndDate . "')"; + $ErrMsg = _('Failed to insert price data'); + $result = DB_query($sql,$ErrMsg); + prnMsg( _('The price matrix record has been added'),'success'); + echo '
'; + unset($_POST['StockID']); + unset($_POST['SalesType']); + unset($_POST['QuantityBreak']); + unset($_POST['Price']); + unset($_POST['CurrAbrev']); + unset($_POST['StartDate']); + unset($_POST['EndDate']); + unset($SQLEndDate); + unset($SQLStartDate); + } +} elseif (isset($_GET['Delete']) and $_GET['Delete']=='yes') { +/*the link to delete a selected record was clicked instead of the submit button */ + + $sql="DELETE FROM pricematrix + WHERE stockid='" .$_GET['StockID'] . "' + AND salestype='" . $_GET['SalesType'] . "' + AND quantitybreak='" . $_GET['QuantityBreak']."' + AND price='" . $_GET['Price'] . "' + AND startdate='" . $_GET['StartDate'] . "' + AND enddate='" . $_GET['EndDate'] . "'"; + $ErrMsg = _('Failed to delete price data'); + $result = DB_query($sql,$ErrMsg); + prnMsg( _('The price matrix record has been deleted'),'success'); + echo '
'; +} + +echo '
'; +echo '
'; +echo ''; +if (isset($_GET['Edit'])){ + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + $_POST['StartDate'] = $_GET['StartDate']; + $_POST['TypeAbbrev'] = $_GET['TypeAbbrev']; + $_POST['Price'] = $_GET['Price']; + $_POST['CurrAbrev'] = $_GET['CurrAbrev']; + $_POST['StartDate'] = ConvertSQLDate($_GET['StartDate']); + $_POST['EndDate'] = ConvertSQLDate($_GET['EndDate']); + $_POST['QuantityBreak'] = $_GET['QuantityBreak']; +} +$SQL = "SELECT currabrev FROM currencies"; +$result = DB_query($SQL); +require_once('includes/CurrenciesArray.php'); +echo ''; +echo ' + '; + +$sql = "SELECT typeabbrev, + sales_type + FROM salestypes"; + +$result = DB_query($sql); + +echo ''; +if(isset($_GET['StockID'])){ + $StockID = trim($_GET['StockID']); +}elseif(isset($_POST['StockID'])){ + $StockID = trim(strtoupper($_POST['StockID'])); +}elseif(!isset($StockID)){ + prnMsg(_('You must select a stock item first before set a price maxtrix'),'error'); + include('includes/footer.php'); + exit; +} +echo ''; +if (!isset($_POST['StartDate'])){ + $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); +} +if (!isset($_POST['EndDate'])){ + $_POST['EndDate'] = GetMySQLMaxDate(); +} +if (!isset($_POST['QuantityBreak'])) { + $_POST['QuantityBreak'] = 0; +} +if (!isset($_POST['Price'])) { + $_POST['Price'] = 0; +} +echo ' + '; +echo ' + + + + + + + + +
' . _('Currency') . ':
' . _('Customer Price List') . ' (' . _('Sales Type') . '):'; + +echo '
'. _('Price Effective From Date') . ':
' . _('Price Effective To Date') . ':'; + + +echo '
' . _('Quantity Break') . '
' . _('Price') . ' :
+
+
+ +
+
'; + +$sql = "SELECT sales_type, + salestype, + stockid, + startdate, + enddate, + quantitybreak, + price, + currencies.currabrev, + currencies.currency, + currencies.decimalplaces AS currdecimalplaces + FROM pricematrix INNER JOIN salestypes + ON pricematrix.salestype=salestypes.typeabbrev + INNER JOIN currencies + ON pricematrix.currabrev=currencies.currabrev + WHERE pricematrix.stockid='" . $StockID . "' + ORDER BY pricematrix.currabrev, + salestype, + stockid, + quantitybreak"; + +$result = DB_query($sql); + +echo ''; +echo ' + + + + + + + '; + +while ($myrow = DB_fetch_array($result)) { + $DeleteURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=yes&SalesType=' . $myrow['salestype'] . '&StockID=' . $myrow['stockid'] . '&QuantityBreak=' . $myrow['quantitybreak'].'&Price=' . $myrow['price'] . '&currabrev=' . $myrow['currabrev'].'&StartDate='.$myrow['startdate'].'&EndDate='.$myrow['enddate']; + $EditURL = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Edit=yes&StockID=' . $myrow['stockid'] . '&TypeAbbrev=' . $myrow['salestype'] . '&CurrAbrev=' . $myrow['currabrev'] . '&Price=' . locale_number_format($myrow['price'], $myrow['currdecimalplaces']) . '&StartDate=' . $myrow['startdate'] . '&EndDate=' . $myrow['enddate'].'&QuantityBreak=' . $myrow['quantitybreak']; + + if (in_array(5, $_SESSION['AllowedPageSecurityTokens'])){ + printf(' + + + + + + + + + ', + $myrow['currency'], + $myrow['sales_type'], + ConvertSQLDate($myrow['startdate']), + ConvertSQLDate($myrow['enddate']), + $myrow['quantitybreak'], + $myrow['price'] , + $DeleteURL, + $EditURL); + }else { + printf(' + + + + + + + ', + $myrow['currency'], + $myrow['sales_type'], + ConvertSQLDate($myrow['startdate']), + ConvertSQLDate($myrow['enddate']), + $myrow['quantitybreak'], + $myrow['price']); + + } + +} + +echo '
' . _('Currency') . '' . _('Sales Type') . '' . _('Price Effective From Date') . '' . _('Price Effective To Date') .'' . _('Quantity Break') . '' . _('Sell Price') . '
%s%s%s%s%s%s' . _('Delete') . ''._('Edit').'
%s%s%s%s%s%s
+
+
'; + +include('includes/footer.php'); + +function GetMySQLMaxDate () { + switch ($_SESSION['DefaultDateFormat']){ + case 'd/m/Y': + return '31/12/9999'; + case 'd.m.Y': + return '31.12.9999'; + case 'm/d/Y': + return '12/31/9999'; + case 'Y-m-d': + return '9999-12-31'; + case 'Y/m/d': + return '9999/12/31'; + } +} +function ReSequenceEffectiveDates ($Item, $PriceList, $CurrAbbrev, $QuantityBreak,$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. + 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 + * + * After further discussion (Ricard) if the new price has a blank end date - i.e. no end then the pre-existing price with no end date should be changed to have an end date just prior to the new default (no end date) price commencing + */ + //this is just the case where debtorno='' - see the Prices_Customer.php script for customer special prices + $SQL = "SELECT price, + startdate, + enddate + FROM pricematrix + WHERE stockid='" . $Item . "' + AND currabrev='" . $CurrAbbrev . "' + AND salestype='" . $PriceList . "' + AND quantitybreak='".$QuantityBreak."' + ORDER BY startdate, enddate"; + $result = DB_query($SQL); + + while ($myrow = DB_fetch_array($result)){ + if (isset($NextStartDate)){ + if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']),$NextStartDate)){ + $NextStartDate = ConvertSQLDate($myrow['startdate']); + //Only if the previous enddate is after the new start date do we need to look at updates + if (Date1GreaterThanDate2(ConvertSQLDate($EndDate),ConvertSQLDate($myrow['startdate']))) { + /*Need to make the end date the new start date less 1 day */ + $SQL = "UPDATE pricematrix SET enddate = '" . FormatDateForSQL(DateAdd($NextStartDate,'d',-1)) . "' + WHERE stockid ='" .$Item . "' + AND currabrev='" . $CurrAbbrev . "' + AND salestype='" . $PriceList . "' + AND startdate ='" . $StartDate . "' + AND enddate = '" . $EndDate . "' + AND quantitybreak ='" . $QuantityBreak . "'"; + $UpdateResult = DB_query($SQL); + } + } //end of if startdate after NextStartDate - we have a new NextStartDate + } //end of if set NextStartDate + else { + $NextStartDate = ConvertSQLDate($myrow['startdate']); + } + $StartDate = $myrow['startdate']; + $EndDate = $myrow['enddate']; + $Price = $myrow['price']; + } // end of loop around all prices + + + +} // end function ReSequenceEffectiveDates + +?> diff --git a/Prices.php b/Prices.php index e5885f552..74171def3 100644 --- a/Prices.php +++ b/Prices.php @@ -227,22 +227,15 @@ } echo ''; - $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } if ($myrow['enddate']=='9999-12-31'){ $EndDateDisplay = _('No End Date'); } else { $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } - echo '' . $CurrencyName[$myrow['currabrev']] . ' + echo ' + ' . $CurrencyName[$myrow['currabrev']] . ' ' . $myrow['sales_type'] . ' ' . locale_number_format($myrow['price'], $myrow['currdecimalplaces']+2) . ' ' . ConvertSQLDate($myrow['startdate']) . ' diff --git a/PricesByCost.php b/PricesByCost.php index a3deeff70..3769c1821 100644 --- a/PricesByCost.php +++ b/PricesByCost.php @@ -160,7 +160,7 @@ ' . _('Price Proposed') . ' ' . _('List Price') . ' '; - $k = 0; //row colour counter + echo '
'; echo '
'; echo ''; @@ -173,13 +173,6 @@ $PriceCounter =0; while ($myrow = DB_fetch_array($result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } //get cost if ($myrow['cost'] == '') { $Cost = 0; @@ -206,7 +199,8 @@ } else { $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } - echo ' ' . $myrow['stockid'] . ' + echo ' + ' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['customer'] . ' ' . $myrow['branch'] . ' @@ -220,8 +214,8 @@ $PriceCounter++; } //end of looping echo ' - - + +
'; diff --git a/Prices_Customer.php b/Prices_Customer.php index bde13c54f..9b124b3fd 100644 --- a/Prices_Customer.php +++ b/Prices_Customer.php @@ -218,10 +218,11 @@ } else { $EndDateDisplay = ConvertSQLDate($myrow['enddate']); } - printf(' + printf(' %s %s - %s', + %s + ', locale_number_format($myrow['price'],$CurrDecimalPlaces), ConvertSQLDate($myrow['startdate']), $EndDateDisplay); diff --git a/PrintCustTrans.php b/PrintCustTrans.php index cc6b4638b..217334d9d 100644 --- a/PrintCustTrans.php +++ b/PrintCustTrans.php @@ -998,20 +998,9 @@ '; $LineCounter =17; - $k=0; //row colour counter while ($myrow2=DB_fetch_array($result)){ - if($k==1){ - $RowStarter = ''; - $k=0; - } else { - $RowStarter = ''; - $k=1; - } - - echo $RowStarter; - $DisplayPrice = locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); @@ -1022,7 +1011,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; } - printf ('%s + printf (' + %s %s %s %s @@ -1040,8 +1030,8 @@ if (mb_strlen($myrow2['narrative'])>1){ $narrative = str_replace(array("\r\n", "\n", "\r", "\\r\\n"), '
', $myrow2['narrative']); - echo $RowStarter . - ' + echo ' + ' . $narrative . ' '; $LineCounter++; diff --git a/PrintCustTransPortrait.php b/PrintCustTransPortrait.php index 9bf8102ce..e84ab60be 100644 --- a/PrintCustTransPortrait.php +++ b/PrintCustTransPortrait.php @@ -980,20 +980,9 @@ '; $LineCounter =17; - $k=0; //row colour counter while($myrow2=DB_fetch_array($result)) { - if($k==1) { - $RowStarter = ''; - $k=0; - } else { - $RowStarter = ''; - $k=1; - } - - echo $RowStarter; - $DisplayPrice =locale_number_format($myrow2['fxprice'],$myrow['decimalplaces']); $DisplayQty = locale_number_format($myrow2['quantity'],$myrow2['decimalplaces']); $DisplayNet = locale_number_format($myrow2['fxnet'],$myrow['decimalplaces']); @@ -1004,7 +993,8 @@ $DisplayDiscount = locale_number_format($myrow2['discountpercent']*100,2) . '%'; } - printf ('%s + printf (' + %s %s %s %s @@ -1021,8 +1011,8 @@ $DisplayNet); if(mb_strlen($myrow2['narrative'])>1) { - echo $RowStarter . - ' + echo ' + ' . $myrow2['narrative'] . ' '; $LineCounter++; diff --git a/PrintWOItemSlip.php b/PrintWOItemSlip.php index 0d83e01c8..7e18674fc 100644 --- a/PrintWOItemSlip.php +++ b/PrintWOItemSlip.php @@ -1,216 +1,216 @@ -addInfo('Title',_('WO Production Slip')); - $pdf->addInfo('Subject',_('WO Production Slip')); - - while ($myItem = DB_fetch_array($resultItems)) { - // print the info of the parent product - $FontSize=10; - $PageNumber=1; - $line_height=12; - $Xpos = $Left_Margin+1; - $fill = FALSE; - - $QtyPending = $myItem['qtyreqd'] - $myItem['qtyrecd']; - - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$WO,$StockId,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); - - $PartCounter = 0; - - $sqlBOM = "SELECT bom.parent, - bom.component, - bom.quantity AS bomqty, - stockmaster.decimalplaces, - stockmaster.units, - stockmaster.description, - stockmaster.shrinkfactor, - locstock.quantity AS qoh - FROM bom, stockmaster, locstock - WHERE bom.component = stockmaster.stockid - AND bom.component = locstock.stockid - AND locstock.loccode = '". $Location ."' - AND bom.parent = '" . $StockId . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; - - $ErrMsg = _('The bill of material could not be retrieved because'); - $BOMResult = DB_query ($sqlBOM,$ErrMsg); - while ($myComponent = DB_fetch_array($BOMResult)) { - - $ComponentNeeded = $myComponent['bomqty'] * $QtyPending; - $PrevisionShrinkage = $ComponentNeeded * ($myComponent['shrinkfactor'] / 100); - - $Xpos = $Left_Margin+1; - - $pdf->addTextWrap($Xpos,$YPos,150,$FontSize, $myComponent['component'], 'left'); - $pdf->addTextWrap(150,$YPos,50,$FontSize,locale_number_format($myComponent['bomqty'],$myComponent['decimalplaces']), 'right'); - $pdf->addTextWrap(200,$YPos,30,$FontSize,$myComponent['units'], 'left'); - $pdf->addTextWrap(230,$YPos,50,$FontSize,locale_number_format($ComponentNeeded,$myComponent['decimalplaces']), 'right'); - $pdf->addTextWrap(280,$YPos,30,$FontSize,$myComponent['units'], 'left'); - $pdf->addTextWrap(310,$YPos,50,$FontSize,locale_number_format($PrevisionShrinkage,$myComponent['decimalplaces']), 'right'); - $pdf->addTextWrap(360,$YPos,30,$FontSize,$myComponent['units'], 'left'); - - $YPos -= $line_height; - - if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$WO,$Stockid,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); - } - } - } - - // Production Notes - $pdf->addTextWrap($Xpos,$YPos-50,200,$FontSize,_('Incidences / Production Notes').':', 'left'); - $YPos -=(8*$line_height); - - PrintFooterSlip($pdf,_('Components Ready By'), _('Item Produced By'), _('Quality Control By'), $YPos,$FontSize,false); - - if ($YPos < $Bottom_Margin + $line_height){ - PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, - $Right_Margin,$WO,$Stockid,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); - } - - $pdf->OutputD('WO-' . $WO . '-' . $StockId . '-' . Date('Y-m-d') . '.pdf'); - $pdf->__destruct(); - }else{ - $Title = _('WO Item production Slip'); - include('includes/header.php'); - prnMsg(_('There were no items with ready to produce'),'info'); - prnMsg($sql); - echo '
' . _('Back to the menu') . ''; - include('includes/footer.php'); - exit; - - } -} - - -function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, - $Page_Width,$Right_Margin,$WO,$StockId,$Description,$Qty,$UOM,$DecimalPlaces, $ReportDate) { - - if ($PageNumber>1){ - $pdf->newPage(); - } - $line_height=12; - $FontSize=10; - $YPos= $Page_Height-$Top_Margin; - - $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,$_SESSION['CompanyRecord']['coyname']); - $pdf->addTextWrap(190,$YPos,100,$FontSize,$ReportDate); - $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . - Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); - $YPos -=$line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Work Order Item Production Slip')); - $YPos -=(2*$line_height); - - $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('WO'). ': ' . $WO); - $YPos -= $line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,500,$FontSize,_('Item Code'). ': ' . $StockId . ' --> ' . $Description); - $YPos -= $line_height; - - $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Quantity'). ': ' . locale_number_format($Qty,$DecimalPlaces) . ' ' . $UOM); - $YPos -=(2*$line_height); - - if(file_exists($_SESSION['part_pics_dir'] . '/' .$StockId.'.jpg') ) { - $pdf->Image($_SESSION['part_pics_dir'] . '/'.$StockId.'.jpg',135,$Page_Height-$Top_Margin-$YPos+10,200,200); - $YPos -=(16*$line_height); - }/*end checked file exist*/ - - - /*set up the headings */ - $Xpos = $Left_Margin+1; - - $pdf->addTextWrap($Xpos,$YPos,150,$FontSize,_('Component Code'), 'left'); - $pdf->addTextWrap(150,$YPos,50,$FontSize,_('Qty BOM'), 'right'); - $pdf->addTextWrap(200,$YPos,30,$FontSize,'', 'left'); - $pdf->addTextWrap(230,$YPos,50,$FontSize,_('Qty Needed'), 'right'); - $pdf->addTextWrap(280,$YPos,30,$FontSize,'', 'left'); - $pdf->addTextWrap(310,$YPos,50,$FontSize,_('Shrinkage'), 'right'); - $pdf->addTextWrap(360,$YPos,30,$FontSize,'', 'left'); - - $FontSize=10; - $YPos -= $line_height; - - $PageNumber++; -} - -function PrintFooterSlip($pdf,$Column1, $Column2, $Column3, $YPos,$FontSize,$fill){ - //add column 1 - $pdf->addTextWrap(40,$YPos-50,100,$FontSize,$Column1.':', 'left'); - $pdf->addTextWrap(40,$YPos-70,100,$FontSize,_('Name'), 'left'); - $pdf->addTextWrap(80,$YPos-70,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(40,$YPos-90,100,$FontSize,_('Date'), 'left'); - $pdf->addTextWrap(80,$YPos-90,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(40,$YPos-110,100,$FontSize,_('Hour'), 'left'); - $pdf->addTextWrap(80,$YPos-110,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(40,$YPos-150,100,$FontSize,_('Signature'), 'left'); - $pdf->addTextWrap(80,$YPos-150,200,$FontSize,':__________________','left',0,$fill); - - //add column 2 - $pdf->addTextWrap(220,$YPos-50,100,$FontSize,$Column2.':', 'left'); - $pdf->addTextWrap(220,$YPos-70,100,$FontSize,_('Name'), 'left'); - $pdf->addTextWrap(260,$YPos-70,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(220,$YPos-90,100,$FontSize,_('Date'), 'left'); - $pdf->addTextWrap(260,$YPos-90,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(220,$YPos-110,100,$FontSize,_('Hour'), 'left'); - $pdf->addTextWrap(260,$YPos-110,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(220,$YPos-150,100,$FontSize,_('Signature'), 'left'); - $pdf->addTextWrap(260,$YPos-150,200,$FontSize,':__________________','left',0,$fill); - - //add column 3 - $pdf->addTextWrap(400,$YPos-50,100,$FontSize,$Column3.':', 'left'); - $pdf->addTextWrap(400,$YPos-70,100,$FontSize,_('Name'), 'left'); - $pdf->addTextWrap(440,$YPos-70,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(400,$YPos-90,100,$FontSize,_('Date'), 'left'); - $pdf->addTextWrap(440,$YPos-90,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(400,$YPos-110,100,$FontSize,_('Hour'), 'left'); - $pdf->addTextWrap(440,$YPos-110,200,$FontSize,':__________________','left',0,$fill); - $pdf->addTextWrap(400,$YPos-150,100,$FontSize,_('Signature'), 'left'); - $pdf->addTextWrap(440,$YPos-150,200,$FontSize,':__________________','left',0,$fill); -} - -?> +addInfo('Title',_('WO Production Slip')); + $pdf->addInfo('Subject',_('WO Production Slip')); + + while ($myItem = DB_fetch_array($resultItems)) { + // print the info of the parent product + $FontSize=10; + $PageNumber=1; + $line_height=12; + $Xpos = $Left_Margin+1; + $fill = FALSE; + + $QtyPending = $myItem['qtyreqd'] - $myItem['qtyrecd']; + + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, + $Page_Width,$Right_Margin,$WO,$StockId,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); + + $PartCounter = 0; + + $sqlBOM = "SELECT bom.parent, + bom.component, + bom.quantity AS bomqty, + stockmaster.decimalplaces, + stockmaster.units, + stockmaster.description, + stockmaster.shrinkfactor, + locstock.quantity AS qoh + FROM bom, stockmaster, locstock + WHERE bom.component = stockmaster.stockid + AND bom.component = locstock.stockid + AND locstock.loccode = '". $Location ."' + AND bom.parent = '" . $StockId . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; + + $ErrMsg = _('The bill of material could not be retrieved because'); + $BOMResult = DB_query ($sqlBOM,$ErrMsg); + while ($myComponent = DB_fetch_array($BOMResult)) { + + $ComponentNeeded = $myComponent['bomqty'] * $QtyPending; + $PrevisionShrinkage = $ComponentNeeded * ($myComponent['shrinkfactor'] / 100); + + $Xpos = $Left_Margin+1; + + $pdf->addTextWrap($Xpos,$YPos,150,$FontSize, $myComponent['component'], 'left'); + $pdf->addTextWrap(150,$YPos,50,$FontSize,locale_number_format($myComponent['bomqty'],$myComponent['decimalplaces']), 'right'); + $pdf->addTextWrap(200,$YPos,30,$FontSize,$myComponent['units'], 'left'); + $pdf->addTextWrap(230,$YPos,50,$FontSize,locale_number_format($ComponentNeeded,$myComponent['decimalplaces']), 'right'); + $pdf->addTextWrap(280,$YPos,30,$FontSize,$myComponent['units'], 'left'); + $pdf->addTextWrap(310,$YPos,50,$FontSize,locale_number_format($PrevisionShrinkage,$myComponent['decimalplaces']), 'right'); + $pdf->addTextWrap(360,$YPos,30,$FontSize,$myComponent['units'], 'left'); + + $YPos -= $line_height; + + if ($YPos < $Bottom_Margin + $line_height){ + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$WO,$Stockid,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); + } + } + } + + // Production Notes + $pdf->addTextWrap($Xpos,$YPos-50,200,$FontSize,_('Incidences / Production Notes').':', 'left'); + $YPos -=(8*$line_height); + + PrintFooterSlip($pdf,_('Components Ready By'), _('Item Produced By'), _('Quality Control By'), $YPos,$FontSize,false); + + if ($YPos < $Bottom_Margin + $line_height){ + PrintHeader($pdf,$YPos,$PageNumber,$Page_Height,$Top_Margin,$Left_Margin,$Page_Width, + $Right_Margin,$WO,$Stockid,$myItem['description'],$QtyPending,$myItem['units'],$myItem['decimalplaces'],$ReportDate); + } + + $pdf->OutputD('WO-' . $WO . '-' . $StockId . '-' . Date('Y-m-d') . '.pdf'); + $pdf->__destruct(); + }else{ + $Title = _('WO Item production Slip'); + include('includes/header.php'); + prnMsg(_('There were no items with ready to produce'),'info'); + prnMsg($sql); + echo '
' . _('Back to the menu') . ''; + include('includes/footer.php'); + exit; + + } +} + + +function PrintHeader(&$pdf,&$YPos,&$PageNumber,$Page_Height,$Top_Margin,$Left_Margin, + $Page_Width,$Right_Margin,$WO,$StockId,$Description,$Qty,$UOM,$DecimalPlaces, $ReportDate) { + + if ($PageNumber>1){ + $pdf->newPage(); + } + $line_height=12; + $FontSize=10; + $YPos= $Page_Height-$Top_Margin; + + $pdf->addTextWrap($Left_Margin,$YPos,300,$FontSize,$_SESSION['CompanyRecord']['coyname']); + $pdf->addTextWrap(190,$YPos,100,$FontSize,$ReportDate); + $pdf->addTextWrap($Page_Width-$Right_Margin-150,$YPos,160,$FontSize,_('Printed') . ': ' . + Date($_SESSION['DefaultDateFormat']) . ' ' . _('Page') . ' ' . $PageNumber,'left'); + $YPos -=$line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Work Order Item Production Slip')); + $YPos -=(2*$line_height); + + $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('WO'). ': ' . $WO); + $YPos -= $line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,500,$FontSize,_('Item Code'). ': ' . $StockId . ' --> ' . $Description); + $YPos -= $line_height; + + $pdf->addTextWrap($Left_Margin,$YPos,150,$FontSize,_('Quantity'). ': ' . locale_number_format($Qty,$DecimalPlaces) . ' ' . $UOM); + $YPos -=(2*$line_height); + + if(file_exists($_SESSION['part_pics_dir'] . '/' .$StockId.'.jpg') ) { + $pdf->Image($_SESSION['part_pics_dir'] . '/'.$StockId.'.jpg',135,$Page_Height-$Top_Margin-$YPos+10,200,200); + $YPos -=(16*$line_height); + }/*end checked file exist*/ + + + /*set up the headings */ + $Xpos = $Left_Margin+1; + + $pdf->addTextWrap($Xpos,$YPos,150,$FontSize,_('Component Code'), 'left'); + $pdf->addTextWrap(150,$YPos,50,$FontSize,_('Qty BOM'), 'right'); + $pdf->addTextWrap(200,$YPos,30,$FontSize,'', 'left'); + $pdf->addTextWrap(230,$YPos,50,$FontSize,_('Qty Needed'), 'right'); + $pdf->addTextWrap(280,$YPos,30,$FontSize,'', 'left'); + $pdf->addTextWrap(310,$YPos,50,$FontSize,_('Shrinkage'), 'right'); + $pdf->addTextWrap(360,$YPos,30,$FontSize,'', 'left'); + + $FontSize=10; + $YPos -= $line_height; + + $PageNumber++; +} + +function PrintFooterSlip($pdf,$Column1, $Column2, $Column3, $YPos,$FontSize,$fill){ + //add column 1 + $pdf->addTextWrap(40,$YPos-50,100,$FontSize,$Column1.':', 'left'); + $pdf->addTextWrap(40,$YPos-70,100,$FontSize,_('Name'), 'left'); + $pdf->addTextWrap(80,$YPos-70,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(40,$YPos-90,100,$FontSize,_('Date'), 'left'); + $pdf->addTextWrap(80,$YPos-90,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(40,$YPos-110,100,$FontSize,_('Hour'), 'left'); + $pdf->addTextWrap(80,$YPos-110,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(40,$YPos-150,100,$FontSize,_('Signature'), 'left'); + $pdf->addTextWrap(80,$YPos-150,200,$FontSize,':__________________','left',0,$fill); + + //add column 2 + $pdf->addTextWrap(220,$YPos-50,100,$FontSize,$Column2.':', 'left'); + $pdf->addTextWrap(220,$YPos-70,100,$FontSize,_('Name'), 'left'); + $pdf->addTextWrap(260,$YPos-70,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(220,$YPos-90,100,$FontSize,_('Date'), 'left'); + $pdf->addTextWrap(260,$YPos-90,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(220,$YPos-110,100,$FontSize,_('Hour'), 'left'); + $pdf->addTextWrap(260,$YPos-110,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(220,$YPos-150,100,$FontSize,_('Signature'), 'left'); + $pdf->addTextWrap(260,$YPos-150,200,$FontSize,':__________________','left',0,$fill); + + //add column 3 + $pdf->addTextWrap(400,$YPos-50,100,$FontSize,$Column3.':', 'left'); + $pdf->addTextWrap(400,$YPos-70,100,$FontSize,_('Name'), 'left'); + $pdf->addTextWrap(440,$YPos-70,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(400,$YPos-90,100,$FontSize,_('Date'), 'left'); + $pdf->addTextWrap(440,$YPos-90,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(400,$YPos-110,100,$FontSize,_('Hour'), 'left'); + $pdf->addTextWrap(440,$YPos-110,200,$FontSize,':__________________','left',0,$fill); + $pdf->addTextWrap(400,$YPos-150,100,$FontSize,_('Signature'), 'left'); + $pdf->addTextWrap(440,$YPos-150,200,$FontSize,':__________________','left',0,$fill); +} + +?> diff --git a/ProductSpecs.php b/ProductSpecs.php index d1288117d..d29a87eef 100644 --- a/ProductSpecs.php +++ b/ProductSpecs.php @@ -169,17 +169,10 @@ ' . _('Range Min') . ' ' . _('Range Max') . ' '; - $k=0; + $x=0; while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $x++; $Class=''; $RangeMin=''; @@ -211,7 +204,8 @@ $RangeMax=''; break; } //end switch - printf('%s + printf(' + %s %s %s %s @@ -395,16 +389,9 @@ ' . _('Show on Test Plan') . ' ' . _('Active') . ' '; - $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['active'] == 1) { $ActiveText = _('Yes'); } else { @@ -450,7 +437,8 @@ break; } //end switch - printf('%s + printf(' + %s %s %s %s diff --git a/PurchData.php b/PurchData.php index e12e1fa8c..0d2132a28 100644 --- a/PurchData.php +++ b/PurchData.php @@ -281,17 +281,8 @@ '; echo $TableHeader; $CountPreferreds = 0; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($PurchDataResult)) { - if ($myrow['preferred'] == 1) { - echo ''; - } elseif ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } if ($myrow['preferred'] == 1) { $DisplayPreferred = _('Yes'); $CountPreferreds++; @@ -299,7 +290,8 @@ $DisplayPreferred = _('No'); } $UPriceDecimalPlaces = max($myrow['currdecimalplaces'],$_SESSION['StandardCostDecimalPlaces']); - printf('%s + printf(' + %s %s %s %s @@ -474,16 +466,10 @@ ' . _('Address 3') . ' '; echo $TableHeader; - $k = 0; + while ($myrow = DB_fetch_array($SuppliersResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - printf(' + printf(' + %s %s %s @@ -702,17 +688,11 @@ ' . _('Effective From') . ' ' . _('Effective To') . ' '; - $k = 0; + $i = 0; //DiscountCounter while ($myrow = DB_fetch_array($DiscountsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - printf(' + printf(' + diff --git a/PurchasesReport.php b/PurchasesReport.php index 8a5bef7b6..c5235447d 100644 --- a/PurchasesReport.php +++ b/PurchasesReport.php @@ -60,7 +60,6 @@ ';// Common table code. $TotalGlAmount = 0; $TotalGlTax = 0; - $k = 1;// Row colour counter. $PeriodFrom = FormatDateForSQL($_POST['PeriodFrom']); $PeriodTo = FormatDateForSQL($_POST['PeriodTo']); if($_POST['ShowDetails']) {// Parameters: PeriodFrom, PeriodTo, ShowDetails=on. @@ -119,16 +118,11 @@ $SupplierGlAmount = 0; $SupplierGlTax = 0; } - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } + $GlAmount = $MyRow['ovamount']/$MyRow['rate']; $GlTax = $MyRow['ovgst']/$MyRow['rate']; - echo '', $MyRow['trandate'], '', + echo ' + ', $MyRow['trandate'], '', '', $MyRow['transno'], '', '', $MyRow['suppreference'], '', '', locale_number_format($MyRow['ovamount'], $_SESSION['CompanyRecord']['decimalplaces']), '', @@ -188,14 +182,8 @@ ORDER BY supptrans.supplierno, supptrans.trandate"; $Result = DB_query($Sql); foreach($Result as $MyRow) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', $MyRow['supplierno'], '', + echo ' + ', $MyRow['supplierno'], '', '', $MyRow['suppname'], '', '', $MyRow['currcode'], '', '', locale_number_format($MyRow['SupplierOvAmount'], $_SESSION['CompanyRecord']['decimalplaces']), '', diff --git a/QATests.php b/QATests.php index 99ee8ef41..8a26c24a6 100644 --- a/QATests.php +++ b/QATests.php @@ -400,16 +400,9 @@ ' . _('Show on Test Plan') . ' ' . _('Active') . ' '; - $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow['active'] == 1) { $ActiveText = _('Yes'); } else { @@ -452,7 +445,8 @@ $TypeDisp='Range'; break; } //end switch - printf('%s + printf(' + %s %s %s %s diff --git a/RecurringSalesOrders.php b/RecurringSalesOrders.php index 20d8a2716..934571e43 100644 --- a/RecurringSalesOrders.php +++ b/RecurringSalesOrders.php @@ -338,7 +338,6 @@ $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; $_SESSION['Items'.$identifier]->totalWeight = 0; -$k = 0; //row colour counter foreach ($_SESSION['Items'.$identifier]->LineItems as $StockItem) { @@ -349,15 +348,8 @@ $DisplayDiscount = locale_number_format(($StockItem->DiscountPercent * 100),2); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $StockItem->StockID . ' + echo ' + ' . $StockItem->StockID . ' ' . $StockItem->ItemDescription . ' ' . $DisplayQuantity . ' ' . $StockItem->Units . ' diff --git a/RelatedItemsUpdate.php b/RelatedItemsUpdate.php index aa306b700..6fc80dece 100644 --- a/RelatedItemsUpdate.php +++ b/RelatedItemsUpdate.php @@ -2,7 +2,7 @@ /* $Id: QATests.php 7123 2015-02-04 07:30:11Z daintree $*/ /* Quality Test Maintenance */ -include('includes/session.php'); +include('includes/session.php'); $Title = _('Update Related Items'); $ViewTopic = 'QualityAssurance'; $BookMark = 'QA_Tests'; @@ -11,208 +11,201 @@ echo '

', // Icon title. - $Title, '

';// Page title. - -include('includes/SQL_CommonFunctions.inc'); - -//initialise no input errors assumed initially before we test -$InputError = 0; - -if (isset($_GET['Item'])){ - $Item = trim(mb_strtoupper($_GET['Item'])); -}elseif (isset($_POST['Item'])){ - $Item = trim(mb_strtoupper($_POST['Item'])); -} -if (isset($_GET['Related'])){ - $Related = trim(mb_strtoupper($_GET['Related'])); -}elseif (isset($_POST['Related'])){ - $Related = trim(mb_strtoupper($_POST['Related'])); -} - -echo '' . _('Back to Items') . '
'; - - -$result = DB_query("SELECT stockmaster.description - FROM stockmaster - WHERE stockmaster.stockid='".$Item."'"); -$myrow = DB_fetch_row($result); - -if (DB_num_rows($result)==0){ - prnMsg( _('The part code entered does not exist in the database') . ': ' . $Item . _('Only valid parts can have related items entered against them'),'error'); - $InputError=1; -} - - -if (!isset($Item)){ - echo '

'; - prnMsg (_('An item must first be selected before this page is called') . '. ' . _('The product selection page should call this page with a valid product code'),'error'); - include('includes/footer.php'); - exit; -} - -$PartDescription = $myrow[0]; - -if (isset($_POST['submit'])) { - - /* 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 - - $result_related = DB_query("SELECT stockmaster.description, - stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='".$_POST['Related']."'"); - $myrow_related = DB_fetch_row($result_related); - - if (DB_num_rows($result_related)==0){ - prnMsg( _('The part code entered as related item does not exist in the database') . ': ' . $_POST['Related'] . _('Only valid parts can be related items'),'error'); - $InputError=1; - } - - $sql = "SELECT related - FROM relateditems - WHERE stockid='".$Item."' - AND related = '" . $_POST['Related'] . "'"; - $result = DB_query($sql); - $myrow = DB_fetch_row($result); - - if (DB_num_rows($result)!=0){ - prnMsg( _('This related item has already been entered.') , 'warn'); - $InputError =1; - } - - if ($_POST['Related'] == $Item){ - prnMsg( _('An item can not be related to itself') , 'warn'); - $InputError =1; - } - - if ($InputError !=1) { - $sql = "INSERT INTO relateditems (stockid, - related) - VALUES ('" . $Item . "', - '" . $_POST['Related'] . "')"; - $ErrMsg = _('The new related item could not be added'); - $result = DB_query($sql,$ErrMsg); - - prnMsg($_POST['Related'] . ' ' . _('is now related to') . ' ' . $Item,'success'); - - /* It is safe to assume that, if A is related to B, B is related to A */ - $sql_reverse = "SELECT related - FROM relateditems - WHERE stockid='".$_POST['Related']."' - AND related = '" . $Item . "'"; - $result_reverse = DB_query($sql_reverse); - $myrow_reverse = DB_fetch_row($result_reverse); - - if (DB_num_rows($result_reverse)==0){ - $sql = "INSERT INTO relateditems (stockid, - related) - VALUES ('" . $_POST['Related'] . "', - '" . $Item . "')"; - $ErrMsg = _('The new related item could not be added'); - $result = DB_query($sql,$ErrMsg); - prnMsg($Item . ' ' . _('is now related to') . ' ' . $_POST['Related'],'success'); - } - } - - unset($_POST['Related']); - -} elseif (isset($_GET['delete'])) { -//the link to delete a selected record was clicked instead of the submit button - - /* Again it is safe to assume that we have to delete both relations A to B and B to A */ - - $sql="DELETE FROM relateditems - WHERE (stockid = '". $Item ."' AND related ='". $_GET['Related'] ."') - OR (stockid = '". $_GET['Related'] ."' AND related ='". $Item ."')"; - $ErrMsg = _('Could not delete this relationshop'); - $result = DB_query($sql,$ErrMsg); - prnMsg( _('This relationship has been deleted'),'success'); - -} - -//Always do this stuff - -$sql = "SELECT stockmaster.stockid, - stockmaster.description - FROM stockmaster, relateditems - WHERE stockmaster.stockid = relateditems.related - AND relateditems.stockid='".$Item."'"; - -$result = DB_query($sql); - -if (DB_num_rows($result) > 0) { - echo '

'; - echo '
'; - echo ' - - - '; - - echo ' - - - - - '; - - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' - '; - echo ''; - echo ''; - - } - //END WHILE LIST LOOP - echo '
- ' . - _('Related Items To') . ': - -
' . _('Code') . '' . _('Description') . '' . _('Delete') . '
' . $myrow['stockid'] . '' . $myrow['description'] . '' . _('Delete') . '

'; - echo '
-
'; -} else { - prnMsg(_('There are no items related set up for this part'),'warn'); -} - -echo '
'; -echo '
'; -echo ''; -if (isset($_GET['Edit'])){ - /*the price sent with the get is sql format price so no need to filter */ - $_POST['Related'] = $_GET['Related']; -} - -echo '
'; - -echo ''; - -echo ' - -

' . $Item . ' - ' . $PartDescription . '

' . _('Related Item Code') . ': - -
-
- -
'; - - -echo '
-
'; -include('includes/footer.php'); - + $Title, '

';// Page title. + +include('includes/SQL_CommonFunctions.inc'); + +//initialise no input errors assumed initially before we test +$InputError = 0; + +if (isset($_GET['Item'])){ + $Item = trim(mb_strtoupper($_GET['Item'])); +}elseif (isset($_POST['Item'])){ + $Item = trim(mb_strtoupper($_POST['Item'])); +} +if (isset($_GET['Related'])){ + $Related = trim(mb_strtoupper($_GET['Related'])); +}elseif (isset($_POST['Related'])){ + $Related = trim(mb_strtoupper($_POST['Related'])); +} + +echo '' . _('Back to Items') . '
'; + + +$result = DB_query("SELECT stockmaster.description + FROM stockmaster + WHERE stockmaster.stockid='".$Item."'"); +$myrow = DB_fetch_row($result); + +if (DB_num_rows($result)==0){ + prnMsg( _('The part code entered does not exist in the database') . ': ' . $Item . _('Only valid parts can have related items entered against them'),'error'); + $InputError=1; +} + + +if (!isset($Item)){ + echo '

'; + prnMsg (_('An item must first be selected before this page is called') . '. ' . _('The product selection page should call this page with a valid product code'),'error'); + include('includes/footer.php'); + exit; +} + +$PartDescription = $myrow[0]; + +if (isset($_POST['submit'])) { + + /* 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 + + $result_related = DB_query("SELECT stockmaster.description, + stockmaster.mbflag + FROM stockmaster + WHERE stockmaster.stockid='".$_POST['Related']."'"); + $myrow_related = DB_fetch_row($result_related); + + if (DB_num_rows($result_related)==0){ + prnMsg( _('The part code entered as related item does not exist in the database') . ': ' . $_POST['Related'] . _('Only valid parts can be related items'),'error'); + $InputError=1; + } + + $sql = "SELECT related + FROM relateditems + WHERE stockid='".$Item."' + AND related = '" . $_POST['Related'] . "'"; + $result = DB_query($sql); + $myrow = DB_fetch_row($result); + + if (DB_num_rows($result)!=0){ + prnMsg( _('This related item has already been entered.') , 'warn'); + $InputError =1; + } + + if ($_POST['Related'] == $Item){ + prnMsg( _('An item can not be related to itself') , 'warn'); + $InputError =1; + } + + if ($InputError !=1) { + $sql = "INSERT INTO relateditems (stockid, + related) + VALUES ('" . $Item . "', + '" . $_POST['Related'] . "')"; + $ErrMsg = _('The new related item could not be added'); + $result = DB_query($sql,$ErrMsg); + + prnMsg($_POST['Related'] . ' ' . _('is now related to') . ' ' . $Item,'success'); + + /* It is safe to assume that, if A is related to B, B is related to A */ + $sql_reverse = "SELECT related + FROM relateditems + WHERE stockid='".$_POST['Related']."' + AND related = '" . $Item . "'"; + $result_reverse = DB_query($sql_reverse); + $myrow_reverse = DB_fetch_row($result_reverse); + + if (DB_num_rows($result_reverse)==0){ + $sql = "INSERT INTO relateditems (stockid, + related) + VALUES ('" . $_POST['Related'] . "', + '" . $Item . "')"; + $ErrMsg = _('The new related item could not be added'); + $result = DB_query($sql,$ErrMsg); + prnMsg($Item . ' ' . _('is now related to') . ' ' . $_POST['Related'],'success'); + } + } + + unset($_POST['Related']); + +} elseif (isset($_GET['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + + /* Again it is safe to assume that we have to delete both relations A to B and B to A */ + + $sql="DELETE FROM relateditems + WHERE (stockid = '". $Item ."' AND related ='". $_GET['Related'] ."') + OR (stockid = '". $_GET['Related'] ."' AND related ='". $Item ."')"; + $ErrMsg = _('Could not delete this relationshop'); + $result = DB_query($sql,$ErrMsg); + prnMsg( _('This relationship has been deleted'),'success'); + +} + +//Always do this stuff + +$sql = "SELECT stockmaster.stockid, + stockmaster.description + FROM stockmaster, relateditems + WHERE stockmaster.stockid = relateditems.related + AND relateditems.stockid='".$Item."'"; + +$result = DB_query($sql); + +if (DB_num_rows($result) > 0) { + echo '

'; + echo '
'; + echo ' + + + '; + + echo ' + + + + + '; + + while ($myrow = DB_fetch_array($result)) { + + echo ' + + + '; + echo ''; + + } + //END WHILE LIST LOOP + echo '
+ ' . + _('Related Items To') . ': + +
' . _('Code') . '' . _('Description') . '' . _('Delete') . '
' . $myrow['stockid'] . '' . $myrow['description'] . '' . _('Delete') . '

'; + echo '
+
'; +} else { + prnMsg(_('There are no items related set up for this part'),'warn'); +} + +echo '
'; +echo '
'; +echo ''; +if (isset($_GET['Edit'])){ + /*the price sent with the get is sql format price so no need to filter */ + $_POST['Related'] = $_GET['Related']; +} + +echo '
'; + +echo ''; + +echo ' + +

' . $Item . ' - ' . $PartDescription . '

' . _('Related Item Code') . ': + +
+
+ +
'; + + +echo '
+
'; +include('includes/footer.php'); + ?> \ No newline at end of file diff --git a/ReorderLevelLocation.php b/ReorderLevelLocation.php index 3bd95298b..5cf5dd4f6 100644 --- a/ReorderLevelLocation.php +++ b/ReorderLevelLocation.php @@ -63,7 +63,7 @@ echo'

' . _('Location : ') . '' . $Location['locationname'] . '

'; echo'

' . _('Number Of Days Sales : ') . '' . locale_number_format($_POST['NumberOfDays'],0) . '' . _(' Days ') . '

'; - $k=0; //row colour counter + echo '
'; echo '
'; echo ''; @@ -81,14 +81,6 @@ $i=1; while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - //variable for update data echo' @@ -117,7 +109,8 @@ $TotQtyResult = DB_query($SqlOH); $TotQtyRow = DB_fetch_array($TotQtyResult); - echo $myrow['stockid'] . ' + echo ' + ' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . locale_number_format($SalesRow['qtyinvoiced'],$myrow['decimalplaces']) . ' ' . locale_number_format($TotQtyRow['qty'],$myrow['decimalplaces']) . ' @@ -136,7 +129,7 @@ $i++; } //end of looping echo' - + diff --git a/ReprintGRN.php b/ReprintGRN.php index 2c3db4b77..ffd51dfcf 100644 --- a/ReprintGRN.php +++ b/ReprintGRN.php @@ -23,7 +23,7 @@ ' . ' - +
@@ -75,7 +75,7 @@ include('includes/footer.php'); exit; } - $k=0; + echo '
@@ -94,14 +94,8 @@ '; while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + diff --git a/ReverseGRN.php b/ReverseGRN.php index 88d783f32..d5b3bcb87 100644 --- a/ReverseGRN.php +++ b/ReverseGRN.php @@ -412,15 +412,7 @@ /* show the GRNs outstanding to be invoiced that could be reversed */ $RowCounter =0; - $k=0; while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $DisplayQtyRecd = locale_number_format($myrow['qtyrecd'],'Variable'); $DisplayQtyInv = locale_number_format($myrow['quantityinv'],'Variable'); @@ -428,7 +420,8 @@ $DisplayDateDel = ConvertSQLDate($myrow['deliverydate']); $LinkToRevGRN = '' . _('Reverse') . ''; - printf(' + printf(' + diff --git a/RevisionTranslations.php b/RevisionTranslations.php index fae7de94b..08874627f 100644 --- a/RevisionTranslations.php +++ b/RevisionTranslations.php @@ -63,33 +63,19 @@ '; -$k=0; //row colour counter $i=1; while($myrow=DB_fetch_array($result)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + - ';// nl2br: Inserts HTML line breaks before all newlines in a string. - - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } + + ';// nl2br: Inserts HTML line breaks before all newlines in a string. - echo ' + echo ' + '; echo ' diff --git a/SalesAnalReptCols.php b/SalesAnalReptCols.php index fcd366d4b..a6a8b73fc 100644 --- a/SalesAnalReptCols.php +++ b/SalesAnalReptCols.php @@ -263,16 +263,8 @@ '; - $k=0; //row colour counter do { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } if ($myrow[11]==1){ $BudOrAct = _('Actual'); } else { @@ -285,7 +277,8 @@ $BudOrAct = _('N/A'); } - printf(' + printf(' + diff --git a/SalesAnalRepts.php b/SalesAnalRepts.php index 31f9492e1..085e5e96b 100644 --- a/SalesAnalRepts.php +++ b/SalesAnalRepts.php @@ -286,19 +286,10 @@ function GrpByDataOptions($GroupByDataX) { '; -$k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + diff --git a/SalesByTypePeriodInquiry.php b/SalesByTypePeriodInquiry.php index 30005ae37..adf1827eb 100644 --- a/SalesByTypePeriodInquiry.php +++ b/SalesByTypePeriodInquiry.php @@ -378,15 +378,10 @@ $PeriodHeadingDone = false; $LastPeriodHeading = 'First Run Through'; - $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } + echo ''; + switch ($_POST['DisplayData']){ case 'Daily': if ($LastPeriodHeading != ConvertSQLDate($SalesRow['trandate'])) { @@ -400,13 +395,10 @@ '; - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + $PrdTotalOrders =0; $PrdTotalSales=0; $PrdTotalRefunds=0; @@ -435,13 +427,10 @@ '; - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + $PrdTotalOrders =0; $PrdTotalSales=0; $PrdTotalRefunds=0; @@ -470,13 +459,10 @@ '; - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + $PrdTotalOrders =0; $PrdTotalSales=0; $PrdTotalRefunds=0; @@ -505,13 +491,10 @@ '; - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + $PrdTotalOrders =0; $PrdTotalSales=0; $PrdTotalRefunds=0; @@ -528,7 +511,12 @@ echo ''; } break; - } + } // end switch + + // This apparently completes the "double-row" that appears within each + // case. The last portion of each case does a PeriodHeadingDone check. + // The output from the PeriodHeadingDone area is the first column to go + // with these below to make 8 columns. echo ' @@ -550,15 +538,10 @@ $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); $CumulativeTotalCost += $SalesRow['cost']; $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); - } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + } // end loop + + echo ' + @@ -566,13 +549,10 @@ '; - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + echo ' diff --git a/SalesCategories.php b/SalesCategories.php index 393f0f465..fa865d56e 100644 --- a/SalesCategories.php +++ b/SalesCategories.php @@ -269,16 +269,7 @@ '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/SALESCAT_' . $myrow['salescatid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); if( extension_loaded('gd') && function_exists('gd_info') && file_exists($imagefile) ) { @@ -299,7 +290,8 @@ $Active = _('No'); } - printf(' + printf(' + @@ -543,18 +535,10 @@ '; - $k=0; //row colour counter - while( $myrow = DB_fetch_array($result) ) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + '; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + @@ -200,13 +193,9 @@ $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); } //loop around category sales for the period - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + echo ''; + echo ''; + echo ' diff --git a/SalesGLPostings.php b/SalesGLPostings.php index d0cbdaa97..e44b548b6 100644 --- a/SalesGLPostings.php +++ b/SalesGLPostings.php @@ -118,18 +118,11 @@ '; - $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + + printf(' + @@ -236,18 +229,10 @@ '; - $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + + printf(' + diff --git a/SalesPeople.php b/SalesPeople.php index 8bfd56ae8..628496c8f 100644 --- a/SalesPeople.php +++ b/SalesPeople.php @@ -213,23 +213,17 @@ '; - $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } if ($myrow[7] == 1) { $ActiveText = _('Yes'); } else { $ActiveText = _('No'); } - printf(' + printf(' + diff --git a/SalesTopCustomersInquiry.php b/SalesTopCustomersInquiry.php index e93e88020..a1d059650 100644 --- a/SalesTopCustomersInquiry.php +++ b/SalesTopCustomersInquiry.php @@ -223,17 +223,11 @@ $CumulativeTotalNetSales = 0; $CumulativeTotalQuantity = 0; $i=1; - $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + @@ -249,13 +243,9 @@ } //loop around category sales for the period - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + echo ''; + echo ''; + echo ' diff --git a/SalesTopItemsInquiry.php b/SalesTopItemsInquiry.php index 660794c87..70fac27f2 100644 --- a/SalesTopItemsInquiry.php +++ b/SalesTopItemsInquiry.php @@ -230,17 +230,11 @@ $CumulativeTotalNetSales = 0; $CumulativeTotalQuantity = 0; $i=1; - $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + @@ -257,13 +251,10 @@ } //loop around category sales for the period - if ($k==1){ - echo ''; - echo ''; - } else { - echo ''; - echo ''; - } + + echo ''; + echo ''; + echo ' diff --git a/SalesTypes.php b/SalesTypes.php index 2ea486933..877aaa9c7 100644 --- a/SalesTypes.php +++ b/SalesTypes.php @@ -190,18 +190,10 @@ '; -$k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/SelectAsset.php b/SelectAsset.php index 72f5d9a82..b1373c271 100644 --- a/SelectAsset.php +++ b/SelectAsset.php @@ -267,20 +267,13 @@ '; echo $tableheader; $j = 1; - $k = 0; //row counter to determine background colour $RowIndex = 0; if (DB_num_rows($SearchResult) <> 0) { DB_data_seek($SearchResult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while (($myrow = DB_fetch_array($SearchResult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + diff --git a/SelectCompletedOrder.php b/SelectCompletedOrder.php index 7ef9b4e25..16f87f88c 100644 --- a/SelectCompletedOrder.php +++ b/SelectCompletedOrder.php @@ -513,19 +513,11 @@ echo $TableHeadings; $j = 1; - $k=0; //row colour counter while ($myrow=DB_fetch_array($StockItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + @@ -574,24 +566,16 @@ echo $tableheader; $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($SalesOrdersResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } + while ($myrow=DB_fetch_array($SalesOrdersResult)) { $ViewPage = $RootPath . '/OrderDetails.php?OrderNumber=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); - printf(' + printf(' + diff --git a/SelectContract.php b/SelectContract.php index 0d365206d..4043a7d37 100644 --- a/SelectContract.php +++ b/SelectContract.php @@ -152,15 +152,9 @@ echo $TableHeader; $j = 1; -$k=0; //row colour counter + while ($myrow=DB_fetch_array($ContractsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } + echo ''; $ModifyPage = $RootPath . '/Contracts.php?ModifyContractRef=' . $myrow['contractref']; $OrderModifyPage = $RootPath . '/SelectOrderItems.php?ModifyOrderNumber=' . $myrow['orderno']; diff --git a/SelectCreditItems.php b/SelectCreditItems.php index 22b6d26a5..7226089a9 100644 --- a/SelectCreditItems.php +++ b/SelectCreditItems.php @@ -249,24 +249,16 @@ echo $TableHeader; $j = 1; - $k = 0; //row counter to determine background colour $LastCustomer=''; while ($myrow=DB_fetch_array($result_CustSelect)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - if ($LastCustomer != $myrow['name']) { echo ''; } else { echo ''; } - echo ' + @@ -705,21 +697,13 @@ $TaxTotals = array(); $TaxGLCodes = array(); - $k =0; //row colour counter foreach ($_SESSION['CreditItems'.$identifier]->LineItems as $LineItem) { $LineTotal = round($LineItem->Quantity * $LineItem->Price * (1 - $LineItem->DiscountPercent),$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); $DisplayLineTotal = locale_number_format($LineTotal,$_SESSION['CreditItems'.$identifier]->CurrDecimalPlaces); - if ($k==1){ - $RowStarter = ''; - $k=0; - } else { - $RowStarter = ''; - $k++; - } - - echo $RowStarter . ' + echo ' + '; if ($LineItem->Controlled==0){ @@ -776,8 +760,9 @@ '; - echo $RowStarter; - echo ''; + echo ' + + '; $_SESSION['CreditItems'.$identifier]->total += $LineTotal; @@ -1022,16 +1007,8 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); @@ -1042,19 +1019,23 @@ '&width=64'. '&height=64'. '" alt="" />'; - printf(' + printf(' + - ', + + ', $myrow['stockid'], $myrow['description'], $myrow['units'], $myrow['stockid']); } else { //don't try to show the image - printf(' + printf(' + - ', + + ', $myrow['stockid'], $myrow['description'], $myrow['units']); @@ -1076,7 +1057,7 @@ for ($i=1;$i<=$_SESSION['QuickEntries'];$i++){ - echo ' + echo ''; diff --git a/SelectCustomer.php b/SelectCustomer.php index c13f46164..cdff536cf 100644 --- a/SelectCustomer.php +++ b/SelectCustomer.php @@ -408,7 +408,6 @@ '; - $k = 0;// row counter to determine background colour $RowIndex = 0; }// end if NOT producing a CSV file if(DB_num_rows($result) <> 0) { @@ -426,14 +425,8 @@ $i = 0;// counter for input controls echo ''; while (($myrow = DB_fetch_array($result)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + echo ' + @@ -579,7 +572,7 @@ - +
' . $myrow['suppname'] . '
' . $myrow['suppname'] . ' ' . $myrow['podetailitem'] . ' ' . $myrow['grnbatch'] . ' ' . $myrow['itemcode'] . '
%s
%s %s %s %s' . _('Revised?') . '
' . $myrow['stockid'] . '
' . $myrow['stockid'] . ' ' . $_SESSION['Language']. ' ' . $myrow['description'] . ' ' . nl2br($myrow['longdescription']) . ' 
 
 
  ' . $myrow['language_id'] . '' . _('Operator') . ' ' . _('Budget') . '
' . _('Or Actual') . '
%s
%s %s %s %s' . _('Report Title') . '
%s
%s %s ' . _('Design') . ' ' . _('Define Columns') . '
' . locale_number_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '



' . locale_number_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '



' . locale_number_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '



' . locale_number_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '



' . $SalesRow['tpe'] . ' ' . $SalesRow['nooforders'] . ' ' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '
' . _('Total') . ' ' . $LastPeriodHeading . '
' . _('Total') . ' ' . $LastPeriodHeading . ' ' . $PrdTotalOrders . ' ' . locale_number_format($PrdTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '' . locale_number_format($PrdTotalCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($PrdTotalGP,$_SESSION['CompanyRecord']['decimalplaces']) . '



' . _('GRAND Total') . ' ' . $CumulativeTotalOrders . ' ' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . '' . _('Active?') . '
%s
%s %s ' . _('Select') . ' ' . _('Edit') . '' . _('Featured') . '
' . $myrow['stockid'] . '
' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['manufacturers_name'] . ' '; diff --git a/SalesCategoryPeriodInquiry.php b/SalesCategoryPeriodInquiry.php index 7a23da87e..96921a1b6 100644 --- a/SalesCategoryPeriodInquiry.php +++ b/SalesCategoryPeriodInquiry.php @@ -175,17 +175,10 @@ $CumulativeTotalCost = 0; $CumulativeTotalGP = 0; - $k=0; while ($SalesRow=DB_fetch_array($SalesResult)) { - if ($k==1){ - echo '
' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . '
' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . ' ' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '



' . _('GRAND Total') . ' ' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '' . _('Sales Account') . ' ' . _('Discount Account') . '
%s
%s %s %s %s' . _('Discount Account') . '
%s
%s %s %s %s' . _('Comm Rate 2') . ' ' . _('Current') . '
%s
%s %s %s %s
' . $i . '
' . $i . ' ' . $SalesRow['debtorno'] . ' - ' . $SalesRow['name'] . ' ' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($SalesRow['returnvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '



' . _('GRAND Total') . ' ' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '
' . $i . '
' . $i . ' ' . $SalesRow['stockid'] . ' - ' . $SalesRow['description'] . ' ' . $SalesRow['categorydescription'] . ' ' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '



' . _('GRAND Total') . ' ' . locale_number_format($CumulativeTotalSales,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($CumulativeTotalRefunds,$_SESSION['CompanyRecord']['decimalplaces']) . '' . _('Type Name') . '
%s
%s %s ' . _('Edit') . ' ' . _('Delete') . '
' . $myrow['description'] . ' ' . $myrow['locationdescription'] . ' ' . ConvertSQLDate($myrow['datepurchased']) . '
%s %s %s
%s
%s %s %s %s
' . $myrow['name'] . ' + echo '
' . $myrow['contactname'] . '
' . $LineItem->StockID . '
' . $LineItem->StockID . ' ' . $LineItem->ItemDescription . '' . _('Delete') . '


%s %s' . $ImageSource . '
' . $ImageSource . '
%s %s' . _('No Image') . '
' . _('No Image') . '
' . _('Email') . '
', htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false), ' ', htmlspecialchars($myrow['brname'], ENT_QUOTES, 'UTF-8', false), ' ', $myrow['contactname'], '
'; @@ -740,17 +733,10 @@ function initMap() { '; - $k = 0;// row colour counter + while ($myrow = DB_fetch_array($result)) { - if($k == 1) { - echo ''; - $k = 0; - }// $k == 1 - else { - echo ''; - $k = 1; - } - echo '' , $myrow[2] , ' + echo ' + ' , $myrow[2] , ' ' , $myrow[3] , ' ' , $myrow[4] , ' ' , $myrow[6] . ' @@ -775,7 +761,7 @@ function initMap() { $result2 = DB_query($SQL); $BranchContact = DB_fetch_row($result2); - echo ' + echo ' ' . $BranchContact[2] . ' ' . _('Branch Contact') . ' ' . $BranchContact[0] . ' ' . $BranchContact[3] . ' @@ -815,17 +801,10 @@ function initMap() { ' . _('Delete') . ' ' . ' ' . _('Add New Note') . ' '; - $k = 0;// row colour counter + while ($myrow = DB_fetch_array($result)) { - if($k == 1) { - echo ''; - $k = 0; - }// $k == 1 - else { - echo ''; - $k = 1; - } - echo '' . ConvertSQLDate($myrow['date']) . ' + echo ' + ' . ConvertSQLDate($myrow['date']) . ' ' . $myrow['note'] . ' ' . $myrow['href'] . ' ' . $myrow['priority'] . ' @@ -857,16 +836,10 @@ function initMap() { ' . _('Delete') . ' ' . _('Add New Group Note') . ' '; - $k = 0;// row colour counter + while ($myrow = DB_fetch_array($result)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '' . $myrow[4] . ' + echo ' + ' . $myrow[4] . ' ' . $myrow[3] . ' ' . $myrow[2] . ' ' . $myrow[5] . ' diff --git a/SelectOrderItems.php b/SelectOrderItems.php index 752d28211..2cf735321 100644 --- a/SelectOrderItems.php +++ b/SelectOrderItems.php @@ -634,19 +634,11 @@ '; $j = 1; - $k = 0; //row counter to determine background colour $LastCustomer=''; while ($myrow=DB_fetch_array($result_CustSelect)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' ' . htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false) . ' + echo ' + ' . htmlspecialchars($myrow['name'], ENT_QUOTES, 'UTF-8', false) . ' @@ -1375,7 +1367,7 @@ $_SESSION['Items'.$identifier]->total = 0; $_SESSION['Items'.$identifier]->totalVolume = 0; $_SESSION['Items'.$identifier]->totalWeight = 0; - $k =0; //row colour counter + foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { $LineTotal = $OrderLine->Quantity * $OrderLine->Price * (1 - $OrderLine->DiscountPercent); @@ -1387,12 +1379,8 @@ if ($OrderLine->QOHatLoc < $OrderLine->Quantity AND ($OrderLine->MBflag=='B' OR $OrderLine->MBflag=='M')) { /*There is a stock deficiency in the stock location selected */ $RowStarter = ''; //rows show red where stock deficiency - } elseif ($k==1){ - $RowStarter = ''; - $k=0; } else { - $RowStarter = ''; - $k=1; + $RowStarter = ''; } echo $RowStarter; @@ -1445,9 +1433,9 @@ echo '' . $RemTxt . ''; if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ - echo $RowStarter; $varColSpan=8+$ShowPOLine+$ShowDiscountGP; - echo '' . _('Narrative') . ':
+ echo $RowStarter . + '' . _('Narrative') . ':
'; } else { echo ' @@ -1468,7 +1456,7 @@ $ColSpanNumber = 1; }*/ $varColSpan=1+$ShowPOLine+$ShowDiscountGP; - echo ' + echo ' ' . _('TOTAL Excl Tax/Freight') . ' ' . $DisplayTotal . ' @@ -1477,7 +1465,7 @@ $DisplayVolume = locale_number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = locale_number_format($_SESSION['Items'.$identifier]->totalWeight,2); echo ' - + @@ -1538,7 +1526,6 @@ '; $i=0; $j=1; - $k=0; //row colour counter while ($myrow=DB_fetch_array($result2)) { // This code needs sorting out, but until then : @@ -1576,18 +1563,12 @@ // Get the QOO dues to Work Orders for all locations. Function defined in SQL_CommonFunctions.inc $WoQty = GetQuantityOnOrderDueToWorkOrders($myrow['stockid'], ''); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $OnOrder = $PurchQty + $WoQty; $Available = $QOH - $DemandQty + $OnOrder; - printf(' + printf(' + @@ -1614,7 +1595,7 @@ #end of page full new headings if } #end of while loop for Frequently Ordered Items - echo ''; + echo ''; echo '
' . _('Total Weight') . ':
' . _('Total Weight') . ': ' . $DisplayWeight . ' ' . _('Total Volume') . ': ' . $DisplayVolume . '
%s
%s %s %s %s
'; } //end of if Frequently Ordered Items > 0 echo '
' . $msg; @@ -1665,12 +1646,12 @@ '; echo ' - - '; + + '; if (in_array($_SESSION['PageSecurityArray']['ConfirmDispatch_Invoice.php'], $_SESSION['AllowedPageSecurityTokens'])){ //not a customer entry of own order - echo ' - '; + echo ' + '; } echo ' @@ -1713,7 +1694,6 @@ '; $ImageSource = _('No Image'); $i=0; - $k=0; //row colour counter while ($myrow=DB_fetch_array($SearchResult)) { @@ -1752,17 +1732,11 @@ // Get the QOO dues to Work Orders for all locations. Function defined in SQL_CommonFunctions.inc $WoQty = GetQuantityOnOrderDueToWorkOrders($myrow['stockid'], ''); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } $OnOrder = $PurchQty + $WoQty; $Available = $QOH - $DemandQty + $OnOrder; - printf('%s + printf(' + %s %s %s %s diff --git a/SelectProduct.php b/SelectProduct.php index 19b5134e7..d2505370e 100644 --- a/SelectProduct.php +++ b/SelectProduct.php @@ -342,7 +342,7 @@ echo ' - + @@ -851,19 +851,11 @@ '; echo $TableHeader; $j = 1; - $k = 0; //row counter to determine background colour $RowIndex = 0; if (DB_num_rows($SearchResult) <> 0) { DB_data_seek($SearchResult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while (($myrow = DB_fetch_array($SearchResult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } if ($myrow['mbflag'] == 'D') { $qoh = _('N/A'); } else { @@ -890,7 +882,8 @@ $StockImgLink = '

'._('No Image').'

'; } - echo ' + echo ' + diff --git a/SelectQASamples.php b/SelectQASamples.php index 6d3fa2da1..eee660284 100644 --- a/SelectQASamples.php +++ b/SelectQASamples.php @@ -302,16 +302,10 @@ '; echo $TableHeader; $j = 1; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($StockItemsResult)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + @@ -404,15 +398,8 @@ '; echo $TableHeader; $j = 1; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($SampleResult)) { - if ($k == 1) { /*alternate bgcolour of row for highlighting */ - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } $ModifySampleID = $RootPath . '/TestPlanResults.php?SelectedSampleID=' . $myrow['sampleid']; $Edit = '' . _('Edit') .''; $Delete = '' . _('Delete').''; @@ -426,7 +413,8 @@ $CertAllowed=_('No'); } - echo ' + echo ' + diff --git a/SelectRecurringSalesOrder.php b/SelectRecurringSalesOrder.php index 13774953f..8f1973331 100644 --- a/SelectRecurringSalesOrder.php +++ b/SelectRecurringSalesOrder.php @@ -100,24 +100,16 @@ echo $tableheader; $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($SalesOrdersResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo '';; - $k++; - } + while ($myrow=DB_fetch_array($SalesOrdersResult)) { $ModifyPage = $RootPath . '/RecurringSalesOrders.php?ModifyRecurringSalesOrder=' . $myrow['recurrorderno']; $FormatedLastRecurrence = ConvertSQLDate($myrow['lastrecurrence']); $FormatedStopDate = ConvertSQLDate($myrow['stopdate']); $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$myrow['currdecimalplaces']); - printf(' + printf(' + diff --git a/SelectSalesOrder.php b/SelectSalesOrder.php index 90b16a318..feed3c061 100644 --- a/SelectSalesOrder.php +++ b/SelectSalesOrder.php @@ -643,19 +643,10 @@ '; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($StockItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + @@ -942,20 +933,10 @@ echo $TableHeader; - $k=0; //row colour counter $OrdersTotal =0; while ($myrow=DB_fetch_array($SalesOrdersResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $ModifyPage = $RootPath . '/SelectOrderItems.php?ModifyOrderNumber=' . $myrow['orderno']; $Confirm_Invoice = $RootPath . '/ConfirmDispatch_Invoice.php?OrderNumber=' .$myrow['orderno']; $PrintPickList = ''; @@ -1005,7 +986,8 @@ /*Check authority to create POs if user has authority then show the check boxes to select sales orders to place POs for otherwise don't provide this option */ if ($AuthRow['cancreate']==0 AND $myrow['poplaced']==0){ //cancreate==0 if the user can create POs and not already placed - echo ' + echo ' + ' . $PrintPickLabel . ' @@ -1021,7 +1003,8 @@ '; } else { /*User is not authorised to create POs so don't even show the option */ - printf(' + printf(' + ' . $PrintPickLabel . ' @@ -1052,7 +1035,8 @@ } } else { /*must be quotes only */ - printf(' + printf(' + diff --git a/SelectSupplier.php b/SelectSupplier.php index abeaead42..4f065736e 100644 --- a/SelectSupplier.php +++ b/SelectSupplier.php @@ -301,20 +301,14 @@ '; - $k = 0; //row counter to determine background colour + $RowIndex = 0; if (DB_num_rows($result) <> 0) { DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while (($myrow = DB_fetch_array($result)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + echo ' + diff --git a/SelectWorkOrder.php b/SelectWorkOrder.php index 887763566..222a3cccd 100644 --- a/SelectWorkOrder.php +++ b/SelectWorkOrder.php @@ -220,19 +220,11 @@ '; - $k=0; //row colour counter while ($myrow=DB_fetch_array($StockItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + @@ -345,17 +337,8 @@ '; - $k=0; //row colour counter while ($myrow=DB_fetch_array($WorkOrdersResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $ModifyPage = $RootPath . '/WorkOrderEntry.php?WO=' . $myrow['wo']; $Status_WO = $RootPath . '/WorkOrderStatus.php?WO=' .$myrow['wo'] . '&StockID=' . urlencode($myrow['stockid']); $Receive_WO = $RootPath . '/WorkOrderReceive.php?WO=' .$myrow['wo'] . '&StockID=' . urlencode($myrow['stockid']); @@ -367,7 +350,8 @@ $FormatedStartDate = ConvertSQLDate($myrow['startdate']); - printf(' + printf(' + diff --git a/SellThroughSupport.php b/SellThroughSupport.php index 3d98eefa8..a85594549 100644 --- a/SellThroughSupport.php +++ b/SellThroughSupport.php @@ -164,16 +164,10 @@ '; echo $TableHeader; - $k = 0; + while ($myrow = DB_fetch_array($SuppliersResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - printf(' + printf(' + @@ -268,15 +262,8 @@ '; echo $TableHeader; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } if ($myrow['categoryid']=='') { $ItemDescription = $myrow['stockid'] . ' - ' . $myrow['description']; } else { @@ -288,7 +275,8 @@ $Customer = $myrow['debtorno'] . ' - ' . $myrow['name']; } - printf(' + printf(' + diff --git a/ShipmentCosting.php b/ShipmentCosting.php index d0c0a27f6..798e015d9 100644 --- a/ShipmentCosting.php +++ b/ShipmentCosting.php @@ -159,20 +159,11 @@ /*show the line items on the shipment with the value invoiced and shipt cost */ - $k=0; //row colour counter $TotalShiptVariance = 0; $RowCounter =0; while ($myrow=DB_fetch_array($LineItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $sql = "SELECT SUM(shipmentcharges.value) AS invoicedcharges FROM shipmentcharges WHERE shipmentcharges.stockid ='" . $myrow['itemcode'] . "' @@ -472,7 +463,8 @@ /* Item / Qty Inv/ FX price/ Local Val/ Portion of chgs/ Shipt Cost/ Std Cost/ Variance/ Var % */ - echo ' + echo ' + @@ -480,7 +472,8 @@ - '; + + '; } } echo ' @@ -544,22 +537,13 @@ /*show the line items on the shipment with the value invoiced and shipt cost */ -$k=0; //row colour counter $RowCounter =0; $TotalItemShipmentChgs =0; while ($myrow=DB_fetch_array($ChargesResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + @@ -620,21 +604,13 @@ /*show the line items on the shipment with the value invoiced and shipt cost */ -$k=0; //row colour counter $RowCounter =0; $TotalGeneralShipmentChgs =0; while ($myrow=DB_fetch_array($ChargesResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + diff --git a/Shipments.php b/Shipments.php index 818f2635f..c908ab8d4 100644 --- a/Shipments.php +++ b/Shipments.php @@ -408,7 +408,6 @@ /*show the line items on the shipment with the quantity being received for modification */ - $k=0; //row colour counter $RowCounter =0; foreach ($_SESSION['Shipment']->LineItems as $LnItm) { @@ -419,16 +418,8 @@ } $RowCounter++; - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - - echo ' + echo ' + @@ -493,7 +484,6 @@ /*show the PO items that could be added to the shipment */ - $k=0; //row colour counter $RowCounter =0; while ($myrow=DB_fetch_array($result)){ @@ -504,15 +494,8 @@ } $RowCounter++; - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + diff --git a/Shippers.php b/Shippers.php index e56fb354b..2bc3c5ee1 100644 --- a/Shippers.php +++ b/Shippers.php @@ -129,20 +129,13 @@ echo '
' . _('Supplier') . '' . _('Code') . '' . _('Code') . ' ' . _('Cost') . ' ' . _('Curr') . ' ' . _('Lead Time') . '
' . $ItemStatus . '
' . $ItemStatus . ' '.$StockImgLink.' ' . $myrow['description'] . '
+ echo '
' . $myrow['description'] . ' ' . locale_number_format($myrow['qoh'],$myrow['decimalplaces']) . ' ' . $myrow['units'] . '
' . str_pad($myrow['sampleid'],10,'0',STR_PAD_LEFT) . '
' . str_pad($myrow['sampleid'],10,'0',STR_PAD_LEFT) . ' ' . $myrow['prodspeckey'] . ' ' . $myrow['description'] . ' ' . $myrow['lotkey'] . '
%s
%s %s %s %s' . _('Units') . '
%s %s %s
' . $myrow['orderno'] . '
' . $myrow['orderno'] . ' ' . _('Acknowledge') . '' . $PrintDummyFlag . '' . _('Invoice') . '
%s
%s ' . _('Acknowledge') . '' . _('Invoice') . '%s
%s ' . _('Landscape') . '  ' . _('Portrait') . ' %s %s' . _('Email') . ' ' . _('URL') . '
' . $myrow['suppname'] . ' ' . $myrow['currcode'] . ' ' . $myrow['address1'] . '' . _('On Hand') . ' ' . _('Units') . '
%s %s %s' . _('Required Date') . '
%s
%s ' . _('Status') . ' ' . _('Issue To') . ' ' . _('Receive') . '' . _('Address 3') . '
%s %s %s
%s
%s %s %s %s
' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '
' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . ' ' . locale_number_format($myrow['totqtyinvoiced'],'Variable') . ' ' . locale_number_format($myrow['totqtyrecd'],'Variable') . ' ' . locale_number_format($ItemCharges,$_SESSION['CompanyRecord']['decimalplaces']) . '' . locale_number_format($ItemShipmentCost,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($StdCostUnit,$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($Variance,$_SESSION['CompanyRecord']['decimalplaces']) . '' . $VariancePercentage . '%
' . $VariancePercentage . '%
' . $myrow['suppname'] . '
' . $myrow['suppname'] . ' ' .$myrow['typename'] . ' ' . $myrow['suppreference'] . ' ' . ConvertSQLDate($myrow['trandate']) . '
' . $myrow['suppname'] . '
' . $myrow['suppname'] . ' ' .$myrow['typename'] . ' ' . $myrow['suppreference'] . ' ' . ConvertSQLDate($myrow['trandate']) . '
' . $LnItm->OrderNo . '
' . $LnItm->OrderNo . ' ' . $LnItm->StockID .' - '. $LnItm->ItemDescription. '' . locale_number_format($LnItm->QuantityOrd,$LnItm->DecimalPlaces) . ' ' . $LnItm->UOM . ' ' . locale_number_format($LnItm->QuantityRecd,$LnItm->DecimalPlaces) . '
' . $myrow['orderno'] . '
' . $myrow['orderno'] . ' ' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . ' ' . locale_number_format($myrow['quantityord'],$myrow['decimalplaces']) . ' ' . $myrow['units'] . '
'; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + - ', + + ', $myrow[0], $myrow[1], htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?' , diff --git a/Shipt_Select.php b/Shipt_Select.php index a2d43b8fa..9f715b477 100644 --- a/Shipt_Select.php +++ b/Shipt_Select.php @@ -196,24 +196,18 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter while ($myrow=DB_fetch_array($StockItemsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } /* Code Description On Hand Orders Ostdg Units Code Description On Hand Orders Ostdg Units */ - printf(' + printf(' + - ', + + ', $myrow['stockid'], $myrow['description'], locale_number_format($myrow['qoh'],$myrow['decimalplaces']), @@ -300,17 +294,8 @@ echo $TableHeader; $j = 1; - $k=0; //row colour counter - while ($myrow=DB_fetch_array($ShipmentsResult)) { - - if ($k==1){ /*alternate bgcolour of row for highlighting */ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } + while ($myrow=DB_fetch_array($ShipmentsResult)) { $URL_Modify_Shipment = $RootPath . '/Shipments.php?SelectedShipment=' . $myrow['shiptref']; $URL_View_Shipment = $RootPath . '/ShipmentCosting.php?SelectedShipment=' . $myrow['shiptref']; @@ -322,7 +307,8 @@ $URL_Close_Shipment = $URL_View_Shipment . '&Close=Yes'; - printf(' + printf(' + @@ -341,7 +327,8 @@ $URL_Close_Shipment); } else { - printf(' + printf(' + diff --git a/ShiptsList.php b/ShiptsList.php index 8aa1a7b25..108e39ad8 100644 --- a/ShiptsList.php +++ b/ShiptsList.php @@ -39,18 +39,11 @@ '; $j = 1; -$k = 0; //row colour counter while ($myrow=DB_fetch_array($ShiptsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + '; diff --git a/SpecialOrder.php b/SpecialOrder.php index 4b34f1afd..4dafc3c10 100644 --- a/SpecialOrder.php +++ b/SpecialOrder.php @@ -151,19 +151,11 @@ echo $TableHeader; $j = 1; - $k = 0; //row counter to determine background colour while ($myrow=DB_fetch_array($BranchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - printf(' + printf(' + ', $myrow['branchcode'], @@ -635,7 +627,7 @@ '; $_SESSION['SPL'.$identifier]->total = 0; - $k = 0; //row colour counter + foreach ($_SESSION['SPL'.$identifier]->LineItems as $SPLLine) { $LineTotal = $SPLLine->Quantity * $SPLLine->Price; @@ -648,14 +640,8 @@ $DisplayPrice = locale_number_format($SPLLine->Price,$_SESSION['SPL'.$identifier]->CustCurrDecimalPlaces); $DisplayQuantity = locale_number_format($SPLLine->Quantity,'Variable'); - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' + echo ' + diff --git a/StockCategories.php b/StockCategories.php index 70f730f92..df91e3702 100644 --- a/StockCategories.php +++ b/StockCategories.php @@ -273,17 +273,9 @@ '; - $k=0; //row colour counter - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/StockCategorySalesInquiry.php b/StockCategorySalesInquiry.php index 5b480a1ad..83c9e2395 100644 --- a/StockCategorySalesInquiry.php +++ b/StockCategorySalesInquiry.php @@ -134,9 +134,8 @@ $CategorySales = 0; $CategoryQty = 0; $CategoryCOGS = 0; - - $k=0; $CategoryID =''; + while ($SalesRow=DB_fetch_array($SalesResult)) { if ($CategoryID != $SalesRow['categoryid']) { if ($CategoryID !='') { @@ -167,15 +166,8 @@ $CategoryID = $SalesRow['categoryid']; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo ' + echo ' + diff --git a/StockLocMovements.php b/StockLocMovements.php index c96df219d..69d8f327b 100644 --- a/StockLocMovements.php +++ b/StockLocMovements.php @@ -100,22 +100,13 @@ echo $tableheader; $j = 1; -$k=0; //row colour counter while ($myrow=DB_fetch_array($MovtsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $DisplayTranDate = ConvertSQLDate($myrow['trandate']); - - printf(' + printf(' + diff --git a/StockLocStatus.php b/StockLocStatus.php index 4bc49501b..77ed878cb 100644 --- a/StockLocStatus.php +++ b/StockLocStatus.php @@ -181,7 +181,6 @@ '; - $k=0; //row colour counter while($myrow=DB_fetch_array($LocStockResult)) { @@ -252,23 +251,15 @@ if(($_POST['BelowReorderQuantity']=='NotZero') AND (($myrow['quantity']-$DemandQty)>0)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $tr = ($myrow['serialised'] or $myrow['controlled'])?'':''; - printf(' + printf(' + - - ' . $tr, + ', mb_strtoupper($myrow['stockid']), mb_strtoupper($myrow['stockid']), $myrow['description'], @@ -287,14 +278,8 @@ echo ''; } } else if($_POST['BelowReorderQuantity']!='NotZero') { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf(' + printf(' + diff --git a/StockLocTransferReceive.php b/StockLocTransferReceive.php index 3326d569f..3a5897b81 100644 --- a/StockLocTransferReceive.php +++ b/StockLocTransferReceive.php @@ -523,7 +523,7 @@ echo '

' . ' ' . $Title . '

'; - echo ''; + echo ''; echo '
'; echo ''; @@ -548,17 +548,11 @@
'; echo $tableheader; - $k=0; + foreach ($_SESSION['Transfer']->TransferItem AS $TrfLine) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + '; echo ''; @@ -663,17 +657,11 @@ '; - $k=0; + while ($myrow=DB_fetch_array($TrfResult)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + diff --git a/StockMovements.php b/StockMovements.php index ce34c930c..7192ff74e 100644 --- a/StockMovements.php +++ b/StockMovements.php @@ -116,23 +116,15 @@ echo $tableheader; $j = 1; -$k=0; //row colour counter while ($myrow=DB_fetch_array($MovtsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $DisplayTranDate = ConvertSQLDate($myrow['trandate']); if ($myrow['type']==10){ /*its a sales invoice allow link to show invoice it was sold on*/ - printf(' + printf(' + @@ -160,7 +152,8 @@ } elseif ($myrow['type']==11){ - printf(' + printf(' + @@ -187,7 +180,8 @@ locale_number_format($myrow['newqoh'],$myrow['decimalplaces'])); } else { - printf(' + printf(' + diff --git a/StockQuantityByDate.php b/StockQuantityByDate.php index 6f952dd7d..a074a7410 100644 --- a/StockQuantityByDate.php +++ b/StockQuantityByDate.php @@ -128,30 +128,25 @@ $NumRows = DB_num_rows($LocStockResult); $j = 1; - $k=0; //row colour counter while ($LocQtyRow=DB_fetch_array($LocStockResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - if($NumRows == 0){ - printf(' + printf(' + - ', + + ', 'StockID=' . mb_strtoupper($myrows['stockid']), mb_strtoupper($myrows['stockid']), $myrows['description'], 0); } else { - printf(' + printf(' + - ', + + ', 'StockID=' . mb_strtoupper($myrows['stockid']), mb_strtoupper($myrows['stockid']), $myrows['description'], diff --git a/StockReorderLevel.php b/StockReorderLevel.php index 1b38e879d..749889aa5 100644 --- a/StockReorderLevel.php +++ b/StockReorderLevel.php @@ -61,18 +61,9 @@ '; echo $TableHeader; -$k=0; //row colour counter while ($myrow=DB_fetch_array($LocStockResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - if (isset($_POST['UpdateData']) AND $_POST['Old_' . $myrow['loccode']]!= filter_number_format($_POST[$myrow['loccode']]) AND is_numeric(filter_number_format($_POST[$myrow['loccode']])) @@ -91,9 +82,11 @@ } else { $UpdateCode='%s'; } - printf(' + printf(' + - ', + + ', $myrow['locationname'], locale_number_format($myrow['quantity'],$myrow['decimalplaces']), $myrow['loccode'], diff --git a/StockSerialItems.php b/StockSerialItems.php index b0a0b972d..8ad2abff5 100644 --- a/StockSerialItems.php +++ b/StockSerialItems.php @@ -132,16 +132,10 @@ $TotalQuantity =0; $j = 1; $Col =0; -$BGColor ='#CCCCCC'; + while ($myrow=DB_fetch_array($LocStockResult)) { - if ($Col==0 AND $BGColor=='#EEEEEE'){ - $BGColor ='#CCCCCC'; - echo ''; - } elseif ($Col==0){ - $BGColor ='#EEEEEE'; - echo ''; - } + echo ''; $TotalQuantity += $myrow['quantity']; diff --git a/StockStatus.php b/StockStatus.php index 9c71bfec0..cce6c9a6d 100644 --- a/StockStatus.php +++ b/StockStatus.php @@ -102,18 +102,9 @@ } echo $TableHeader; $j = 1; -$k=0; //row colour counter while ($myrow=DB_fetch_array($LocStockResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem FROM salesorderdetails INNER JOIN salesorders ON salesorders.orderno = salesorderdetails.orderno @@ -217,7 +208,8 @@ '; } - printf(' + printf(' + @@ -333,7 +325,6 @@ '; $j = 0; - $k = 0; //row colour counter foreach($PriceHistory as $PreviousPrice) { $j--; @@ -342,15 +333,8 @@ echo $TableHeader; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - printf(' + printf(' + diff --git a/StockUsage.php b/StockUsage.php index 9ded9b3d2..1fb40b57b 100644 --- a/StockUsage.php +++ b/StockUsage.php @@ -151,27 +151,17 @@ '; echo $tableheader; - $j = 1; - $k=0; //row colour counter - $TotalUsage = 0; $PeriodsCounter =0; while ($myrow=DB_fetch_array($MovtsResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - $DisplayDate = MonthAndYearFromSQLDate($myrow['lastdate_in_period']); $TotalUsage += $myrow['qtyused']; $PeriodsCounter++; - printf(' + printf(' + ', $DisplayDate, diff --git a/SuppPriceList.php b/SuppPriceList.php index 192c48667..a140f623c 100644 --- a/SuppPriceList.php +++ b/SuppPriceList.php @@ -217,17 +217,10 @@ '; - $k = 0; + while ($myrow = DB_fetch_array($result)){ - echo ''; - $k =1; - } else { - echo ' class="EvenTableRows">'; - $k = 0; - } - echo ' + echo ' + diff --git a/SuppWhereAlloc.php b/SuppWhereAlloc.php index 07b899dd0..bc3f45519 100644 --- a/SuppWhereAlloc.php +++ b/SuppWhereAlloc.php @@ -142,18 +142,9 @@ '; $RowCounter = 1; - $k = 0; //row colour counter $AllocsTotal = 0; while($myrow=DB_fetch_array($TransResult)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - if($myrow['type']==21) { $TransType = _('Debit Note'); } elseif($myrow['type'] == 20) { @@ -161,7 +152,8 @@ } else { $TransType = _('Payment'); } - echo ' + echo ' + diff --git a/SupplierAllocations.php b/SupplierAllocations.php index 37872beb8..a5d8ae027 100644 --- a/SupplierAllocations.php +++ b/SupplierAllocations.php @@ -461,7 +461,7 @@ '; - $k = 0; + $Counter = 0; $RowCounter = 0; $TotalAllocated = 0; @@ -470,13 +470,6 @@ /*Alternate the background colour for each potential allocation line */ - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $RowCounter++; if ($RowCounter == 15){ @@ -487,7 +480,8 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); - echo ' + echo ' + @@ -579,17 +573,11 @@ /* set up table of TransType - Supplier - Trans No - Date - Total - Left to alloc */ $RowCounter = 0; - $k = 0; //row colour counter + while ($myrow = DB_fetch_array($result)) { - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - printf(' + printf(' + @@ -654,18 +642,11 @@ /* set up table of Tran Type - Supplier - Trans No - Date - Total - Left to alloc */ - $k = 0; //row colour counter $RowCounter = 0; while ($myrow = DB_fetch_array($result)) { - if ($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - printf(' + printf(' + diff --git a/SupplierGRNAndInvoiceInquiry.php b/SupplierGRNAndInvoiceInquiry.php index e1a003d01..b07d880d3 100644 --- a/SupplierGRNAndInvoiceInquiry.php +++ b/SupplierGRNAndInvoiceInquiry.php @@ -1,99 +1,93 @@ -'. _('Select Supplier') . ''; - include('includes/footer.php'); - exit; -} -if (isset($_GET['SupplierName'])) { - $SupplierName = $_GET['SupplierName']; -} -if (!isset($_POST['SupplierRef']) OR trim($_POST['SupplierRef'])=='') { - $_POST['SupplierRef'] = ''; - if (empty($_POST['GRNBatchNo']) AND empty($_POST['InvoiceNo'])) { - $_POST['GRNBatchNo'] = ''; - $_POST['InvoiceNo'] = ''; - } elseif (!empty($_POST['GRNBatchNo']) AND !empty($_POST['InvoiceNo'])) { - $_POST['InvoiceNo'] = ''; - } -} elseif (isset($_POST['GRNBatchNo']) OR isset($_POST['InvoiceNo'])) { - $_POST['GRNBatchNo'] = ''; - $_POST['InvoiceNo'] = ''; -} -echo '

' . _('Supplier Invoice and Delivery Note Inquiry') . '' . _('Supplier') . ': ' . $SupplierName . '

'; -echo '
' . _('The supplier\'s delivery note is prefer to GRN No, and GRN No is prefered to Invoice No').'
'; -echo ' - - '; - -echo '
' . _('Shipper ID'). '' . _('Shipper Name'). '
%s
%s %s ' . _('Edit') . '' . _('Delete'). '
' . _('Delete'). '
%s %s %s%s
%s
%s
%s %s %s %s%s
%s %s %s %s' . _('ETA'). '
' . $myrow['shiptref'] . '
' . $myrow['shiptref'] . ' ' . $myrow['vessel'] . ' ' . ConvertSQLDate($myrow['eta']) . '
%s
' . $SPLLine->ItemDescription . '
' . $SPLLine->ItemDescription . ' ' . $SPLLine->ReqDelDate . ' ' . $DisplayQuantity . ' ' . $DisplayCost . '' . _('Maintenance') . '
%s
%s %s %s %s
' . $SalesRow['stockid'] . '
' . $SalesRow['stockid'] . ' ' . $SalesRow['description'] . ' ' . locale_number_format($SalesRow['quantitysold'],$_SESSION['CompanyRecord']['decimalplaces']) . ' ' . locale_number_format($SalesRow['salesvalue'],$_SESSION['CompanyRecord']['decimalplaces']) . '
%s
%s %s %s %s', _('Available'), ' ', _('On Order'), '
%s
%s %s %s %s %s %s %s%s%s' . _('Batches') . '
%s
%s %s %s %s
' . $TrfLine->StockID . '
' . $TrfLine->StockID . ' ' . $TrfLine->ItemDescription . '' . locale_number_format($TrfLine->ShipQty, $TrfLine->DecimalPlaces) . '' . _('Transfer Ref'). ' ' . _('Transfer From'). ' ' . _('Dispatch Date'). '
' . $myrow['reference'] . '
' . $myrow['reference'] . ' ' . $myrow['trffromloc'] . ' ' . ConvertSQLDateTime($myrow['shipdate']) . ' ' . _('Receive'). '
%s
%s %s %s %s%s
%s %s %s %s%s
%s %s %s %s
%s
%s %s%s
%s
%s
%s %s%s
%s
%s
%s %s' . $UpdateCode . '
' . $UpdateCode . '
' . $myrow['bin'] . '%s
%s %s %s %s
%s
%s %s %s %s%%
%s
%s %s
' . _('Date From') . ' ' . _('Supp Code') . '
' . $myrow['stockid'] . '
' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $myrow['conversionfactor'] . ' ' . $myrow['price'] . '
', ConvertSQLDate($myrow['trandate']), '
', ConvertSQLDate($myrow['trandate']), ' ' . $TransType . ' ' . $myrow['transno'] . ' ' . $myrow['suppreference'] . '' . _('Yet to') . '
' . _('Allocate') . '
' . _('This') . '
' . _('Allocation') . '
' . $AllocnItem->TransType . '
' . $AllocnItem->TransType . ' ' . $AllocnItem->TypeNo . ' ' . $AllocnItem->TransDate . ' ' . $AllocnItem->SuppRef . '
%s
%s %s %s %s
%s
%s %s %s %s
- - - - - - - -
' . _('Part of Supplier\'s Delivery Note') . ':' . _('GRN No') . ':' . _('Invoice No') . ':
'; -echo '
- -
'; -if (isset($_POST['Submit'])) { - $Where = ''; - if (isset($_POST['SupplierRef']) AND trim($_POST['SupplierRef']) != '') { - $SupplierRef = trim($_POST['SupplierRef']); - $WhereSupplierRef = " AND grns.supplierref LIKE '%" . $SupplierRef . "%'"; - $Where .= $WhereSupplierRef; - } elseif (isset($_POST['GRNBatchNo']) AND trim($_POST['GRNBatchNo']) != '') { - $GRNBatchNo = trim($_POST['GRNBatchNo']); - $WhereGRN = " AND grnbatch LIKE '%" . $GRNBatchNo . "%'"; - $Where .= $WhereGRN; - } elseif (isset($_POST['InvoiceNo']) AND (trim($_POST['InvoiceNo']) != '')) { - $InvoiceNo = trim($_POST['InvoiceNo']); - $WhereInvoiceNo = " AND suppinv LIKE '%" . $InvoiceNo . "%'"; - $Where .= $WhereInvoiceNo; - } - $sql = "SELECT grnbatch, grns.supplierref, suppinv,purchorderdetails.orderno - FROM grns INNER JOIN purchorderdetails ON grns.podetailitem=purchorderdetails.podetailitem - LEFT JOIN suppinvstogrn ON grns.grnno=suppinvstogrn.grnno - WHERE supplierid='" . $SupplierID . "'" . $Where; - $ErrMsg = _('Failed to retrieve supplier invoice and grn data'); - $result = DB_query($sql,$ErrMsg); - if (DB_num_rows($result)>0) { - echo ' - - - - - - '; - $k = 0; - while ($myrow = DB_fetch_array($result)){ - if ($k == 0) { - echo ''; - $k = 1; - } else{ - echo ''; - $k = 0; - } - echo ' - - - - '; - - } - echo '
' . _('Supplier Delivery Note') . '' . _('GRN Batch No') . '' . _('PO No') . '' . _('Invoice No') . '
' . $myrow['supplierref'] . '' . $myrow['grnbatch']. '' . $myrow['orderno'] . '' . $myrow['suppinv'] . '

'; - - } - -} -include('includes/footer.php'); -?> +'. _('Select Supplier') . ''; + include('includes/footer.php'); + exit; +} +if (isset($_GET['SupplierName'])) { + $SupplierName = $_GET['SupplierName']; +} +if (!isset($_POST['SupplierRef']) OR trim($_POST['SupplierRef'])=='') { + $_POST['SupplierRef'] = ''; + if (empty($_POST['GRNBatchNo']) AND empty($_POST['InvoiceNo'])) { + $_POST['GRNBatchNo'] = ''; + $_POST['InvoiceNo'] = ''; + } elseif (!empty($_POST['GRNBatchNo']) AND !empty($_POST['InvoiceNo'])) { + $_POST['InvoiceNo'] = ''; + } +} elseif (isset($_POST['GRNBatchNo']) OR isset($_POST['InvoiceNo'])) { + $_POST['GRNBatchNo'] = ''; + $_POST['InvoiceNo'] = ''; +} +echo '

' . _('Supplier Invoice and Delivery Note Inquiry') . '' . _('Supplier') . ': ' . $SupplierName . '

'; +echo '
' . _('The supplier\'s delivery note is prefer to GRN No, and GRN No is prefered to Invoice No').'
'; +echo ' + + '; + +echo ' + + + + + + + +
' . _('Part of Supplier\'s Delivery Note') . ':' . _('GRN No') . ':' . _('Invoice No') . ':
'; +echo '
+ +
'; +if (isset($_POST['Submit'])) { + $Where = ''; + if (isset($_POST['SupplierRef']) AND trim($_POST['SupplierRef']) != '') { + $SupplierRef = trim($_POST['SupplierRef']); + $WhereSupplierRef = " AND grns.supplierref LIKE '%" . $SupplierRef . "%'"; + $Where .= $WhereSupplierRef; + } elseif (isset($_POST['GRNBatchNo']) AND trim($_POST['GRNBatchNo']) != '') { + $GRNBatchNo = trim($_POST['GRNBatchNo']); + $WhereGRN = " AND grnbatch LIKE '%" . $GRNBatchNo . "%'"; + $Where .= $WhereGRN; + } elseif (isset($_POST['InvoiceNo']) AND (trim($_POST['InvoiceNo']) != '')) { + $InvoiceNo = trim($_POST['InvoiceNo']); + $WhereInvoiceNo = " AND suppinv LIKE '%" . $InvoiceNo . "%'"; + $Where .= $WhereInvoiceNo; + } + $sql = "SELECT grnbatch, grns.supplierref, suppinv,purchorderdetails.orderno + FROM grns INNER JOIN purchorderdetails ON grns.podetailitem=purchorderdetails.podetailitem + LEFT JOIN suppinvstogrn ON grns.grnno=suppinvstogrn.grnno + WHERE supplierid='" . $SupplierID . "'" . $Where; + $ErrMsg = _('Failed to retrieve supplier invoice and grn data'); + $result = DB_query($sql,$ErrMsg); + if (DB_num_rows($result)>0) { + echo ' + + + + + + '; + + while ($myrow = DB_fetch_array($result)){ + echo ' + + + + + '; + + } + echo '
' . _('Supplier Delivery Note') . '' . _('GRN Batch No') . '' . _('PO No') . '' . _('Invoice No') . '
' . $myrow['supplierref'] . '' . $myrow['grnbatch']. '' . $myrow['orderno'] . '' . $myrow['suppinv'] . '

'; + + } + +} +include('includes/footer.php'); +?> diff --git a/SupplierInquiry.php b/SupplierInquiry.php index 2f9bfa100..3c37417e5 100644 --- a/SupplierInquiry.php +++ b/SupplierInquiry.php @@ -222,7 +222,6 @@ $AuthRow = DB_fetch_array($AuthResult); $j = 1; -$k = 0;// Row colour counter. while($MyRow = DB_fetch_array($TransResult)) { if($MyRow['hold'] == 0 AND $MyRow['settled'] == 0) { @@ -236,14 +235,9 @@ // Comment: All table-row (tag tr) must have 10 table-datacells (tag td). if($MyRow['hold'] == 1) { - echo ''; -/* echo '';*/ - } elseif($k == 1) { - echo ''; - $k = 0; + echo ''; } else { - echo ''; - $k = 1; + echo ''; } // Prints first 8 columns that are in common (columns 1-8): diff --git a/SupplierPriceList.php b/SupplierPriceList.php index 108c138e0..eb168df0f 100644 --- a/SupplierPriceList.php +++ b/SupplierPriceList.php @@ -277,21 +277,14 @@ ' . _('Units') . ' '; $j = 1; - $k = 0; //row counter to determine background colour $RowIndex = 0; if(DB_num_rows($searchresult) <> 0) { DB_data_seek($searchresult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); } while(($MyRow = DB_fetch_array($searchresult)) AND ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k++; - } - echo ' + echo ' + ' . $MyRow['description'] . ' ' . $MyRow['units'] . ' '; @@ -471,16 +464,9 @@ ' . _('Address 3') . ' '; - $k = 0; while($MyRow = DB_fetch_array($SuppliersResult)) { - if($k == 1){ - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' + echo ' + ', $MyRow['suppname'], ' ', $MyRow['currcode'], ' ', $MyRow['address1'], ' @@ -534,7 +520,7 @@ echo ' - '; echo ' diff --git a/SupplierTenderCreate.php b/SupplierTenderCreate.php index dfe7c026f..e3b86ceaa 100644 --- a/SupplierTenderCreate.php +++ b/SupplierTenderCreate.php @@ -1,916 +1,895 @@ - '.$Title . '

'; - prnMsg( _('You do not have authority to create supplier tenders for this company.') . '
' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.php'); - exit; -} - -if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { - $Title = _('Authorisation Problem'); - include('includes/header.php'); - echo '

'.$Title . '

'; - prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '
' . - _('Please see your system administrator'), 'warn'); - include('includes/footer.php'); - exit; -} - -if (isset($_POST['Close'])) { - $SQL = "UPDATE tenders SET closed=1 WHERE tenderid='" . $_SESSION['tender'.$identifier]->TenderId . "'"; - $Result = DB_query($SQL); - $_GET['Edit'] = 'Yes'; - unset($_SESSION['tender'.$identifier]); -} - -$ShowTender = 0; - -if (isset($_GET['ID'])) { - $sql = "SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone, - requiredbydate - FROM tenders - INNER JOIN locationusers ON locationusers.loccode=tenders.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql); - $myrow=DB_fetch_array($result); - if (isset($_SESSION['tender'.$identifier])) { - unset($_SESSION['tender'.$identifier]); - } - $_SESSION['tender'.$identifier] = new Tender(); - $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; - $_SESSION['tender'.$identifier]->Location = $myrow['location']; - $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; - $_SESSION['tender'.$identifier]->RequiredByDate = $myrow['requiredbydate']; - - $sql = "SELECT tenderid, - tendersuppliers.supplierid, - suppliers.suppname, - tendersuppliers.email - FROM tendersuppliers - LEFT JOIN suppliers - ON tendersuppliers.supplierid=suppliers.supplierid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], - $myrow['suppname'], - $myrow['email']); - } - - $sql = "SELECT tenderid, - tenderitems.stockid, - tenderitems.quantity, - stockmaster.description, - tenderitems.units, - stockmaster.decimalplaces - FROM tenderitems - LEFT JOIN stockmaster - ON tenderitems.stockid=stockmaster.stockid - WHERE tenderid='" . $_GET['ID'] . "'"; - $result=DB_query($sql); - while ($myrow=DB_fetch_array($result)) { - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $myrow['stockid'], - $myrow['quantity'], - $myrow['description'], - $myrow['units'], - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - } - $ShowTender = 1; -} - -if (isset($_GET['Edit'])) { - $Title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.php'); - echo '

'.$Title . '

'; - $sql = "SELECT tenderid, - location, - address1, - address2, - address3, - address4, - address5, - address6, - telephone - FROM tenders - INNER JOIN locationusers ON locationusers.loccode=tenders.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 - WHERE closed=0 - AND requiredbydate > '" . Date('Y-m-d') . "'"; - $result=DB_query($sql); - echo '
' . _('Find new Item Code') . + ' . _('Find new Item Code') . '
'; - echo ' - - - - - - - - - - '; - while ($myrow=DB_fetch_array($result)) { - echo ' - - - - - - - - - - - '; - } - echo '
' . _('Tender ID') . '' . _('Location') . '' . _('Address 1') . '' . _('Address 2') . '' . _('Address 3') . '' . _('Address 4') . '' . _('Address 5') . '' . _('Address 6') . '' . _('Telephone') . '
' . $myrow['tenderid'] . '' . $myrow['location'] . '' . $myrow['address1'] . '' . $myrow['address2'] . '' . $myrow['address3'] . '' . $myrow['address4'] . '' . $myrow['address5'] . '' . $myrow['address6'] . '' . $myrow['telephone'] . '' . _('Edit') . '
'; - include('includes/footer.php'); - exit; -} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { - $Title = _('Edit an Existing Supplier Tender Request'); - include('includes/header.php'); - echo '

' . $Title . '

'; -} else { - $Title = _('Create a New Supplier Tender Request'); - include('includes/header.php'); - echo '

' . $Title . '

'; -} - -if (isset($_POST['Save'])) { - $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; - $_SESSION['tender'.$identifier]->save($db); - $_SESSION['tender'.$identifier]->EmailSuppliers(); - prnMsg( _('The tender has been successfully saved'), 'success'); - include('includes/footer.php'); - exit; -} - -if (isset($_GET['DeleteSupplier'])) { - $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); - $ShowTender = 1; -} - -if (isset($_GET['DeleteItem'])) { - $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); - $ShowTender = 1; -} - -if (isset($_POST['SelectedSupplier'])) { - $sql = "SELECT suppname, - email - FROM suppliers - WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; - $result = DB_query($sql); - $myrow = DB_fetch_array($result); - if (mb_strlen($myrow['email'])>0) { - $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], - $myrow['suppname'], - $myrow['email']); - } else { - prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); - } - $ShowTender = 1; -} - -if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { - foreach ($_POST as $key => $value) { - if (mb_substr($key,0,7)=='StockID') { - $Index = mb_substr($key,7,mb_strlen($key)-7); - $StockID = $value; - $Quantity = filter_number_format($_POST['Qty'.$Index]); - $UOM = $_POST['UOM'.$Index]; - $sql = "SELECT description, - decimalplaces - FROM stockmaster - WHERE stockid='".$StockID."'"; - $result=DB_query($sql); - $myrow=DB_fetch_array($result); - $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, - $StockID, - $Quantity, - $myrow['description'], - $UOM, - $myrow['decimalplaces'], - DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); - unset($UOM); - } - } - $ShowTender = 1; -} - -if (!isset($_SESSION['tender'.$identifier]) - or isset($_POST['LookupDeliveryAddress']) - or $ShowTender==1) { - - /* Show Tender header screen */ - if (!isset($_SESSION['tender'.$identifier])) { - $_SESSION['tender'.$identifier]=new Tender(); - } - if (!isset($_SESSION['tender'.$identifier]->RequiredByDate)) { - $_SESSION['tender'.$identifier]->RequiredByDate = FormatDateForSQL(date($_SESSION['DefaultDateFormat'])); - } - echo ''; - echo '
'; - echo ''; - echo ''; - echo ' - - - - - - '; - - if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ - /* If this is the first time - * the form loaded set up defaults */ - - $_POST['StkLocation'] = $_SESSION['UserStockLocation']; - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - INNER JOIN locationusers ON locationusers.loccode=.locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 - WHERE locations.loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - - } else { - /*The default location of the user is crook */ - prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . - '. ' . _('Your system administrator needs to amend your user record'),'error'); - } - - - } elseif (isset($_POST['LookupDeliveryAddress'])){ - - $sql = "SELECT deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - tel, - contact - FROM locations - INNER JOIN locationusers ON locationusers.loccode=.locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 - WHERE loccode='" . $_POST['StkLocation'] . "'"; - - $LocnAddrResult = DB_query($sql); - if (DB_num_rows($LocnAddrResult)==1){ - $LocnRow = DB_fetch_array($LocnAddrResult); - $_POST['DelAdd1'] = $LocnRow['deladd1']; - $_POST['DelAdd2'] = $LocnRow['deladd2']; - $_POST['DelAdd3'] = $LocnRow['deladd3']; - $_POST['DelAdd4'] = $LocnRow['deladd4']; - $_POST['DelAdd5'] = $LocnRow['deladd5']; - $_POST['DelAdd6'] = $LocnRow['deladd6']; - $_POST['Tel'] = $LocnRow['tel']; - $_POST['Contact'] = $LocnRow['contact']; - - $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; - $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; - $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; - $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; - $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; - $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; - $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; - $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; - } - } - echo ' - - - '; - - /* Display the details of the delivery location - */ - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo ' - - - '; - echo '

' . _('Tender header details') . '

' . _('Delivery Must Be Made Before') . '
' . _('Warehouse') . ': -
' . _('Delivery Contact') . ':
' . _('Address') . ' 1 :
' . _('Address') . ' 2 :
' . _('Address') . ' 3 :
' . _('Address') . ' 4 :
' . _('Address') . ' 5 :
' . _('Address') . ' 6 :
' . _('Phone') . ':

'; - - /* Display the supplier/item details - */ - echo ''; - - /* Supplier Details - */ - echo ' - '; - /* Item Details - */ - echo ' - -
- '; - echo ' - - '; - echo ' - - - - '; - foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { - echo ' - - - - - '; - } - echo '

' . _('Suppliers To Send Tender') . '

' . _('Supplier Code') . '' ._('Supplier Name') . '' ._('Email Address') . '
' . $Supplier->SupplierCode . '' . $Supplier->SupplierName . '' . $Supplier->EmailAddress . '' . _('Delete') . '
'; - echo ' - - - - - - - - '; - $k=0; - foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { - if ($LineItems->Deleted==False) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo ' - - - - - '; - } - } - echo '

' . _('Items in Tender') . '

' . _('Stock ID') . '' . _('Description') . '' . _('Quantity') . '' . _('UOM') . '
' . $LineItems->StockID . '' . $LineItems->ItemDescription . '' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces) . '' . $LineItems->Units . '' . _('Delete') . '
-
-
-
- - - '; - if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 - and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { - echo ''; - } - echo '
-
'; - if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 - and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { - - echo '
- -
'; - } - echo '
- '; - include('includes/footer.php'); - exit; -} - -if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) - or isset($_POST['Next']) or isset($_POST['Previous'])) { - - if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { - prnMsg( '
' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); - } - if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE email<>'' - ORDER BY suppname"; - } else { - if (mb_strlen($_POST['Keywords']) > 0) { - $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE suppname " . LIKE . " '$SearchString' - AND email<>'' - ORDER BY suppname"; - } elseif (mb_strlen($_POST['SupplierCode']) > 0) { - $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); - $SQL = "SELECT supplierid, - suppname, - currcode, - address1, - address2, - address3, - address4 - FROM suppliers - WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' - AND email<>'' - ORDER BY supplierid"; - } - } //one of keywords or SupplierCode was more than a zero length string - $result = DB_query($SQL); - if (DB_num_rows($result) == 1) { - $myrow = DB_fetch_array($result); - $SingleSupplierReturned = $myrow['supplierid']; - } -} //end of if search -if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ - $_SESSION['SupplierID'] = $SingleSupplierReturned; - unset($_POST['Keywords']); - unset($_POST['SupplierCode']); -} - -if (!isset($_POST['PageOffset'])) { - $_POST['PageOffset'] = 1; -} else { - if ($_POST['PageOffset'] == 0) { - $_POST['PageOffset'] = 1; - } -} - -if (isset($_POST['Suppliers'])) { - echo '
'; - echo '
'; - echo ''; - echo '

' . ' ' . _('Search for Suppliers') . '

- - - -
' . _('Enter a partial Name') . ':'; - if (isset($_POST['Keywords'])) { - echo ''; - } else { - echo ''; - } - echo '' . _('OR') . '' . _('Enter a partial Code') . ':'; - if (isset($_POST['SupplierCode'])) { - echo ''; - } else { - echo ''; - } - echo '

'; - echo '
-
'; -} - -if (isset($_POST['SearchSupplier'])) { - echo '
'; - echo '
'; - echo ''; - $ListCount = DB_num_rows($result); - $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); - if (isset($_POST['Next'])) { - if ($_POST['PageOffset'] < $ListPageMax) { - $_POST['PageOffset'] = $_POST['PageOffset'] + 1; - } - } - if (isset($_POST['Previous'])) { - if ($_POST['PageOffset'] > 1) { - $_POST['PageOffset'] = $_POST['PageOffset'] - 1; - } - } - if ($ListPageMax > 1) { - echo '
  ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; - echo ' - - - '; - echo '
'; - } - echo ''; - echo '
-
-
- '; - echo ' - - - - - - - - '; - $j = 1; - $k = 0; //row counter to determine background colour - $RowIndex = 0; - if (DB_num_rows($result) <> 0) { - DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); - }else{ - prnMsg(_('There are no suppliers data returned, one reason maybe no email addresses set for those suppliers'),'warn'); - } - while (($myrow = DB_fetch_array($result)) and ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo ' - - - - - - - '; - $RowIndex = $RowIndex + 1; - //end of page full new headings if - } - //end of while loop - echo '
' . _('Code') . '' . _('Supplier Name') . '' . _('Currency') . '' . _('Address 1') . '' . _('Address 2') . '' . _('Address 3') . '' . _('Address 4') . '
' . $myrow['suppname'] . '' . $myrow['currcode'] . '' . $myrow['address1'] . '' . $myrow['address2'] . '' . $myrow['address3'] . '' . $myrow['address4'] . '
'; - echo '
-
'; -} - -/*The supplier has chosen option 2 - */ -if (isset($_POST['Items'])) { - echo '
'; - echo '
'; - echo ''; - echo '

' . ' ' . _('Search for Inventory Items') . '

'; - $sql = "SELECT categoryid, - categorydescription - FROM stockcategory - ORDER BY categorydescription"; - $result = DB_query($sql); - if (DB_num_rows($result) == 0) { - echo '

' . _('Problem Report') . ':


' . - _('There are no stock categories currently defined please use the link below to set them up'); - echo '
' . _('Define Stock Categories') . ''; - exit; - } - echo ' - - - - - - - - - -
' . _('In Stock Category') . ':' . _('Enter partial') . ' ' . _('Description') . ':'; - if (isset($_POST['Keywords'])) { - echo ''; - } else { - echo ''; - } - echo '
' . _('OR') . ' ' . '' . _('Enter partial') . ' ' . _('Stock Code') . ':'; - if (isset($_POST['StockCode'])) { - echo ''; - } else { - echo ''; - } - echo '
-
-
- -
-
-
-
'; -} - -if (isset($_POST['Search'])){ /*ie seach for stock items */ - echo '
'; - echo '
'; - echo ''; - echo '

' . ' ' . _('Select items required on this tender') . '

'; - - if ($_POST['Keywords'] and $_POST['StockCode']) { - prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' ); - } - if ($_POST['Keywords']) { - //insert wildcard characters in spaces - $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.description " . LIKE . " '$SearchString' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } elseif ($_POST['StockCode']){ - - $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; - - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - - } else { - if ($_POST['StockCat']=='All'){ - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } else { - $sql = "SELECT stockmaster.stockid, - stockmaster.description, - stockmaster.units - FROM stockmaster INNER JOIN stockcategory - ON stockmaster.categoryid=stockcategory.categoryid - WHERE stockmaster.mbflag!='D' - AND stockmaster.mbflag!='A' - AND stockmaster.mbflag!='K' - AND stockmaster.mbflag!='G' - AND stockmaster.discontinued!=1 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid - LIMIT " . $_SESSION['DisplayRecordsMax']; - } - } - - $ErrMsg = _('There is a problem selecting the part records to display because'); - $DbgMsg = _('The SQL statement that failed was'); - $SearchResult = DB_query($sql,$ErrMsg,$DbgMsg); - - if (DB_num_rows($SearchResult)==0 and $debug==1){ - prnMsg( _('There are no products to display matching the criteria provided'),'warn'); - } - if (DB_num_rows($SearchResult)==1){ - - $myrow=DB_fetch_array($SearchResult); - $_GET['NewItem'] = $myrow['stockid']; - DB_data_seek($SearchResult,0); - } - - if (isset($SearchResult)) { - - echo ''; - echo ' - - - - - - '; - - $i = 0; - $k = 0; //row colour counter - $PartsDisplayed=0; - while ($myrow=DB_fetch_array($SearchResult)) { - - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - $SupportedImgExt = array('png','jpg','jpeg'); - $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); - if (extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { - $ImageSource = ''; - } else if (file_exists ($imagefile)) { - $ImageSource = ''; - } else { - $ImageSource = _('No Image'); - } - - echo ' - - - - - - - '; - - $i++; -#end of page full new headings if - } -#end of while loop - echo '
' . _('Code') . '' . _('Description') . '' . _('Units') . '' . _('Image') . '' . _('Quantity') . '
' . $myrow['stockid'] . '' . $myrow['description'] . '' . $myrow['units'] . '' . $ImageSource . '
'; - - echo ' -
-
- -
'; - }#end if SearchResults to show - - echo '
-
'; - -} //end of if search - -include('includes/footer.php'); - -?> + '.$Title . '

'; + prnMsg( _('You do not have authority to create supplier tenders for this company.') . '
' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.php'); + exit; +} + +if (isset($_GET['Edit']) and $_SESSION['CanCreateTender']==0) { + $Title = _('Authorisation Problem'); + include('includes/header.php'); + echo '

'.$Title . '

'; + prnMsg( _('You do not have authority to amend supplier tenders for this company.') . '
' . + _('Please see your system administrator'), 'warn'); + include('includes/footer.php'); + exit; +} + +if (isset($_POST['Close'])) { + $SQL = "UPDATE tenders SET closed=1 WHERE tenderid='" . $_SESSION['tender'.$identifier]->TenderId . "'"; + $Result = DB_query($SQL); + $_GET['Edit'] = 'Yes'; + unset($_SESSION['tender'.$identifier]); +} + +$ShowTender = 0; + +if (isset($_GET['ID'])) { + $sql = "SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone, + requiredbydate + FROM tenders + INNER JOIN locationusers ON locationusers.loccode=tenders.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1 + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql); + $myrow=DB_fetch_array($result); + if (isset($_SESSION['tender'.$identifier])) { + unset($_SESSION['tender'.$identifier]); + } + $_SESSION['tender'.$identifier] = new Tender(); + $_SESSION['tender'.$identifier]->TenderId = $myrow['tenderid']; + $_SESSION['tender'.$identifier]->Location = $myrow['location']; + $_SESSION['tender'.$identifier]->DelAdd1 = $myrow['address1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $myrow['address2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $myrow['address3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $myrow['address4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $myrow['address5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $myrow['address6']; + $_SESSION['tender'.$identifier]->RequiredByDate = $myrow['requiredbydate']; + + $sql = "SELECT tenderid, + tendersuppliers.supplierid, + suppliers.suppname, + tendersuppliers.email + FROM tendersuppliers + LEFT JOIN suppliers + ON tendersuppliers.supplierid=suppliers.supplierid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($myrow['supplierid'], + $myrow['suppname'], + $myrow['email']); + } + + $sql = "SELECT tenderid, + tenderitems.stockid, + tenderitems.quantity, + stockmaster.description, + tenderitems.units, + stockmaster.decimalplaces + FROM tenderitems + LEFT JOIN stockmaster + ON tenderitems.stockid=stockmaster.stockid + WHERE tenderid='" . $_GET['ID'] . "'"; + $result=DB_query($sql); + while ($myrow=DB_fetch_array($result)) { + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $myrow['stockid'], + $myrow['quantity'], + $myrow['description'], + $myrow['units'], + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + } + $ShowTender = 1; +} + +if (isset($_GET['Edit'])) { + $Title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.php'); + echo '

'.$Title . '

'; + $sql = "SELECT tenderid, + location, + address1, + address2, + address3, + address4, + address5, + address6, + telephone + FROM tenders + INNER JOIN locationusers ON locationusers.loccode=tenders.location AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE closed=0 + AND requiredbydate > '" . Date('Y-m-d') . "'"; + $result=DB_query($sql); + echo ''; + echo ' + + + + + + + + + + '; + while ($myrow=DB_fetch_array($result)) { + echo ' + + + + + + + + + + + '; + } + echo '
' . _('Tender ID') . '' . _('Location') . '' . _('Address 1') . '' . _('Address 2') . '' . _('Address 3') . '' . _('Address 4') . '' . _('Address 5') . '' . _('Address 6') . '' . _('Telephone') . '
' . $myrow['tenderid'] . '' . $myrow['location'] . '' . $myrow['address1'] . '' . $myrow['address2'] . '' . $myrow['address3'] . '' . $myrow['address4'] . '' . $myrow['address5'] . '' . $myrow['address6'] . '' . $myrow['telephone'] . '' . _('Edit') . '
'; + include('includes/footer.php'); + exit; +} else if (isset($_GET['ID']) or (isset($_SESSION['tender'.$identifier]->TenderId))) { + $Title = _('Edit an Existing Supplier Tender Request'); + include('includes/header.php'); + echo '

' . $Title . '

'; +} else { + $Title = _('Create a New Supplier Tender Request'); + include('includes/header.php'); + echo '

' . $Title . '

'; +} + +if (isset($_POST['Save'])) { + $_SESSION['tender'.$identifier]->RequiredByDate=$_POST['RequiredByDate']; + $_SESSION['tender'.$identifier]->save($db); + $_SESSION['tender'.$identifier]->EmailSuppliers(); + prnMsg( _('The tender has been successfully saved'), 'success'); + include('includes/footer.php'); + exit; +} + +if (isset($_GET['DeleteSupplier'])) { + $_SESSION['tender'.$identifier]->remove_supplier_from_tender($_GET['DeleteSupplier']); + $ShowTender = 1; +} + +if (isset($_GET['DeleteItem'])) { + $_SESSION['tender'.$identifier]->remove_item_from_tender($_GET['DeleteItem']); + $ShowTender = 1; +} + +if (isset($_POST['SelectedSupplier'])) { + $sql = "SELECT suppname, + email + FROM suppliers + WHERE supplierid='" . $_POST['SelectedSupplier'] . "'"; + $result = DB_query($sql); + $myrow = DB_fetch_array($result); + if (mb_strlen($myrow['email'])>0) { + $_SESSION['tender'.$identifier]->add_supplier_to_tender($_POST['SelectedSupplier'], + $myrow['suppname'], + $myrow['email']); + } else { + prnMsg( _('The supplier must have an email set up or they cannot be part of a tender'), 'warn'); + } + $ShowTender = 1; +} + +if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) { + foreach ($_POST as $key => $value) { + if (mb_substr($key,0,7)=='StockID') { + $Index = mb_substr($key,7,mb_strlen($key)-7); + $StockID = $value; + $Quantity = filter_number_format($_POST['Qty'.$Index]); + $UOM = $_POST['UOM'.$Index]; + $sql = "SELECT description, + decimalplaces + FROM stockmaster + WHERE stockid='".$StockID."'"; + $result=DB_query($sql); + $myrow=DB_fetch_array($result); + $_SESSION['tender'.$identifier]->add_item_to_tender($_SESSION['tender'.$identifier]->LinesOnTender, + $StockID, + $Quantity, + $myrow['description'], + $UOM, + $myrow['decimalplaces'], + DateAdd(date($_SESSION['DefaultDateFormat']),'m',3)); + unset($UOM); + } + } + $ShowTender = 1; +} + +if (!isset($_SESSION['tender'.$identifier]) + or isset($_POST['LookupDeliveryAddress']) + or $ShowTender==1) { + + /* Show Tender header screen */ + if (!isset($_SESSION['tender'.$identifier])) { + $_SESSION['tender'.$identifier]=new Tender(); + } + if (!isset($_SESSION['tender'.$identifier]->RequiredByDate)) { + $_SESSION['tender'.$identifier]->RequiredByDate = FormatDateForSQL(date($_SESSION['DefaultDateFormat'])); + } + echo '
'; + echo '
'; + echo ''; + echo ''; + echo ' + + + + + + '; + + if (!isset($_POST['StkLocation']) or $_POST['StkLocation']==''){ + /* If this is the first time + * the form loaded set up defaults */ + + $_POST['StkLocation'] = $_SESSION['UserStockLocation']; + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + INNER JOIN locationusers ON locationusers.loccode=.locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE locations.loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + + } else { + /*The default location of the user is crook */ + prnMsg(_('The default stock location set up for this user is not a currently defined stock location') . + '. ' . _('Your system administrator needs to amend your user record'),'error'); + } + + + } elseif (isset($_POST['LookupDeliveryAddress'])){ + + $sql = "SELECT deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + tel, + contact + FROM locations + INNER JOIN locationusers ON locationusers.loccode=.locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE loccode='" . $_POST['StkLocation'] . "'"; + + $LocnAddrResult = DB_query($sql); + if (DB_num_rows($LocnAddrResult)==1){ + $LocnRow = DB_fetch_array($LocnAddrResult); + $_POST['DelAdd1'] = $LocnRow['deladd1']; + $_POST['DelAdd2'] = $LocnRow['deladd2']; + $_POST['DelAdd3'] = $LocnRow['deladd3']; + $_POST['DelAdd4'] = $LocnRow['deladd4']; + $_POST['DelAdd5'] = $LocnRow['deladd5']; + $_POST['DelAdd6'] = $LocnRow['deladd6']; + $_POST['Tel'] = $LocnRow['tel']; + $_POST['Contact'] = $LocnRow['contact']; + + $_SESSION['tender'.$identifier]->Location= $_POST['StkLocation']; + $_SESSION['tender'.$identifier]->DelAdd1 = $_POST['DelAdd1']; + $_SESSION['tender'.$identifier]->DelAdd2 = $_POST['DelAdd2']; + $_SESSION['tender'.$identifier]->DelAdd3 = $_POST['DelAdd3']; + $_SESSION['tender'.$identifier]->DelAdd4 = $_POST['DelAdd4']; + $_SESSION['tender'.$identifier]->DelAdd5 = $_POST['DelAdd5']; + $_SESSION['tender'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['tender'.$identifier]->Telephone = $_POST['Tel']; + $_SESSION['tender'.$identifier]->Contact = $_POST['Contact']; + } + } + echo ' + + + '; + + /* Display the details of the delivery location + */ + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo ' + + + '; + echo '

' . _('Tender header details') . '

' . _('Delivery Must Be Made Before') . '
' . _('Warehouse') . ': +
' . _('Delivery Contact') . ':
' . _('Address') . ' 1 :
' . _('Address') . ' 2 :
' . _('Address') . ' 3 :
' . _('Address') . ' 4 :
' . _('Address') . ' 5 :
' . _('Address') . ' 6 :
' . _('Phone') . ':

'; + + /* Display the supplier/item details + */ + echo ''; + + /* Supplier Details + */ + echo ' + '; + /* Item Details + */ + echo ' + +
+ '; + echo ' + + '; + echo ' + + + + '; + foreach ($_SESSION['tender'.$identifier]->Suppliers as $Supplier) { + echo ' + + + + + '; + } + echo '

' . _('Suppliers To Send Tender') . '

' . _('Supplier Code') . '' ._('Supplier Name') . '' ._('Email Address') . '
' . $Supplier->SupplierCode . '' . $Supplier->SupplierName . '' . $Supplier->EmailAddress . '' . _('Delete') . '
'; + echo ' + + + + + + + + '; + + foreach ($_SESSION['tender'.$identifier]->LineItems as $LineItems) { + if ($LineItems->Deleted==False) { + echo ' + + + + + + '; + } + } + echo '

' . _('Items in Tender') . '

' . _('Stock ID') . '' . _('Description') . '' . _('Quantity') . '' . _('UOM') . '
' . $LineItems->StockID . '' . $LineItems->ItemDescription . '' . locale_number_format($LineItems->Quantity,$LineItems->DecimalPlaces) . '' . $LineItems->Units . '' . _('Delete') . '
+
+
+
+ + + '; + if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 + and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { + echo ''; + } + echo '
+
'; + if ($_SESSION['tender'.$identifier]->LinesOnTender > 0 + and $_SESSION['tender'.$identifier]->SuppliersOnTender > 0) { + + echo '
+ +
'; + } + echo '
+
'; + include('includes/footer.php'); + exit; +} + +if (isset($_POST['SearchSupplier']) or isset($_POST['Go']) + or isset($_POST['Next']) or isset($_POST['Previous'])) { + + if (mb_strlen($_POST['Keywords']) > 0 and mb_strlen($_POST['SupplierCode']) > 0) { + prnMsg( '
' . _('Supplier name keywords have been used in preference to the Supplier code extract entered'), 'info' ); + } + if ($_POST['Keywords'] == '' and $_POST['SupplierCode'] == '') { + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE email<>'' + ORDER BY suppname"; + } else { + if (mb_strlen($_POST['Keywords']) > 0) { + $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE suppname " . LIKE . " '$SearchString' + AND email<>'' + ORDER BY suppname"; + } elseif (mb_strlen($_POST['SupplierCode']) > 0) { + $_POST['SupplierCode'] = mb_strtoupper($_POST['SupplierCode']); + $SQL = "SELECT supplierid, + suppname, + currcode, + address1, + address2, + address3, + address4 + FROM suppliers + WHERE supplierid " . LIKE . " '%" . $_POST['SupplierCode'] . "%' + AND email<>'' + ORDER BY supplierid"; + } + } //one of keywords or SupplierCode was more than a zero length string + $result = DB_query($SQL); + if (DB_num_rows($result) == 1) { + $myrow = DB_fetch_array($result); + $SingleSupplierReturned = $myrow['supplierid']; + } +} //end of if search +if (isset($SingleSupplierReturned)) { /*there was only one supplier returned */ + $_SESSION['SupplierID'] = $SingleSupplierReturned; + unset($_POST['Keywords']); + unset($_POST['SupplierCode']); +} + +if (!isset($_POST['PageOffset'])) { + $_POST['PageOffset'] = 1; +} else { + if ($_POST['PageOffset'] == 0) { + $_POST['PageOffset'] = 1; + } +} + +if (isset($_POST['Suppliers'])) { + echo '
'; + echo '
'; + echo ''; + echo '

' . ' ' . _('Search for Suppliers') . '

+ + + +
' . _('Enter a partial Name') . ':'; + if (isset($_POST['Keywords'])) { + echo ''; + } else { + echo ''; + } + echo '' . _('OR') . '' . _('Enter a partial Code') . ':'; + if (isset($_POST['SupplierCode'])) { + echo ''; + } else { + echo ''; + } + echo '

'; + echo '
+
'; +} + +if (isset($_POST['SearchSupplier'])) { + echo '
'; + echo '
'; + echo ''; + $ListCount = DB_num_rows($result); + $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax']); + if (isset($_POST['Next'])) { + if ($_POST['PageOffset'] < $ListPageMax) { + $_POST['PageOffset'] = $_POST['PageOffset'] + 1; + } + } + if (isset($_POST['Previous'])) { + if ($_POST['PageOffset'] > 1) { + $_POST['PageOffset'] = $_POST['PageOffset'] - 1; + } + } + if ($ListPageMax > 1) { + echo '
  ' . $_POST['PageOffset'] . ' ' . _('of') . ' ' . $ListPageMax . ' ' . _('pages') . '. ' . _('Go to Page') . ': '; + echo ' + + + '; + echo '
'; + } + echo ''; + echo '
+
+
+ '; + echo ' + + + + + + + + '; + $j = 1; + $RowIndex = 0; + if (DB_num_rows($result) <> 0) { + DB_data_seek($result, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']); + }else{ + prnMsg(_('There are no suppliers data returned, one reason maybe no email addresses set for those suppliers'),'warn'); + } + while (($myrow = DB_fetch_array($result)) and ($RowIndex <> $_SESSION['DisplayRecordsMax'])) { + echo ' + + + + + + + + '; + $RowIndex = $RowIndex + 1; + //end of page full new headings if + } + //end of while loop + echo '
' . _('Code') . '' . _('Supplier Name') . '' . _('Currency') . '' . _('Address 1') . '' . _('Address 2') . '' . _('Address 3') . '' . _('Address 4') . '
' . $myrow['suppname'] . '' . $myrow['currcode'] . '' . $myrow['address1'] . '' . $myrow['address2'] . '' . $myrow['address3'] . '' . $myrow['address4'] . '
'; + echo '
+
'; +} + +/*The supplier has chosen option 2 + */ +if (isset($_POST['Items'])) { + echo '
'; + echo '
'; + echo ''; + echo '

' . ' ' . _('Search for Inventory Items') . '

'; + $sql = "SELECT categoryid, + categorydescription + FROM stockcategory + ORDER BY categorydescription"; + $result = DB_query($sql); + if (DB_num_rows($result) == 0) { + echo '

' . _('Problem Report') . ':


' . + _('There are no stock categories currently defined please use the link below to set them up'); + echo '
' . _('Define Stock Categories') . ''; + exit; + } + echo ' + + + + + + + + + +
' . _('In Stock Category') . ':' . _('Enter partial') . ' ' . _('Description') . ':'; + if (isset($_POST['Keywords'])) { + echo ''; + } else { + echo ''; + } + echo '
' . _('OR') . ' ' . '' . _('Enter partial') . ' ' . _('Stock Code') . ':'; + if (isset($_POST['StockCode'])) { + echo ''; + } else { + echo ''; + } + echo '
+
+
+ +
+
+
+
'; +} + +if (isset($_POST['Search'])){ /*ie seach for stock items */ + echo '
'; + echo '
'; + echo ''; + echo '

' . ' ' . _('Select items required on this tender') . '

'; + + if ($_POST['Keywords'] and $_POST['StockCode']) { + prnMsg( _('Stock description keywords have been used in preference to the Stock code extract entered'), 'info' ); + } + if ($_POST['Keywords']) { + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + + if ($_POST['StockCat']=='All'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } + + } elseif ($_POST['StockCode']){ + + $_POST['StockCode'] = '%' . $_POST['StockCode'] . '%'; + + if ($_POST['StockCat']=='All'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + AND stockmaster.stockid " . LIKE . " '" . $_POST['StockCode'] . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } + + } else { + if ($_POST['StockCat']=='All'){ + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } else { + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units + FROM stockmaster INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockmaster.mbflag!='D' + AND stockmaster.mbflag!='A' + AND stockmaster.mbflag!='K' + AND stockmaster.mbflag!='G' + AND stockmaster.discontinued!=1 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + ORDER BY stockmaster.stockid + LIMIT " . $_SESSION['DisplayRecordsMax']; + } + } + + $ErrMsg = _('There is a problem selecting the part records to display because'); + $DbgMsg = _('The SQL statement that failed was'); + $SearchResult = DB_query($sql,$ErrMsg,$DbgMsg); + + if (DB_num_rows($SearchResult)==0 and $debug==1){ + prnMsg( _('There are no products to display matching the criteria provided'),'warn'); + } + if (DB_num_rows($SearchResult)==1){ + + $myrow=DB_fetch_array($SearchResult); + $_GET['NewItem'] = $myrow['stockid']; + DB_data_seek($SearchResult,0); + } + + if (isset($SearchResult)) { + + echo ''; + echo ' + + + + + + '; + + $i = 0; + $PartsDisplayed=0; + while ($myrow=DB_fetch_array($SearchResult)) { + + $SupportedImgExt = array('png','jpg','jpeg'); + $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); + if (extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { + $ImageSource = ''; + } else if (file_exists ($imagefile)) { + $ImageSource = ''; + } else { + $ImageSource = _('No Image'); + } + + echo ' + + + + + + + + '; + + $i++; +#end of page full new headings if + } +#end of while loop + echo '
' . _('Code') . '' . _('Description') . '' . _('Units') . '' . _('Image') . '' . _('Quantity') . '
' . $myrow['stockid'] . '' . $myrow['description'] . '' . $myrow['units'] . '' . $ImageSource . '
'; + + echo ' +
+
+ +
'; + }#end if SearchResults to show + + echo '
+
'; + +} //end of if search + +include('includes/footer.php'); + +?> diff --git a/SupplierTenders.php b/SupplierTenders.php index e08fdbc9b..575d1266e 100644 --- a/SupplierTenders.php +++ b/SupplierTenders.php @@ -330,17 +330,13 @@ ' . _('Line Total').' ('.$Currency.') ' . _('Expiry Date') . ' '; - $k=0; + foreach ($_SESSION['offer'.$identifier]->LineItems as $LineItems) { if ($LineItems->Deleted==False) { if ($LineItems->ExpiryDate < date('Y-m-d')) { echo ''; - } elseif ($k==1){ - echo ''; - $k=0; } else { - echo ''; - $k=1; + echo ''; } echo ''; @@ -693,18 +689,9 @@ echo $TableHeader; $i = 0; - $k = 0; //row colour counter $PartsDisplayed=0; while ($myrow=DB_fetch_array($SearchResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); if (extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { @@ -740,7 +727,8 @@ } else { $UOM=$myrow['units']; } - echo '' . $myrow['stockid'] . ' + echo ' + ' . $myrow['stockid'] . ' ' . $myrow['description'] . ' ' . $UOM . ' ' . $ImageSource . ' diff --git a/SupplierTransInquiry.php b/SupplierTransInquiry.php index 9a128dc01..e32b931a4 100644 --- a/SupplierTransInquiry.php +++ b/SupplierTransInquiry.php @@ -119,19 +119,11 @@ echo $tableheader; $RowCounter = 1; - $k = 0; //row colour counter while ($myrow=DB_fetch_array($TransResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo '';; - $k++; - } - - printf ('%s + printf (' + %s %s %s %s diff --git a/SupplierTypes.php b/SupplierTypes.php index c664e8916..14cbf7d3c 100644 --- a/SupplierTypes.php +++ b/SupplierTypes.php @@ -154,18 +154,10 @@ ' . _('Type Name') . ' '; -$k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - printf('%s + printf(' + %s %s ' . _('Edit') . ' ' . _('Bank Swift') . '   '; - $j = 1; + while($myrow = DB_fetch_row($result)) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - printf('%s + printf(' + %s %s %s %s diff --git a/TaxAuthorityRates.php b/TaxAuthorityRates.php index 2a29a9f36..9f054752c 100644 --- a/TaxAuthorityRates.php +++ b/TaxAuthorityRates.php @@ -83,16 +83,9 @@ ' . _('Tax Rate') . ' '; - $j = 1; while($myrow = DB_fetch_array($TaxRatesResult)) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - printf('%s + printf(' + %s %s ', diff --git a/TaxCategories.php b/TaxCategories.php index c0d6efb88..a33b0f0ec 100644 --- a/TaxCategories.php +++ b/TaxCategories.php @@ -169,15 +169,9 @@   '; - $j = 1; while($myrow = DB_fetch_row($result)) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } + echo ''; + if($myrow[1]!='Freight') { // Uses gettext() to translate 'Exempt' and 'Handling': echo '' . _($myrow[1]) . ' diff --git a/TaxGroups.php b/TaxGroups.php index 73cf8e2ec..c9e102b67 100644 --- a/TaxGroups.php +++ b/TaxGroups.php @@ -177,16 +177,9 @@   '; - $j = 1; while($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - printf('%s + printf(' + %s %s ' . _('Edit') . ' ' . _('Delete') . ' @@ -290,21 +283,15 @@ ' . _('Order') . ' ' . _('Tax on Prior Taxes') . ' '; - $j = 1; + for ($i=1;$i < count($TaxAuthRow)+1;$i++) { if($TaxAuthRow[$i]['calculationorder']==0) { $TaxAuthRow[$i]['calculationorder'] = $i; } - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - echo '' . $TaxAuthRow[$i]['taxname'] . ' + echo ' + ' . $TaxAuthRow[$i]['taxname'] . ' '; @@ -181,7 +181,7 @@ '; - $k = 0; //row colour counter + $i = 1; while ($myrow = DB_fetch_array($result)) { $QOH = 0; @@ -219,17 +219,11 @@ $DaysOfStock = 0; } if ($DaysOfStock < $_POST['MaxDaysOfStock']){ - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } $CodeLink = '' . $myrow['stkcode'] . ''; $QOH = is_numeric($QOH)?locale_number_format($QOH,$myrow['decimalplaces']):$QOH; $QOO = is_numeric($QOO)?locale_number_format($QOO,$myrow['decimalplaces']):$QOO; - printf('%s + printf(' + %s %s %s %s diff --git a/UnitsOfMeasure.php b/UnitsOfMeasure.php index 66bcaa6cd..c3fb54a85 100644 --- a/UnitsOfMeasure.php +++ b/UnitsOfMeasure.php @@ -170,21 +170,13 @@ ' . _('Units of Measure') . ' '; - $k=0; //row colour counter while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - - echo '' . $myrow[1] . ''; - echo '' . _('Edit') . ''; - echo '' . _('Delete') . ''; - echo ''; + echo ' + ' . $myrow[1] . ' + ' . _('Edit') . ' + ' . _('Delete') . ' + '; } //END WHILE LIST LOOP echo '
'; diff --git a/UserBankAccounts.php b/UserBankAccounts.php index 77fa3c218..370b74356 100644 --- a/UserBankAccounts.php +++ b/UserBankAccounts.php @@ -1,239 +1,231 @@ - ',// Icon title. - _('Bank Account Users'), '

';// Page title. - -if (isset($_POST['SelectedBankAccount'])) { - $SelectedBankAccount = mb_strtoupper($_POST['SelectedBankAccount']); -} elseif (isset($_GET['SelectedBankAccount'])) { - $SelectedBankAccount = mb_strtoupper($_GET['SelectedBankAccount']); -} else { - $SelectedBankAccount = ''; -} - -if (isset($_POST['SelectedUser'])) { - $SelectedUser = $_POST['SelectedUser']; -} elseif (isset($_GET['SelectedUser'])) { - $SelectedUser = $_GET['SelectedUser']; -} - -if (isset($_POST['Cancel'])) { - unset($SelectedUser); - unset($SelectedBankAccount); -} - -if (isset($_POST['Process'])) { - if ($_POST['SelectedUser'] == '') { - prnMsg(_('You have not selected any User'), 'error'); - echo '
'; - unset($SelectedUser); - unset($_POST['SelectedUser']); - } -} - -if (isset($_POST['submit'])) { - - $InputError = 0; - - if ($_POST['SelectedBankAccount'] == '') { - $InputError = 1; - prnMsg(_('You have not selected a bank account to be authorised for this user'), 'error'); - echo '
'; - unset($SelectedUser); - } - - if ($InputError != 1) { - - // First check the user is not being duplicated - - $CheckSql = "SELECT count(*) - FROM bankaccountusers - WHERE accountcode= '" . $_POST['SelectedBankAccount'] . "' - AND userid = '" . $_POST['SelectedUser'] . "'"; - - $CheckResult = DB_query($CheckSql); - $CheckRow = DB_fetch_row($CheckResult); - - if ($CheckRow[0] > 0) { - $InputError = 1; - prnMsg(_('The Bank Account') . ' ' . $_POST['SelectedBankAccount'] . ' ' . _('is already authorised for this user'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO bankaccountusers (accountcode, - userid) - VALUES ('" . $_POST['SelectedBankAccount'] . "', - '" . $_POST['SelectedUser'] . "')"; - - $msg = _('User') . ': ' . $_POST['SelectedUser'] . ' ' . _('authority to use the') . ' ' . $_POST['SelectedBankAccount'] . ' ' . _('bank account has been changed'); - $Result = DB_query($SQL); - prnMsg($msg, 'success'); - unset($_POST['SelectedBankAccount']); - } - } -} elseif (isset($_GET['delete'])) { - $SQL = "DELETE FROM bankaccountusers - WHERE accountcode='" . $SelectedBankAccount . "' - AND userid='" . $SelectedUser . "'"; - - $ErrMsg = _('The Bank account user record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to use the') . ' ' . $SelectedBankAccount . ' ' . _('bank account removed'), 'success'); - unset($_GET['delete']); -} - -if (!isset($SelectedUser)) { - - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedBankAccount will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true. These will call the same page again and allow update/input or deletion of the records*/ - echo '
'; - echo ' - - - - '; - - echo '
' . _('Select User') . ':
'; // close main table - DB_free_result($Result); - - echo '
- - -
'; - - echo '
'; - -} - -//end of ifs and buts! -if (isset($_POST['process']) or isset($SelectedUser)) { - $SQLName = "SELECT realname - FROM www_users - WHERE userid='" . $SelectedUser . "'"; - $Result = DB_query($SQLName); - $MyRow = DB_fetch_array($Result); - $SelectedUserName = $MyRow['realname']; - - echo ' -
- - '; - - $SQL = "SELECT bankaccountusers.accountcode, - bankaccounts.bankaccountname - FROM bankaccountusers INNER JOIN bankaccounts - ON bankaccountusers.accountcode=bankaccounts.accountcode - WHERE bankaccountusers.userid='" . $SelectedUser . "' - ORDER BY bankaccounts.bankaccountname ASC"; - - $Result = DB_query($SQL); - - echo ''; - echo ' - - '; - echo ' - - - '; - - $k = 0; //row colour counter - - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - printf(' - - - ', - $MyRow['accountcode'], - $MyRow['bankaccountname'], - htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'), - $MyRow['accountcode'], - htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'), - $MyRow['accountcode']); - } - //END WHILE LIST LOOP - echo '

' . _('Authorised bank accounts for User') . ': ' . $SelectedUserName . '

' . _('Code') . '' . _('Name') . '
%s%s' . _('Un-authorise') . '
'; - - if (!isset($_GET['delete'])) { - - - echo ''; //Main table - - echo ' - - - -
' . _('Select Bank Account') . ': -
'; // close main table - DB_free_result($Result); - - echo '
- - -
-
'; - - } // end if user wish to delete -} - -include('includes/footer.php'); -?> + ',// Icon title. + _('Bank Account Users'), '

';// Page title. + +if (isset($_POST['SelectedBankAccount'])) { + $SelectedBankAccount = mb_strtoupper($_POST['SelectedBankAccount']); +} elseif (isset($_GET['SelectedBankAccount'])) { + $SelectedBankAccount = mb_strtoupper($_GET['SelectedBankAccount']); +} else { + $SelectedBankAccount = ''; +} + +if (isset($_POST['SelectedUser'])) { + $SelectedUser = $_POST['SelectedUser']; +} elseif (isset($_GET['SelectedUser'])) { + $SelectedUser = $_GET['SelectedUser']; +} + +if (isset($_POST['Cancel'])) { + unset($SelectedUser); + unset($SelectedBankAccount); +} + +if (isset($_POST['Process'])) { + if ($_POST['SelectedUser'] == '') { + prnMsg(_('You have not selected any User'), 'error'); + echo '
'; + unset($SelectedUser); + unset($_POST['SelectedUser']); + } +} + +if (isset($_POST['submit'])) { + + $InputError = 0; + + if ($_POST['SelectedBankAccount'] == '') { + $InputError = 1; + prnMsg(_('You have not selected a bank account to be authorised for this user'), 'error'); + echo '
'; + unset($SelectedUser); + } + + if ($InputError != 1) { + + // First check the user is not being duplicated + + $CheckSql = "SELECT count(*) + FROM bankaccountusers + WHERE accountcode= '" . $_POST['SelectedBankAccount'] . "' + AND userid = '" . $_POST['SelectedUser'] . "'"; + + $CheckResult = DB_query($CheckSql); + $CheckRow = DB_fetch_row($CheckResult); + + if ($CheckRow[0] > 0) { + $InputError = 1; + prnMsg(_('The Bank Account') . ' ' . $_POST['SelectedBankAccount'] . ' ' . _('is already authorised for this user'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO bankaccountusers (accountcode, + userid) + VALUES ('" . $_POST['SelectedBankAccount'] . "', + '" . $_POST['SelectedUser'] . "')"; + + $msg = _('User') . ': ' . $_POST['SelectedUser'] . ' ' . _('authority to use the') . ' ' . $_POST['SelectedBankAccount'] . ' ' . _('bank account has been changed'); + $Result = DB_query($SQL); + prnMsg($msg, 'success'); + unset($_POST['SelectedBankAccount']); + } + } +} elseif (isset($_GET['delete'])) { + $SQL = "DELETE FROM bankaccountusers + WHERE accountcode='" . $SelectedBankAccount . "' + AND userid='" . $SelectedUser . "'"; + + $ErrMsg = _('The Bank account user record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to use the') . ' ' . $SelectedBankAccount . ' ' . _('bank account removed'), 'success'); + unset($_GET['delete']); +} + +if (!isset($SelectedUser)) { + + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedBankAccount will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true. These will call the same page again and allow update/input or deletion of the records*/ + echo '
'; + echo ' + + + + '; + + echo '
' . _('Select User') . ':
'; // close main table + DB_free_result($Result); + + echo '
+ + +
'; + + echo '
'; + +} + +//end of ifs and buts! +if (isset($_POST['process']) or isset($SelectedUser)) { + $SQLName = "SELECT realname + FROM www_users + WHERE userid='" . $SelectedUser . "'"; + $Result = DB_query($SQLName); + $MyRow = DB_fetch_array($Result); + $SelectedUserName = $MyRow['realname']; + + echo ' +
+ + '; + + $SQL = "SELECT bankaccountusers.accountcode, + bankaccounts.bankaccountname + FROM bankaccountusers INNER JOIN bankaccounts + ON bankaccountusers.accountcode=bankaccounts.accountcode + WHERE bankaccountusers.userid='" . $SelectedUser . "' + ORDER BY bankaccounts.bankaccountname ASC"; + + $Result = DB_query($SQL); + + echo ''; + echo ' + + '; + echo ' + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + + printf(' + + + + ', + $MyRow['accountcode'], + $MyRow['bankaccountname'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'), + $MyRow['accountcode'], + htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'), + $MyRow['accountcode']); + } + //END WHILE LIST LOOP + echo '

' . _('Authorised bank accounts for User') . ': ' . $SelectedUserName . '

' . _('Code') . '' . _('Name') . '
%s%s' . _('Un-authorise') . '
'; + + if (!isset($_GET['delete'])) { + + + echo ''; //Main table + + echo ' + + + +
' . _('Select Bank Account') . ': +
'; // close main table + DB_free_result($Result); + + echo '
+ + +
+
'; + + } // end if user wish to delete +} + +include('includes/footer.php'); +?> diff --git a/UserGLAccounts.php b/UserGLAccounts.php index 24d2cd0b6..d9d170d91 100644 --- a/UserGLAccounts.php +++ b/UserGLAccounts.php @@ -171,16 +171,9 @@ WHERE glaccountusers.userid='" . $SelectedUser . "' ORDER BY chartmaster.accountcode ASC"); if(DB_num_rows($Result)>0) {// If the user has access permissions to one or more GL accounts: - $k = 0; //row colour counter while ($MyRow = DB_fetch_array($Result)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - echo '', $MyRow['accountcode'], ' + echo ' + ', $MyRow['accountcode'], ' ', $MyRow['accountname'], ' '; if($MyRow['canview'] == 1) { diff --git a/UserLocations.php b/UserLocations.php index fc0ae9909..3be4f35bc 100644 --- a/UserLocations.php +++ b/UserLocations.php @@ -1,264 +1,256 @@ -' . ' ' . $Title . '

'; - -if (isset($_POST['SelectedLocation'])) { - $SelectedLocation = mb_strtoupper($_POST['SelectedLocation']); -} elseif (isset($_GET['SelectedLocation'])) { - $SelectedLocation = mb_strtoupper($_GET['SelectedLocation']); -} else { - $SelectedLocation = ''; -} - -if (isset($_POST['SelectedUser'])) { - $SelectedUser = mb_strtoupper($_POST['SelectedUser']); -} elseif (isset($_GET['SelectedUser'])) { - $SelectedUser = mb_strtoupper($_GET['SelectedUser']); -} - -if (isset($_POST['Cancel'])) { - unset($SelectedUser); - unset($SelectedLocation); -} - -if (isset($_POST['Process'])) { - if ($_POST['SelectedUser'] == '') { - prnMsg(_('You have not selected any User'), 'error'); - echo '
'; - unset($SelectedUser); - unset($_POST['SelectedUser']); - } -} - -if (isset($_POST['submit'])) { - - $InputError = 0; - - if ($_POST['SelectedLocation'] == '') { - $InputError = 1; - prnMsg(_('You have not selected an inventory location to be authorised for this user'), 'error'); - echo '
'; - unset($SelectedUser); - } - - if ($InputError != 1) { - - // First check the user is not being duplicated - - $CheckSql = "SELECT count(*) - FROM locationusers - WHERE loccode= '" . $_POST['SelectedLocation'] . "' - AND userid = '" . $_POST['SelectedUser'] . "'"; - - $CheckResult = DB_query($CheckSql); - $CheckRow = DB_fetch_row($CheckResult); - - if ($CheckRow[0] > 0) { - $InputError = 1; - prnMsg(_('The location') . ' ' . $_POST['SelectedLocation'] . ' ' . _('is already authorised for this user'), 'error'); - } else { - // Add new record on submit - $SQL = "INSERT INTO locationusers (loccode, - userid, - canview, - canupd) - VALUES ('" . $_POST['SelectedLocation'] . "', - '" . $_POST['SelectedUser'] . "', - '1', - '1')"; - - $msg = _('User') . ': ' . $_POST['SelectedUser'] . ' ' . _('authority to use the') . ' ' . $_POST['SelectedLocation'] . ' ' . _('location has been changed'); - $Result = DB_query($SQL); - prnMsg($msg, 'success'); - unset($_POST['SelectedLocation']); - } - } -} elseif (isset($_GET['delete'])) { - $SQL = "DELETE FROM locationusers - WHERE loccode='" . $SelectedLocation . "' - AND userid='" . $SelectedUser . "'"; - - $ErrMsg = _('The Location user record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to use the') . ' ' . $SelectedLocation . ' ' . _('location removed'), 'success'); - unset($_GET['delete']); -} elseif (isset($_GET['ToggleUpdate'])) { - $SQL = "UPDATE locationusers - SET canupd='" . $_GET['ToggleUpdate'] . "' - WHERE loccode='" . $SelectedLocation . "' - AND userid='" . $SelectedUser . "'"; - - $ErrMsg = _('The Location user record could not be deleted because'); - $Result = DB_query($SQL, $ErrMsg); - prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to update') . ' ' . $SelectedLocation . ' ' . _('location removed'), 'success'); - unset($_GET['ToggleUpdate']); -} - -if (!isset($SelectedUser)) { - - /* It could still be the second time the page has been run and a record has been selected for modification - SelectedLocation will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters - then none of the above are true. These will call the same page again and allow update/input or deletion of the records*/ - echo '
'; - echo ' - - - - '; - - echo '
' . _('Select User') . ':
'; // close main table - DB_free_result($Result); - - echo '
- - -
'; - - echo '
'; - -} - -//end of ifs and buts! -if (isset($_POST['process']) or isset($SelectedUser)) { - $SQLName = "SELECT realname - FROM www_users - WHERE userid='" . $SelectedUser . "'"; - $Result = DB_query($SQLName); - $MyRow = DB_fetch_array($Result); - $SelectedUserName = $MyRow['realname']; - - echo ' -
- - '; - - $SQL = "SELECT locationusers.loccode, - canview, - canupd, - locations.locationname - FROM locationusers INNER JOIN locations - ON locationusers.loccode=locations.loccode - WHERE locationusers.userid='" . $SelectedUser . "' - ORDER BY locations.locationname ASC"; - - $Result = DB_query($SQL); - - echo ''; - echo ' - - '; - echo ' - - - - - '; - - $k = 0; //row colour counter - - while ($MyRow = DB_fetch_array($Result)) { - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - - if ($MyRow['canupd'] == 1) { - $ToggleText = ''; - } else { - $ToggleText = ''; - } - - printf(' - - - ' . - $ToggleText . ' - - ', - $MyRow['loccode'], - $MyRow['locationname'], - $MyRow['canview'], - $MyRow['canupd'], - htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), - $MyRow['loccode'], - htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), - $MyRow['loccode']); - } - //END WHILE LIST LOOP - echo '

' . _('Authorised Inventory Locations for User') . ': ' . $SelectedUserName . '

' . _('Code') . '' . _('Name') . '' . _('View') . '' . _('Update') . '
' . _('Remove Update') . '' . _('Add Update') . '%s%s%s%s' . _('Un-authorise') . '
'; - - if (!isset($_GET['delete'])) { - - - echo ''; //Main table - - echo ' - - - -
' . _('Select Location') . ': -
'; // close main table - DB_free_result($Result); - - echo '
- - -
-
'; - - } // end if user wish to delete -} - -include('includes/footer.php'); -?> +' . ' ' . $Title . '

'; + +if (isset($_POST['SelectedLocation'])) { + $SelectedLocation = mb_strtoupper($_POST['SelectedLocation']); +} elseif (isset($_GET['SelectedLocation'])) { + $SelectedLocation = mb_strtoupper($_GET['SelectedLocation']); +} else { + $SelectedLocation = ''; +} + +if (isset($_POST['SelectedUser'])) { + $SelectedUser = mb_strtoupper($_POST['SelectedUser']); +} elseif (isset($_GET['SelectedUser'])) { + $SelectedUser = mb_strtoupper($_GET['SelectedUser']); +} + +if (isset($_POST['Cancel'])) { + unset($SelectedUser); + unset($SelectedLocation); +} + +if (isset($_POST['Process'])) { + if ($_POST['SelectedUser'] == '') { + prnMsg(_('You have not selected any User'), 'error'); + echo '
'; + unset($SelectedUser); + unset($_POST['SelectedUser']); + } +} + +if (isset($_POST['submit'])) { + + $InputError = 0; + + if ($_POST['SelectedLocation'] == '') { + $InputError = 1; + prnMsg(_('You have not selected an inventory location to be authorised for this user'), 'error'); + echo '
'; + unset($SelectedUser); + } + + if ($InputError != 1) { + + // First check the user is not being duplicated + + $CheckSql = "SELECT count(*) + FROM locationusers + WHERE loccode= '" . $_POST['SelectedLocation'] . "' + AND userid = '" . $_POST['SelectedUser'] . "'"; + + $CheckResult = DB_query($CheckSql); + $CheckRow = DB_fetch_row($CheckResult); + + if ($CheckRow[0] > 0) { + $InputError = 1; + prnMsg(_('The location') . ' ' . $_POST['SelectedLocation'] . ' ' . _('is already authorised for this user'), 'error'); + } else { + // Add new record on submit + $SQL = "INSERT INTO locationusers (loccode, + userid, + canview, + canupd) + VALUES ('" . $_POST['SelectedLocation'] . "', + '" . $_POST['SelectedUser'] . "', + '1', + '1')"; + + $msg = _('User') . ': ' . $_POST['SelectedUser'] . ' ' . _('authority to use the') . ' ' . $_POST['SelectedLocation'] . ' ' . _('location has been changed'); + $Result = DB_query($SQL); + prnMsg($msg, 'success'); + unset($_POST['SelectedLocation']); + } + } +} elseif (isset($_GET['delete'])) { + $SQL = "DELETE FROM locationusers + WHERE loccode='" . $SelectedLocation . "' + AND userid='" . $SelectedUser . "'"; + + $ErrMsg = _('The Location user record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to use the') . ' ' . $SelectedLocation . ' ' . _('location removed'), 'success'); + unset($_GET['delete']); +} elseif (isset($_GET['ToggleUpdate'])) { + $SQL = "UPDATE locationusers + SET canupd='" . $_GET['ToggleUpdate'] . "' + WHERE loccode='" . $SelectedLocation . "' + AND userid='" . $SelectedUser . "'"; + + $ErrMsg = _('The Location user record could not be deleted because'); + $Result = DB_query($SQL, $ErrMsg); + prnMsg(_('User') . ' ' . $SelectedUser . ' ' . _('has had their authority to update') . ' ' . $SelectedLocation . ' ' . _('location removed'), 'success'); + unset($_GET['ToggleUpdate']); +} + +if (!isset($SelectedUser)) { + + /* It could still be the second time the page has been run and a record has been selected for modification - SelectedLocation will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters + then none of the above are true. These will call the same page again and allow update/input or deletion of the records*/ + echo '
'; + echo ' + + + + '; + + echo '
' . _('Select User') . ':
'; // close main table + DB_free_result($Result); + + echo '
+ + +
'; + + echo '
'; + +} + +//end of ifs and buts! +if (isset($_POST['process']) or isset($SelectedUser)) { + $SQLName = "SELECT realname + FROM www_users + WHERE userid='" . $SelectedUser . "'"; + $Result = DB_query($SQLName); + $MyRow = DB_fetch_array($Result); + $SelectedUserName = $MyRow['realname']; + + echo ' +
+ + '; + + $SQL = "SELECT locationusers.loccode, + canview, + canupd, + locations.locationname + FROM locationusers INNER JOIN locations + ON locationusers.loccode=locations.loccode + WHERE locationusers.userid='" . $SelectedUser . "' + ORDER BY locations.locationname ASC"; + + $Result = DB_query($SQL); + + echo ''; + echo ' + + '; + echo ' + + + + + '; + + while ($MyRow = DB_fetch_array($Result)) { + + if ($MyRow['canupd'] == 1) { + $ToggleText = ''; + } else { + $ToggleText = ''; + } + + printf(' + + + + ' . + $ToggleText . ' + + ', + $MyRow['loccode'], + $MyRow['locationname'], + $MyRow['canview'], + $MyRow['canupd'], + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), + $MyRow['loccode'], + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), + $MyRow['loccode']); + } + //END WHILE LIST LOOP + echo '

' . _('Authorised Inventory Locations for User') . ': ' . $SelectedUserName . '

' . _('Code') . '' . _('Name') . '' . _('View') . '' . _('Update') . '
' . _('Remove Update') . '' . _('Add Update') . '
%s%s%s%s' . _('Un-authorise') . '
'; + + if (!isset($_GET['delete'])) { + + + echo ''; //Main table + + echo ' + + + +
' . _('Select Location') . ': +
'; // close main table + DB_free_result($Result); + + echo '
+ + +
+
'; + + } // end if user wish to delete +} + +include('includes/footer.php'); +?> diff --git a/WOCanBeProducedNow.php b/WOCanBeProducedNow.php index c1dd4e04c..dc6c564f0 100644 --- a/WOCanBeProducedNow.php +++ b/WOCanBeProducedNow.php @@ -1,254 +1,254 @@ - woitems.qtyrecd ". - $WhereLocation . - "ORDER BY woitems.wo, woitems.stockid" - ; - - $ErrMsg = _('The SQL to find the WO items to produce '); - $resultItems = DB_query($sql,$ErrMsg); - if (DB_num_rows($resultItems) != 0){ - - echo '

' . "Items in WO to be produced now in " . $Location . " with available stock" . '

'; - echo '
'; - echo ''; - $TableHeader = ' - - - - - - - - - - - - - - - '; - - while ($myItem = DB_fetch_array($resultItems)) { - echo $TableHeader; - - $QtyPending = $myItem['qtyreqd'] - $myItem['qtyrecd']; - $QtyCanBeProduced = $QtyPending; - - $WOLink = '' . $myItem['wo'] . ''; - $CodeLink = '' . $myItem['stockid'] . ''; - - printf(' - - - - - - - - - - - - - ', - $WOLink, - $CodeLink, - locale_number_format($myItem['qtyreqd'],$myItem['decimalplaces']), - locale_number_format($myItem['qtyrecd'],$myItem['decimalplaces']), - locale_number_format($QtyPending,$myItem['decimalplaces']), - $myItem['units'], - '', - '', - '', - '', - '', - '', - '' - ); - - // Get the BOM for this item - $sqlBOM = "SELECT bom.parent, - bom.component, - bom.quantity AS bomqty, - stockmaster.decimalplaces, - stockmaster.units, - stockmaster.shrinkfactor, - locstock.quantity AS qoh - FROM bom, stockmaster, locstock - WHERE bom.component = stockmaster.stockid - AND bom.component = locstock.stockid - AND locstock.loccode = '". $Location ."' - AND bom.parent = '" . $myItem['stockid'] . "' - AND bom.effectiveafter <= '" . date('Y-m-d') . "' - AND bom.effectiveto > '" . date('Y-m-d') . "'"; - - $ErrMsg = _('The bill of material could not be retrieved because'); - $BOMResult = DB_query ($sqlBOM,$ErrMsg); - $ItemCanBeproduced = TRUE; - - while ($myComponent = DB_fetch_array($BOMResult)) { - - $ComponentNeeded = $myComponent['bomqty'] * $QtyPending; - $PrevisionShrinkage = $ComponentNeeded * ($myComponent['shrinkfactor'] / 100); - - if ($myComponent['qoh'] >= $ComponentNeeded){ - $Available = "OK"; - }else{ - $Available = ""; - $ItemCanBeproduced = FALSE; - } - - $ComponentLink = '' . $myComponent['component'] . ''; - - printf(' - - - - - - - - - - - - - ', - '', - '', - '', - '', - '', - '', - $ComponentLink, - locale_number_format($myComponent['qoh'],$myComponent['decimalplaces']), - locale_number_format($ComponentNeeded,$myComponent['decimalplaces']), - locale_number_format($PrevisionShrinkage,$myComponent['decimalplaces']), - $myComponent['units'], - $Available, - '' - ); - } - if ($ItemCanBeproduced){ - $Action = 'Produce ' . locale_number_format($QtyPending,0) . ' x ' . $myItem['stockid'] . ' for WO ' . locale_number_format($myItem['wo'],0); - $ComponentLink = '' . $Action . ''; - }else{ - $ComponentLink = ""; - } - printf(' - - - - - - - - - - - - - ', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - $ComponentLink - ); - } - echo '
' . _('WO') . '' . _('Stock ID') . '' . _('Requested') . '' . _('Received') . '' . _('Pending') . '' . _('UOM') . '' . _('Component') . '' . _('QOH') . '' . _('Needed') . '' . _('Shrinkage') . '' . _('UOM') . '' . _('Result') . '
%s%s%s%s%s%s%s%s%s%s%s%s%s
%s%s%s%s%s%s%s%s%s%s%s%s%s
%s%s%s%s%s%s%s%s%s%s%s%s%s
-
'; - - }else{ - prnMsg('No items waiting to be produced in ' . $Location); - } - -} // End of function submit() - - -function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### -{ -// Display form fields. This function is called the first time -// the page is called. - - echo '
-
-
-
'; - echo ''; - - echo '

' . "List of items in WO ready to be produced in: " . '

'; - - echo ''; - - echo ' - - - '; - - - echo ' - - - - - -
' . _('For Factory Location') . ':
 
 
 
-
'; - echo '
-
'; - -} // End of function display() - -include('includes/footer.php'); + woitems.qtyrecd ". + $WhereLocation . + "ORDER BY woitems.wo, woitems.stockid" + ; + + $ErrMsg = _('The SQL to find the WO items to produce '); + $resultItems = DB_query($sql,$ErrMsg); + if (DB_num_rows($resultItems) != 0){ + + echo '

' . "Items in WO to be produced now in " . $Location . " with available stock" . '

'; + echo '
'; + echo ''; + $TableHeader = ' + + + + + + + + + + + + + + + '; + + while ($myItem = DB_fetch_array($resultItems)) { + echo $TableHeader; + + $QtyPending = $myItem['qtyreqd'] - $myItem['qtyrecd']; + $QtyCanBeProduced = $QtyPending; + + $WOLink = '' . $myItem['wo'] . ''; + $CodeLink = '' . $myItem['stockid'] . ''; + + printf(' + + + + + + + + + + + + + ', + $WOLink, + $CodeLink, + locale_number_format($myItem['qtyreqd'],$myItem['decimalplaces']), + locale_number_format($myItem['qtyrecd'],$myItem['decimalplaces']), + locale_number_format($QtyPending,$myItem['decimalplaces']), + $myItem['units'], + '', + '', + '', + '', + '', + '', + '' + ); + + // Get the BOM for this item + $sqlBOM = "SELECT bom.parent, + bom.component, + bom.quantity AS bomqty, + stockmaster.decimalplaces, + stockmaster.units, + stockmaster.shrinkfactor, + locstock.quantity AS qoh + FROM bom, stockmaster, locstock + WHERE bom.component = stockmaster.stockid + AND bom.component = locstock.stockid + AND locstock.loccode = '". $Location ."' + AND bom.parent = '" . $myItem['stockid'] . "' + AND bom.effectiveafter <= '" . date('Y-m-d') . "' + AND bom.effectiveto > '" . date('Y-m-d') . "'"; + + $ErrMsg = _('The bill of material could not be retrieved because'); + $BOMResult = DB_query ($sqlBOM,$ErrMsg); + $ItemCanBeproduced = TRUE; + + while ($myComponent = DB_fetch_array($BOMResult)) { + + $ComponentNeeded = $myComponent['bomqty'] * $QtyPending; + $PrevisionShrinkage = $ComponentNeeded * ($myComponent['shrinkfactor'] / 100); + + if ($myComponent['qoh'] >= $ComponentNeeded){ + $Available = "OK"; + }else{ + $Available = ""; + $ItemCanBeproduced = FALSE; + } + + $ComponentLink = '' . $myComponent['component'] . ''; + + printf(' + + + + + + + + + + + + + ', + '', + '', + '', + '', + '', + '', + $ComponentLink, + locale_number_format($myComponent['qoh'],$myComponent['decimalplaces']), + locale_number_format($ComponentNeeded,$myComponent['decimalplaces']), + locale_number_format($PrevisionShrinkage,$myComponent['decimalplaces']), + $myComponent['units'], + $Available, + '' + ); + } + if ($ItemCanBeproduced){ + $Action = 'Produce ' . locale_number_format($QtyPending,0) . ' x ' . $myItem['stockid'] . ' for WO ' . locale_number_format($myItem['wo'],0); + $ComponentLink = '' . $Action . ''; + }else{ + $ComponentLink = ""; + } + printf(' + + + + + + + + + + + + + ', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + $ComponentLink + ); + } + echo '
' . _('WO') . '' . _('Stock ID') . '' . _('Requested') . '' . _('Received') . '' . _('Pending') . '' . _('UOM') . '' . _('Component') . '' . _('QOH') . '' . _('Needed') . '' . _('Shrinkage') . '' . _('UOM') . '' . _('Result') . '
%s%s%s%s%s%s%s%s%s%s%s%s%s
%s%s%s%s%s%s%s%s%s%s%s%s%s
%s%s%s%s%s%s%s%s%s%s%s%s%s
+
'; + + }else{ + prnMsg('No items waiting to be produced in ' . $Location); + } + +} // End of function submit() + + +function display(&$db) //####DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_DISPLAY_##### +{ +// Display form fields. This function is called the first time +// the page is called. + + echo '
+
+
+
'; + echo ''; + + echo '

' . "List of items in WO ready to be produced in: " . '

'; + + echo ''; + + echo ' + + + '; + + + echo ' + + + + + +
' . _('For Factory Location') . ':
 
 
 
+
'; + echo '
+
'; + +} // End of function display() + +include('includes/footer.php'); ?> \ No newline at end of file diff --git a/WWW_Access.php b/WWW_Access.php index 90f4138a6..7bdb91353 100644 --- a/WWW_Access.php +++ b/WWW_Access.php @@ -115,20 +115,12 @@   '; - $k=0; //row colour counter - while($myrow = DB_fetch_array($result)) { - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } /*The SecurityHeadings array is defined in config.php */ - printf('%s + printf(' + %s ' . _('Edit') . ' ' . _('Delete') . ' ', @@ -212,43 +204,37 @@ } echo ''; - $k=0; //row colour counter while($AvailRow = DB_fetch_array($Result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - if (in_array($AvailRow['tokenid'],$TokensUsed)){ - printf('%s + printf(' + %s %s ' . _('Remove') . '     -  ', +   + ', $AvailRow['tokenid'], $AvailRow['tokenname'], htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', $SelectedRole, $AvailRow['tokenid'] ); } else { - printf('  + printf(' +       %s %s - ' . _('Add') . '', + ' . _('Add') . ' + ', $AvailRow['tokenid'], $AvailRow['tokenname'], htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?', $SelectedRole, $AvailRow['tokenid'] ); } - echo ''; } echo ''; } diff --git a/WWW_Users.php b/WWW_Users.php index 77b29ba95..ceb4874d2 100644 --- a/WWW_Users.php +++ b/WWW_Users.php @@ -360,22 +360,15 @@ FROM www_users"; $Result = DB_query($Sql); - $k = 1;// Row colour counter. while ($MyRow = DB_fetch_array($Result)) { - if($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } if($MyRow[8] == '') { $LastVisitDate = _('No login record'); } else { $LastVisitDate = ConvertSQLDate($MyRow[8]); } /*The SecurityHeadings array is defined in config.php */ - echo '', $MyRow['userid'], ' + echo ' + ', $MyRow['userid'], ' ', $MyRow['realname'], ' ', $MyRow['phone'], ' ', $MyRow['email'], ' diff --git a/WhereUsedInquiry.php b/WhereUsedInquiry.php index 4ec6cd009..974e87a32 100644 --- a/WhereUsedInquiry.php +++ b/WhereUsedInquiry.php @@ -76,22 +76,16 @@ ' . _('Effective After') . ' ' . _('Effective To') . ' '; - $k=0; + while ($myrow=DB_fetch_array($result)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo '';; - $k=1; - } if ($myrow['discontinued'] == 1){ $Status = _('Obsolete'); }else{ $Status = _('Current'); } - echo '' . $myrow['parent']. ' - ' . $myrow['description']. ' + echo ' + ' . $myrow['parent']. ' - ' . $myrow['description']. ' ' . $Status. ' ' . $myrow['workcentreadded']. ' ' . $myrow['loccode']. ' diff --git a/WorkOrderEntry.php b/WorkOrderEntry.php index ec6952a04..d00a1d0c9 100644 --- a/WorkOrderEntry.php +++ b/WorkOrderEntry.php @@ -821,17 +821,11 @@ ' . _('Balance Remaining') . ' ' . _('Next Lot/SN Ref') . ' '; -$j=0; + if(isset($NumberOfOutputs)) { for ($i=1;$i<=$NumberOfOutputs;$i++) { - if($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j=1; - } - echo '' . + echo ' + ' . $_POST['OutputItem' . $i] . ' - ' . $_POST['OutputItemDesc' .$i] . ' '; echo' @@ -973,7 +967,6 @@ ' . _('Description') . ' ' . _('Units') . ''; $j = 1; - $k=0; //row colour counter $ItemCodes = array(); for ($i=1;$i<=$NumberOfOutputs;$i++) { $ItemCodes[] =$_POST['OutputItem'.$i]; @@ -998,16 +991,10 @@ $ImageSource = _('No Image'); } - if($k==1) { - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } if($myrow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity - printf('%s + printf(' + %s %s %s %s @@ -1026,14 +1013,14 @@ if(!isset($myrow['quantity'])) { $myrow['quantity'] = 0; } - printf('%s + printf(' + %s %s %s %s ' . _('Add to Work Order') . ' - ', $myrow['stockid'], $myrow['description'], @@ -1052,7 +1039,7 @@ }//end of while loop } //end if more than 1 row to show echo ''; - echo '
+ echo '
'; diff --git a/WorkOrderEntry.php.orig b/WorkOrderEntry.php.orig new file mode 100644 index 000000000..ec6952a04 --- /dev/null +++ b/WorkOrderEntry.php.orig @@ -0,0 +1,1064 @@ + ', // Icon title. + $Title, '

';// Page title. + +if(isset($_GET['WO'])) { + $SelectedWO = $_GET['WO']; +} elseif(isset($_POST['WO'])) { + $SelectedWO = $_POST['WO']; +} else { + unset($SelectedWO); +} + +if(isset($_GET['ReqDate'])) { + $ReqDate = $_GET['ReqDate']; +} else { + $ReqDate=Date('Y-m-d'); +} + +if(isset($_GET['StartDate'])) { + $StartDate = $_GET['StartDate']; +} else { + $StartDate=Date('Y-m-d'); +} + +if(isset($_GET['loccode'])) { + $LocCode = $_GET['loccode']; +} else { + $LocCode=$_SESSION['UserStockLocation']; +} + +$LocResult = DB_query("SELECT locations.loccode FROM locations + INNER JOIN locationusers ON locationusers.loccode=locations.loccode + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canupd=1 + WHERE locations.loccode='" . $LocCode . "'"); +$LocRow = DB_fetch_array($LocResult); + +if(is_null($LocRow['loccode']) OR $LocRow['loccode']=='') { + prnMsg(_('Your security settings do not allow you to create or update new Work Order at this location') . ' ' . $LocCode,'error'); + echo '
' . _('Select an existing work order') . ''; + include('includes/footer.php'); + exit; +} + +foreach ($_POST as $key=>$value) { + if(substr($key, 0, 9)=='OutputQty' OR substr($key, 0, 7)=='RecdQty') { + $_POST[$key] = filter_number_format($value); + } +} + +// check for new or modify condition +if(isset($SelectedWO) AND$SelectedWO!='') { + // modify + $_POST['WO'] = (int)$SelectedWO; + $EditingExisting = true; +} else { + if(!isset($_POST['Ref'])) { + $Ref = ''; + } + if(!isset($_POST['Remark'])) { + $Remark = ''; + } + + // new + $_POST['WO'] = GetNextTransNo(40,$db); + $SQL = "INSERT INTO workorders (wo, + loccode, + requiredby, + startdate, + reference, + remark) + VALUES ( + '" . $_POST['WO'] . "', + '" . $LocCode . "', + '" . $ReqDate . "', + '" . $StartDate. "', + '" . $Ref . "', + '" . $Remark . "')"; + $InsWOResult = DB_query($SQL); +} + + +if(isset($_GET['NewItem'])) { + $NewItem = $_GET['NewItem']; +} +if(isset($_GET['ReqQty'])) { + $ReqQty = $_GET['ReqQty']; +} +if(!isset($_POST['StockLocation'])) { + if(isset($LocCode)) { + $_POST['StockLocation']=$LocCode; + } elseif(isset($_SESSION['UserStockLocation'])) { + $_POST['StockLocation']=$_SESSION['UserStockLocation']; + } +} + + + +if(isset($_POST['Search']) OR isset($_POST['Prev']) OR isset($_POST['Next'])) { + + If ($_POST['Keywords'] AND $_POST['StockCode']) { + prnMsg(_('Stock description keywords have been used in preference to the Stock code extract entered'),'warn'); + } + if(mb_strlen($_POST['SO'])>0) { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled, + salesorderdetails.quantity + FROM salesorderdetails + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorderdetails.orderno='" . $_POST['SO'] . "' + ORDER BY stockmaster.stockid + "; + } elseif(mb_strlen($_POST['CustomerRef'])>0) { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled, + salesorderdetails.quantity + FROM salesorderdetails + INNER JOIN salesorders + ON salesorderdetails.orderno=salesorders.orderno + INNER JOIN stockmaster + ON salesorderdetails.stkcode=stockmaster.stockid + WHERE salesorders.customerref='" . $_POST['CustomerRef'] . "' + ORDER BY stockmaster.stockid"; + } elseIf (mb_strlen($_POST['Keywords'])>0) { + //insert wildcard characters in spaces + $_POST['Keywords'] = mb_strtoupper($_POST['Keywords']); + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + + if($_POST['StockCat']=='All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.description " . LIKE . " '" . $SearchString . "' + AND stockmaster.discontinued=0 + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.discontinued=0 + AND stockmaster.description " . LIKE . " '" . $SearchString . "' + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } + + } elseif(mb_strlen($_POST['StockCode'])>0) { + + $_POST['StockCode'] = mb_strtoupper($_POST['StockCode']); + $SearchString = '%' . $_POST['StockCode'] . '%'; + + /* Only items of stock type F finished goods or M - raw materials can have work orders created - raw materials can include the manufacture of components (as noted by Bob Thomas! */ + if($_POST['StockCat']=='All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' + AND stockmaster.discontinued=0 + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.stockid " . LIKE . " '" . $SearchString . "' + AND stockmaster.discontinued=0 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } + } else { + if($_POST['StockCat']=='All') { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.discontinued=0 + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } else { + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.units, + stockmaster.controlled + FROM stockmaster + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockcategory.stocktype='F' OR stockcategory.stocktype='M') + AND stockmaster.discontinued=0 + AND stockmaster.categoryid='" . $_POST['StockCat'] . "' + AND mbflag='M' + ORDER BY stockmaster.stockid"; + } + } + + $SQLCount = substr($SQL,strpos($SQL, "FROM")); + $SQLCount = substr($SQLCount,0, strpos($SQLCount, "ORDER")); + $SQLCount = 'SELECT COUNT(*) '.$SQLCount; + $ErrMsg = _('Failed to retrieve item number'); + $SearchResult = DB_query($SQLCount,$ErrMsg); + + $myrow=DB_fetch_array($SearchResult); + DB_free_result($SearchResult); + unset($SearchResult); + $ListCount = $myrow[0]; + if($ListCount>0) { + $ListPageMax = ceil($ListCount / $_SESSION['DisplayRecordsMax'])-1; + } else { + $ListPageMax =1; + } + + + if(isset($_POST['Next'])) { + $Offset = $_POST['CurrPage']+1; + } + if(isset($_POST['Prev'])) { + $Offset = $_POST['CurrPage']-1; + } + if(!isset($Offset)) { + $Offset=0; + } + if($Offset<0) { + $Offset=0; + } + if($Offset>$ListPageMax) { + $Offset=$ListPageMax; + } + $SQL = $SQL . ' LIMIT ' . $_SESSION['DisplayRecordsMax'].' OFFSET ' . strval($_SESSION['DisplayRecordsMax']*$Offset); + + + $ErrMsg = _('There is a problem selecting the part records to display because'); + $DbgMsg = _('The SQL used to get the part selection was'); + $SearchResult = DB_query($SQL,$ErrMsg, $DbgMsg); + + if(DB_num_rows($SearchResult)==0 ) { + prnMsg (_('There are no products available meeting the criteria specified'),'info'); + + if($debug==1) { + prnMsg(_('The SQL statement used was') . ':
' . $SQL,'info'); + } + } + if(DB_num_rows($SearchResult)==1) { + $myrow=DB_fetch_array($SearchResult); + $NewItem = $myrow['stockid']; + if(isset($myrow['quantity'])) { + $ReqQty = $myrow['quantity']; + } + DB_data_seek($SearchResult,0); + } + +} //end of if search +if(isset($_POST['Add'])) { + foreach($_POST as $key=>$value) { + if(strpos($key,'Check_')!==false) { + $NewItem[] = array('item'=>$value,'qty'=>0); + } + if(strpos($key,'Qty_') !== false AND $value>0) { + $No = substr($key,4); + $NewItem[] = array('item'=>$_POST['Item_'.$No],'qty'=>$value); + } + } +} + + +if(isset($NewItem) AND isset($_POST['WO'])) { + if(!is_array($NewItem)) { + $InputError=false; + $CheckItemResult = DB_query("SELECT mbflag, + eoq, + controlled + FROM stockmaster + WHERE stockid='" . $NewItem . "'"); + if(DB_num_rows($CheckItemResult)==1) { + $CheckItemRow = DB_fetch_array($CheckItemResult); + if($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity + $EOQ = 0; + } else { + if(!isset($ReqQty)) { + $ReqQty=$CheckItemRow['eoq']; + } + $EOQ = $ReqQty; + } + if($CheckItemRow['mbflag']!='M') { + prnMsg(_('The item selected cannot be added to a work order because it is not a manufactured item'),'warn'); + $InputError=true; + } + } else { + prnMsg(_('The item selected cannot be found in the database'),'error'); + $InputError = true; + } + $CheckItemResult = DB_query("SELECT stockid + FROM woitems + WHERE stockid='" . $NewItem . "' + AND wo='" .$_POST['WO'] . "'"); + if(DB_num_rows($CheckItemResult)==1) { + prnMsg(_('This item is already on the work order and cannot be added again'),'warn'); + $InputError=true; + } + + + if($InputError==false) { + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, + bom.loccode + FROM stockmaster + INNER JOIN bom + ON stockmaster.stockid=bom.component + WHERE bom.parent='" . $NewItem . "' + AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto>='" . Date('Y-m-d') . "'"); + $CostRow = DB_fetch_array($CostResult); + if(is_null($CostRow['cost'])) { + $Cost =0; + prnMsg(_('The cost of this item as accumulated from the sum of the component costs is nil. This could be because there is no bill of material set up ... you may wish to double check this'),'warn'); + } elseif($CostRow['cost'] == 0) { + $Cost = 0; + prnMsg(_('The cost of this item as accumulated from the sum of the component costs is zero'),'warn'); + } else { + $Cost = $CostRow['cost']; + } + if(!isset($EOQ)) { + $EOQ=1; + } + + $Result = DB_Txn_Begin(); + + // insert parent item info + $SQL = "INSERT INTO woitems (wo, + stockid, + qtyreqd, + stdcost) + VALUES ( + '" . $_POST['WO'] . "', + '" . $NewItem . "', + '" . $EOQ . "', + '" . $Cost . "' + )"; + $ErrMsg = _('The work order item could not be added'); + $result = DB_query($SQL,$ErrMsg); + + //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements + WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $NewItem); + + $result = DB_Txn_Commit(); + + unset($NewItem); + } + } else { + DB_txn_begin(); + foreach ($NewItem as $ItemDetail) { + $Itm = $ItemDetail['item']; + if($ItemDetail['qty']>0) { + $ReqQty = $ItemDetail['qty']; + } + $InputError=false; + $CheckItemResult = DB_query("SELECT mbflag, + eoq, + controlled + FROM stockmaster + WHERE stockid='" . $Itm . "'"); + + if(DB_num_rows($CheckItemResult)==1) { + $CheckItemRow = DB_fetch_array($CheckItemResult); + if($CheckItemRow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity + $EOQ = 0; + } else { + if(!isset($ReqQty)) { + $ReqQty=$CheckItemRow['eoq']; + } + $EOQ = $ReqQty; + } + if($CheckItemRow['mbflag']!='M') { + prnMsg(_('The item selected cannot be added to a work order because it is not a manufactured item'),'warn'); + $InputError=true; + } + } else { + prnMsg(_('The item selected cannot be found in the database'),'error'); + $InputError = true; + } + $CheckItemResult = DB_query("SELECT stockid + FROM woitems + WHERE stockid='" . $Itm . "' + AND wo='" .$_POST['WO'] . "'" + ); + if(DB_num_rows($CheckItemResult)==1) { + prnMsg(_('This item is already on the work order and cannot be added again'),'warn'); + $InputError=true; + } + + + if($InputError==false) { + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost, + bom.loccode + FROM stockmaster + INNER JOIN bom + ON stockmaster.stockid=bom.component + WHERE bom.parent='" . $Itm . "' + AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto>='" . Date('Y-m-d') . "'"); + + + $CostRow = DB_fetch_array($CostResult); + if(is_null($CostRow['cost'])) { + $Cost =0; + prnMsg(_('The cost of this item as accumulated from the sum of the component costs is nil. This could be because there is no bill of material set up ... you may wish to double check this'),'warn'); + } elseif($CostRow['cost'] == 0) { + $Cost = 0; + prnMsg(_('The The cost of this item as accumulated from the sum of the component costs is zero'),'warn'); + } else { + $Cost = $CostRow['cost']; + } + if(!isset($EOQ)) { + $EOQ=1; + } + + + // insert parent item info + $SQL = "INSERT INTO woitems (wo, + stockid, + qtyreqd, + stdcost) + VALUES ( + '" . $_POST['WO'] . "', + '" . $Itm . "', + '" . $EOQ . "', + '" . $Cost . "' + )"; + $ErrMsg = _('The work order item could not be added'); + $result = DB_query($SQL,$ErrMsg); + //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements + WoRealRequirements($db, $_POST['WO'], $CostRow['loccode'], $Itm); + } //end if there were no input errors + else { + DB_txn_rollback(); + } + }//end of foreach loop; + + DB_txn_commit(); + unset($NewItem); + } +} //adding a new item to the work order + + +if(isset($_POST['submit']) OR isset($_POST['Search'])) { //The update button has been clicked + + echo ''; + + $Input_Error = false; //hope for the best + for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++) { + if(!is_numeric($_POST['OutputQty'.$i])) { + prnMsg(_('The quantity entered must be numeric'),'error'); + $Input_Error = true; + } elseif($_POST['OutputQty'.$i]<=0) { + prnMsg(_('The quantity entered must be a positive number greater than zero'),'error'); + $Input_Error = true; + } + } + if(!Is_Date($_POST['RequiredBy'])) { + prnMsg(_('The required by date entered is in an invalid format'),'error'); + $Input_Error = true; + } + + if($Input_Error == false) { + + $SQL_ReqDate = FormatDateForSQL($_POST['RequiredBy']); + $QtyRecd=0; + + for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++) { + $QtyRecd+=$_POST['RecdQty'.$i]; + } + unset($SQL); + + if($QtyRecd==0) { //can only change factory location if Qty Recd is 0 + $SQL[] = "UPDATE workorders SET requiredby='" . $SQL_ReqDate . "', + startdate='" . FormatDateForSQL($_POST['StartDate']) . "', + loccode='" . $_POST['StockLocation'] . "', + reference='" . $_POST['Ref'] . "', + remark='" . $_POST['Remark'] . "' + WHERE wo='" . $_POST['WO'] . "'"; + } else { + prnMsg(_('The factory where this work order is made can only be updated if the quantity received on all output items is 0'),'warn'); + $SQL[] = "UPDATE workorders SET requiredby='" . $SQL_ReqDate . "', + startdate='" . FormatDateForSQL($_POST['StartDate']) . "', + reference='" . $_POST['Ref'] . "', + remark='" . $_POST['Remark'] . "' + WHERE wo='" . $_POST['WO'] . "'"; + } + + for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++) { + if(!isset($_POST['NextLotSNRef'.$i])) { + $_POST['NextLotSNRef'.$i]=''; + } + if(!isset($_POST['WOComments'.$i])) { + $_POST['WOComments'.$i]=''; + } + $SQL[] = "UPDATE woitems SET comments = '". $_POST['WOComments'.$i] ."' + WHERE wo='" . $_POST['WO'] . "' + AND stockid='" . $_POST['OutputItem'.$i] . "'"; + if(isset($_POST['QtyRecd'.$i]) AND $_POST['QtyRecd'.$i]>$_POST['OutputQty'.$i]) { + $_POST['OutputQty'.$i]=$_POST['QtyRecd'.$i]; //OutputQty must be >= Qty already reced + } + if($_POST['RecdQty'.$i]==0 AND (!isset($_POST['HasWOSerialNos'.$i]) OR $_POST['HasWOSerialNos'.$i]==false)) { + /* can only change location cost if QtyRecd=0 */ + $CostResult = DB_query("SELECT SUM((materialcost+labourcost+overheadcost)*bom.quantity) AS cost,bom.loccode + FROM stockmaster + INNER JOIN bom ON stockmaster.stockid=bom.component + WHERE bom.parent='" . $_POST['OutputItem'.$i] . "' + AND bom.loccode=(SELECT loccode FROM workorders WHERE wo='" . $_POST['WO'] . "') + AND bom.effectiveafter<='" . Date('Y-m-d') . "' + AND bom.effectiveto>='" . Date('Y-m-d') . "'"); + $CostRow = DB_fetch_array($CostResult); + if(is_null($CostRow['cost'])) { + $Cost =0; + prnMsg(_('The cost of this item as accumulated from the sum of the component costs is nil. This could be because there is no bill of material set up ... you may wish to double check this'),'warn'); + } else { + $Cost = $CostRow['cost']; + } + $SQL[] = "UPDATE woitems SET qtyreqd = '". $_POST['OutputQty' . $i] . "', + nextlotsnref = '". $_POST['NextLotSNRef'.$i] ."', + stdcost ='" . $Cost . "' + WHERE wo='" . $_POST['WO'] . "' + AND stockid='" . $_POST['OutputItem'.$i] . "'"; + } elseif(isset($_POST['HasWOSerialNos'.$i]) AND $_POST['HasWOSerialNos'.$i]==false) { + $SQL[] = "UPDATE woitems SET qtyreqd = '". $_POST['OutputQty' . $i] . "', + nextlotsnref = '". $_POST['NextLotSNRef'.$i] ."' + WHERE wo='" . $_POST['WO'] . "' + AND stockid='" . $_POST['OutputItem'.$i] . "'"; + } + } + + //run the SQL from either of the above possibilites + $ErrMsg = _('The work order could not be added/updated'); + foreach ($SQL as $SQL_stmt) { + // echo '
' . $SQL_stmt; + $result = DB_query($SQL_stmt,$ErrMsg); + + } + if(!isset($_POST['Search'])) { + prnMsg(_('The work order has been updated'),'success'); + } + + for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++) { + unset($_POST['OutputItem'.$i]); + unset($_POST['OutputQty'.$i]); + unset($_POST['QtyRecd'.$i]); + unset($_POST['NetLotSNRef'.$i]); + unset($_POST['HasWOSerialNos'.$i]); + unset($_POST['WOComments'.$i]); + } + } +} elseif(isset($_POST['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + + $CancelDelete=false; //always assume the best + + // can't delete it there are open work issues + $HasTransResult = DB_query("SELECT transno + FROM stockmoves + WHERE (stockmoves.type= 26 OR stockmoves.type=28) + AND reference " . LIKE . " '%" . $_POST['WO'] . "%'"); + if(DB_num_rows($HasTransResult)>0) { + prnMsg(_('This work order cannot be deleted because it has issues or receipts related to it'),'error'); + $CancelDelete=true; + } + + if($CancelDelete==false) { //ie all tests proved ok to delete + DB_Txn_Begin(); + $ErrMsg = _('The work order could not be deleted'); + $DbgMsg = _('The SQL used to delete the work order was'); + //delete the worequirements + $SQL = "DELETE FROM worequirements WHERE wo='" . $_POST['WO'] . "'"; + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + //delete the items on the work order + $SQL = "DELETE FROM woitems WHERE wo='" . $_POST['WO'] . "'"; + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + //delete the controlled items defined in wip + $SQL="DELETE FROM woserialnos WHERE wo='" . $_POST['WO'] . "'"; + $ErrMsg=_('The work order serial numbers could not be deleted'); + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + // delete the actual work order + $SQL="DELETE FROM workorders WHERE wo='" . $_POST['WO'] . "'"; + $ErrMsg=_('The work order could not be deleted'); + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + + DB_Txn_Commit(); + prnMsg(_('The work order has been cancelled'),'success'); + + + echo '

' . _('Select an existing outstanding work order') . '

'; + unset($_POST['WO']); + for ($i=1;$i<=$_POST['NumberOfOutputs'];$i++) { + unset($_POST['OutputItem'.$i]); + unset($_POST['OutputQty'.$i]); + unset($_POST['QtyRecd'.$i]); + unset($_POST['NetLotSNRef'.$i]); + unset($_POST['HasWOSerialNos'.$i]); + unset($_POST['WOComments'.$i]); + } + include('includes/footer.php'); + exit; + } +} +if(isset($_GET['Delete'])) { + $CancelDelete=false; //always assume the best + + // can't delete it there are open work issues + $HasTransResult = DB_query("SELECT transno + FROM stockmoves + WHERE (stockmoves.type= 26 OR stockmoves.type=28) + AND reference " . LIKE . " '%" . $_POST['WO'] . "%'"); + if(DB_num_rows($HasTransResult)>0) { + prnMsg(_('This work order cannot be deleted because it has issues or receipts related to it'),'error'); + $CancelDelete=true; + } + //delete items + if($CancelDelete===false) { + //delete items + DB_Txn_Begin(); + $ErrMsg = _('The work order could not be deleted'); + $DbgMsg = _('The SQL used to delete the work order was'); + //delete the worequirements + $SQL = "DELETE FROM worequirements WHERE wo='" . $_GET['WO'] . "' AND parentstockid='" . $_GET['StockID'] . "'"; + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + //delete the item on the work order + $SQL = "DELETE FROM woitems WHERE wo='" . $_GET['WO'] . "' AND stockid='" . $_GET['StockID'] . "' "; + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + //delete the controlled items defined in wip + $SQL="DELETE FROM woserialnos WHERE wo='" . $_GET['WO'] . "' AND stockid='" . $_GET['StockID'] . "' "; + $ErrMsg=_('The work order serial numbers could not be deleted'); + $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); + DB_Txn_Commit(); + prnMsg(_('The item in this work order has been cancelled'),'success'); + header('Location: '. $_SERVER['PHP_SELF'] . '?WO=' . $_GET['WO']); + } +} + + +echo '
'; +echo ''; + +echo '
'; + +$SQL="SELECT workorders.loccode, + requiredby, + startdate, + costissued, + closed, + reference, + remark + FROM workorders INNER JOIN locations + ON workorders.loccode=locations.loccode + INNER JOIN locationusers ON locationusers.loccode=workorders.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canupd=1 + WHERE workorders.wo='" . $_POST['WO'] . "'"; + +$WOResult = DB_query($SQL); +if(DB_num_rows($WOResult)==1) { + + $myrow = DB_fetch_array($WOResult); + $_POST['StartDate'] = ConvertSQLDate($myrow['startdate']); + $_POST['CostIssued'] = $myrow['costissued']; + $_POST['Closed'] = $myrow['closed']; + $_POST['RequiredBy'] = ConvertSQLDate($myrow['requiredby']); + $_POST['StockLocation'] = $myrow['loccode']; + $_POST['Ref'] = $myrow['reference']; + $_POST['Remark'] = $myrow['remark']; + $ErrMsg =_('Could not get the work order items'); + $WOItemsResult = DB_query("SELECT woitems.stockid, + stockmaster.description, + qtyreqd, + qtyrecd, + stdcost, + nextlotsnref, + controlled, + serialised, + stockmaster.decimalplaces, + nextserialno, + woitems.comments + FROM woitems INNER JOIN stockmaster + ON woitems.stockid=stockmaster.stockid + WHERE wo='" .$_POST['WO'] . "'", + $ErrMsg); + + $NumberOfOutputs=DB_num_rows($WOItemsResult); + $i=1; + while ($WOItem=DB_fetch_array($WOItemsResult)) { + $_POST['OutputItem' . $i]=$WOItem['stockid']; + $_POST['OutputItemDesc'.$i]=$WOItem['description']; + $_POST['OutputQty' . $i]= $WOItem['qtyreqd']; + $_POST['RecdQty' .$i] =$WOItem['qtyrecd']; + $_POST['WOComments' .$i] =$WOItem['comments']; + $_POST['DecimalPlaces' . $i] = $WOItem['decimalplaces']; + if($WOItem['serialised']==1 AND $WOItem['nextserialno']>0) { + $_POST['NextLotSNRef' .$i]=$WOItem['nextserialno']; + } else { + $_POST['NextLotSNRef' .$i]=$WOItem['nextlotsnref']; + } + $_POST['Controlled'.$i] =$WOItem['controlled']; + $_POST['Serialised'.$i] =$WOItem['serialised']; + $HasWOSerialNosResult = DB_query("SELECT wo FROM woserialnos WHERE wo='" . $_POST['WO'] . "'"); + if(DB_num_rows($HasWOSerialNosResult)>0) { + $_POST['HasWOSerialNos']=true; + } else { + $_POST['HasWOSerialNos']=false; + } + $i++; + } +} else { + if($EditingExisting==true) { + prnMsg(_('Your location security settings do not allow you to Update this Work Order'),'error'); + echo '
' . _('Select an existing work order') . ''; + include('includes/footer.php'); + exit; + } + +} + +echo ''; +echo ''; +echo ' + '; +if(!isset($_POST['StartDate'])) { + $_POST['StartDate'] = Date($_SESSION['DefaultDateFormat']); +} + +echo ' + + + '; + +if(!isset($_POST['RequiredBy'])) { + $_POST['RequiredBy'] = Date($_SESSION['DefaultDateFormat']); +} + +echo ' + + + '; +if(!isset($_POST['Ref'])) { + $_POST['Ref'] = ''; +} +echo ' + + '; +if(!isset($_POST['Remark'])) { + $_POST['Remark'] = ''; +} +echo ' + + + '; + + +if(isset($WOResult)) { + echo ' + '; +} +echo '
' . _('Work Order Reference') . ':' . $_POST['WO'] . '
' . _('Factory Location') .':
' . _('Start Date') . ':
' . _('Required By') . ':
' . _('Reference') . ': +
' . _('Remark') . ':
' . _('Accumulated Costs') . ':' . locale_number_format($myrow['costissued'],$_SESSION['CompanyRecord']['decimalplaces']) . '
+
'; +echo ' + + + + + + '; +$j=0; +if(isset($NumberOfOutputs)) { + for ($i=1;$i<=$NumberOfOutputs;$i++) { + if($j==1) { + echo ''; + $j=0; + } else { + echo ''; + $j=1; + } + echo ''; + echo''; + if($_POST['Controlled'.$i]==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { + echo ''; + echo ''; + } else { + echo''; + } + echo ' + '; + if($_POST['Controlled'.$i]==1) { + echo ''; + if($_SESSION['DefineControlledOnWOEntry']==1) { + if($_POST['Serialised' . $i]==1) { + $LotOrSN = _('S/Ns'); + } else { + $LotOrSN = _('Batches'); + } + echo ''; + } + } else { + echo ''; + } + echo ''; + + if($_SESSION['WikiApp']!=0) { + echo ''; + } + echo ''; + if(isset($_POST['Controlled' . $i])) { + echo ''; + } + if(isset( $_POST['Serialised' . $i])) { + echo ''; + } + if(isset($_POST['HasWOSerialNos' . $i])) { + echo ''; + } + } + echo ''; +} +echo '
' . _('Output Item') . '' . _('Comments') . '' . _('Qty Required') . '' . _('Qty Received') . '' . _('Balance Remaining') . '' . _('Next Lot/SN Ref') . '
' . + $_POST['OutputItem' . $i] . ' - ' . $_POST['OutputItemDesc' .$i] . ' + + ' . locale_number_format($_POST['OutputQty' . $i], $_POST['DecimalPlaces' . $i]) . ' + + ' . locale_number_format($_POST['RecdQty' .$i], $_POST['DecimalPlaces' . $i]) . ' + ' . locale_number_format(($_POST['OutputQty' . $i] - $_POST['RecdQty' .$i]), $_POST['DecimalPlaces' . $i]) . ' + ' . $LotOrSN . ' + ' . _('Delete') . ''; + wikiLink('WorkOrder', $_POST['WO'] . $_POST['OutputItem' .$i]); + echo '
'; + +echo '
'; + +echo '
'; + +echo '

'; + +$SQL="SELECT categoryid, + categorydescription + FROM stockcategory + WHERE stocktype='F' OR stocktype='M' + ORDER BY categorydescription"; + $result1 = DB_query($SQL); + +echo ' + + + + + + + + + + + + +
' . _('Select a stock category') . ': + ' . _('Enter text extracts in the') . ' ' . _('description') . ':
 ' . _('OR') . ' ' . _('Enter extract of the') . ' ' . _('Stock Code') . ':
' . _('OR') . ' ' . _('Enter Sales Order') . ' + ' . _('OR') . ' ' . _('Enter Customer Order Ref') . '
+
+
+ +
'; + +if(isset($SearchResult)) { + + if(DB_num_rows($SearchResult)>1) { + + $PageBar = ''; + if($Offset>0) + $PageBar .= ''; + else + $PageBar .= ''; + $PageBar .= ''; + if($Offset<$ListPageMax) + $PageBar .= ''; + else + $PageBar .= ''; + $PageBar .= ''; + + echo '
'; + echo $PageBar; + echo ' + + + '; + $j = 1; + $k=0; //row colour counter + $ItemCodes = array(); + for ($i=1;$i<=$NumberOfOutputs;$i++) { + $ItemCodes[] =$_POST['OutputItem'.$i]; + } + + while ($myrow=DB_fetch_array($SearchResult)) { + + if(!in_array($myrow['stockid'],$ItemCodes)) { + + $SupportedImgExt = array('png','jpg','jpeg'); + $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); + if(extension_loaded('gd') && function_exists('gd_info') && file_exists ($imagefile) ) { + $ImageSource = ''; + } else if(file_exists ($imagefile)) { + $ImageSource = ''; + } else { + $ImageSource = _('No Image'); + } + + if($k==1) { + echo ''; + $k=0; + } else { + echo ''; + $k=1; + } + if($myrow['controlled']==1 AND $_SESSION['DefineControlledOnWOEntry']==1) { //need to add serial nos or batches to determine quantity + + printf(' + + + + + + ', + $myrow['stockid'], + $myrow['description'], + $myrow['units'], + $ImageSource, + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?WO=' . $_POST['WO'] . '&NewItem=' . urlencode($myrow['stockid']).'&Line='.$i, + $myrow['stockid'], + $j); + } else { + if(!isset($myrow['quantity'])) { + $myrow['quantity'] = 0; + } + printf(' + + + + + + + ', + $myrow['stockid'], + $myrow['description'], + $myrow['units'], + $ImageSource, + htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?WO=' . $_POST['WO'] . '&NewItem=' . urlencode($myrow['stockid']).'&Line='.$i, + $j, + $myrow['quantity'], + $myrow['stockid'], + $j); + } + + + $j++; + } //end if not already on work order + }//end of while loop + } //end if more than 1 row to show + echo '
' . _('Code') . '' . _('Description') . '' . _('Units') . '
%s%s%s%s' + . _('Add to Work Order') . '
%s%s%s%s' + . _('Add to Work Order') . '
'; + echo '
+ + +
'; + +}#end if SearchResults to show + +echo '
'; +include('includes/footer.php'); +?> diff --git a/WorkOrderIssue.php b/WorkOrderIssue.php index e074fe991..b322cb97f 100644 --- a/WorkOrderIssue.php +++ b/WorkOrderIssue.php @@ -1011,7 +1011,6 @@ '; echo $TableHeader; $j = 1; - $k=0; //row colour counter $ItemCodes = array(); while ($myrow=DB_fetch_array($SearchResult)) { @@ -1032,16 +1031,9 @@ $ImageSource = _('No Image'); } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - $IssueLink = htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?WO=' . $_POST['WO'] . '&StockID=' . urlencode($_POST['StockID']) . '&IssueItem=' . urlencode($myrow['stockid']) . '&FromLocation=' . $_POST['FromLocation']; - printf('%s + printf(' + %s %s %s %s diff --git a/Z_CheckAllocs.php b/Z_CheckAllocs.php index 2774b4793..fd9807693 100644 --- a/Z_CheckAllocs.php +++ b/Z_CheckAllocs.php @@ -68,19 +68,10 @@ echo $tableheader; $RowCounter = 1; - $k = 0; //row colour counter $AllocsTotal = 0; while ($myrow1=DB_fetch_array($TransResult)) { - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k++; - } - if ($myrow1['type']==11){ $TransType = _('Credit Note'); } else { @@ -88,7 +79,8 @@ } $CurrDecimalPlaces = $myrow1['currdecimalplaces']; - printf( '%s + printf( ' + %s %s %s %s diff --git a/Z_CheckDebtorsControl.php b/Z_CheckDebtorsControl.php index 514c6b8f3..da9632be7 100644 --- a/Z_CheckDebtorsControl.php +++ b/Z_CheckDebtorsControl.php @@ -79,7 +79,6 @@ $CurPeriod = $_POST['FromPeriod']; $GLOpening = $invTotal = $RecTotal = $GLClosing = $CalcTotal = $DiffTotal = 0; - $j=0; while ( $CurPeriod <= $_POST['ToPeriod'] ) { $SQL = "SELECT bfwd, @@ -94,14 +93,8 @@ $GLOpening += $dtRow['bfwd']; $glMovement = $dtRow['bfwd'] + $dtRow['actual']; - if ($j==1) { - echo ''; - $j=0; - } else { - echo ''; - $j++; - } - echo '' . $CurPeriod . ' + echo ' + ' . $CurPeriod . ' ' . locale_number_format($dtRow['bfwd'],2) . ''; $SQL = "SELECT SUM((ovamount+ovgst)/rate) AS totinvnetcrds diff --git a/Z_ItemsWithoutPicture.php b/Z_ItemsWithoutPicture.php index c6cbbda42..acb1af912 100644 --- a/Z_ItemsWithoutPicture.php +++ b/Z_ItemsWithoutPicture.php @@ -1,68 +1,62 @@ -' . _('Current Items without picture in webERP') . '

'; - echo '
'; - echo ''; - $k = 0; //row colour counter - $i = 1; - $SupportedImgExt = array('png','jpg','jpeg'); - while ($myrow = DB_fetch_array($result)) { - $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); - if(!file_exists($imagefile) ) { - if($PrintHeader){ - $TableHeader = ' - - - - - '; - echo $TableHeader; - $PrintHeader = FALSE; - } - if ($k == 1) { - echo ''; - $k = 0; - } else { - echo ''; - $k = 1; - } - $CodeLink = '' . $myrow['stockid'] . ''; - printf(' - - - - ', - $i, - $myrow['categorydescription'], - $CodeLink, - $myrow['description'] - ); - $i++; - } - } - echo '
' . '#' . '' . _('Category') . '' . _('Item Code') . '' . _('Description') . '
%s%s%s%s
-
- '; -} - -include ('includes/footer.php'); - +' . _('Current Items without picture in webERP') . '

'; + echo '
'; + echo ''; + $i = 1; + $SupportedImgExt = array('png','jpg','jpeg'); + while ($myrow = DB_fetch_array($result)) { + $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $myrow['stockid'] . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); + if(!file_exists($imagefile) ) { + if($PrintHeader){ + $TableHeader = ' + + + + + '; + echo $TableHeader; + $PrintHeader = FALSE; + } + + $CodeLink = '' . $myrow['stockid'] . ''; + printf(' + + + + + ', + $i, + $myrow['categorydescription'], + $CodeLink, + $myrow['description'] + ); + $i++; + } + } + echo '
' . '#' . '' . _('Category') . '' . _('Item Code') . '' . _('Description') . '
%s%s%s%s
+
+ '; +} + +include ('includes/footer.php'); + ?> \ No newline at end of file diff --git a/css/WEBootstrap/default.css b/css/WEBootstrap/default.css index b62de1be6..a964d7bad 100644 --- a/css/WEBootstrap/default.css +++ b/css/WEBootstrap/default.css @@ -178,10 +178,11 @@ textarea { -moz-border-radius: 4px; border-radius: 4px; } -.EvenTableRows { +tr.striped_row:nth-of-type(even) { background-color:white; } -.OddTableRows { + +tr.striped_row:nth-of-type(odd) { background-color:#CCCCCC; } @@ -213,8 +214,6 @@ div.page_help_text { } /*** Calendar picker ***/ -#calendar { -} .dpTbl { border:1px solid #C3C3C3; -moz-box-shadow: 0px 0px 8px #999999; diff --git a/css/aguapop/default.css b/css/aguapop/default.css index 27f453da4..6f64bb937 100644 --- a/css/aguapop/default.css +++ b/css/aguapop/default.css @@ -1,506 +1,502 @@ -/* $Id: default.css 7166 2015-02-21 21:18:59Z Joshua $*/ -/* - -New "AguaPop" Theme for WebERP - -v2, 2012-08-03 - -by Hindra Joshua - +/* $Id: default.css 7166 2015-02-21 21:18:59Z Joshua $*/ +/* + +New "AguaPop" Theme for WebERP + +v2, 2012-08-03 + +by Hindra Joshua + */ button img { /* Describes how button image should be displayed. */ height:32px; width:32px; -} - -body { - font-family:Arial, Verdana, Helvetica, sans-serif; - font-size:10pt; - background: silver; - margin:0; - padding:0; -} - -/* default styles */ - -a{ - color:blue; - text-decoration:none; -} -a:hover{ - color:red; - text-decoration:underline; -} -a:active{} - -img{ /* icon on page title, etc */ - border:none; - vertical-align:middle; -} - -p{ /* some text need to be centered */ -/*text-align:center;*/ -} -p.good { - font-weight: bold; - color: green; -} -p.bad { - font-weight: bold; - color:red; -} - -table { - width:auto; - max-width:90%; - margin:5px auto; - padding-bottom:5px; -} -table.selection { - width:auto; - max-width:90%; -/*padding-bottom:5px;*/ -} -th { - background-color:skyblue; - color:black; - font-weight:normal; - padding:3px; -} -th.ascending { - cursor: s-resize; -} -th.descending { - cursor: n-resize; -} -th:after { - content: ""; - float: right; - margin-top: 7px; - visibility: hidden; -} -th.ascending:after { - border-width: 0 4px 4px; - border-style: solid; - border-color: #000 transparent; - visibility: visible; -} -th.descending:after { - border-bottom: none; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid #000; - visibility: visible; -} -th.number { - color: white;/* Should be black ? */ - text-align: right; -} -th.text { - color: white;/* Should be black ? */ - text-align: left; -} -td { - font-family: Arial, Verdana, Helvetica, sans-serif; - text-align: left; -} -td.select { - background-color: whitesmoke; - padding:3px; -} - -div.centre { - padding:5px; - text-align:center; -} - -input { /*specifies the input field text characteristics*/ - font-family: Arial, Verdana, Helvetica, sans-serif; - font-style: italic; -} -input.image { - border-width: 0px; - background-color: transparent; -} -input:hover{ - background:#9ffffb; -} -select { - font-family: Arial, Verdana, Helvetica, sans-serif; -} -input.inputerror, input.error, select.error, select.selecterror, label.error { - color:red; - border: 2px solid red; -} -input:required, select:required, textarea:required { - background-color:lightyellow; -} -select:hover { /* drop down */ - background:#9ffffb; -} - -textarea{ - font-family: Arial, Verdana, Helvetica, sans-serif; -} -textarea:hover{ - background:#9ffffb; -} - -.EvenTableRows { - background-color: gainsboro; -} -.OddTableRows { - background-color: whitesmoke; -} - -div{ /* some input/buttons need to be centered */ -} -div.error { - background-color: mistyrose; - width: 98%; - margin: 5px auto; - color: red; - border: 1px solid red; -} -div.warn { - background-color: pink; - width: 98%; - margin: 5px auto; - color: maroon; - border: 1px solid maroon; -} -div.success { - background-color: aquamarine; - width: 98%; - margin: 5px auto; - color: green; - border: 1px solid green; -} -div.info { - background-color: lightskyblue; - width: 98%; - margin: 5px auto; - color:navy; - border: 1px solid navy; -} -DIV.page_help_text { - background: lightgrey url(images/help.png) top left no-repeat; - border: maroon 1px solid; - padding-top:2px; - padding-bottom: 2px; - z-index: 1; - width: 80%; - float: none; - visibility: visible; - margin: 0 auto; - position: static; - font-family: Arial, Verdana, Helvetica, sans-serif; - font-weight: normal; - color: black; - text-align:center; - padding-left: 24px; - min-height:26px; -} - -/* date picker */ -.dpTbl { - border: solid navy 1px; - background:white; -} -.dpTD { - border: 0; - width: 20px; - background-color: whitesmoke; - text-align: right; - cursor: pointer; -} -.dpDayHighlight { - border: 0; - width: 20px; - background-color: yellow; - text-align: right; - cursor: pointer; -} -.dpTDHover { - border: 0; - width: 20px; - background-color: gainsboro; - text-align: right; - cursor: pointer; -} - -/* Table type is used for UI tables type 1 */ -.table1 { - width:90%; - background: whitesmoke; - border: 1px solid darkslategray; - margin: 0 auto; -} -.tableheader { - font-weight: normal; - background-color: skyblue; - color: white; -} -.notavailable { - font-weight: lighter; - font-style: italic; - color: gray; -} -.label { - font-weight: bold; - font-style: normal; - color: black; - background-color: gainsboro; -} -.table_index { - background-color: aliceblue; -} -li { -/*list-style-image: url(bullet.gif);*/ -} - -/* CANVAS */ - -#CanvasDiv { - background:steelblue; - border-radius:20px; - box-shadow:3px 3px 4px #86C3D7 inset, -3px -3px 4px #383878 inset, 0 0 10px black; - margin:10px; -} - -/* HEADER */ - -#HeaderDiv { - overflow:hidden; - color:white; - padding:5px 10px 0; -} -#HeaderDiv a{ - border-radius:10px; - color:white; - text-decoration:none; - padding:3px; -} -#HeaderDiv a:hover{ - color:cyan; - border-radius:10px; - box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; - padding:3px; -} -#HeaderWrapDiv{ -} - -/* HEADER - APP INFO */ - -#AppInfoDiv{ - float:left; /* REQUIRED: to the left */ -} -#AppInfoCompanyDiv{ - display:table-cell; /* REQUIRED: as a cell */ -} -#AppInfoUserDiv{ - display:table-cell; /* REQUIRED: as a cell */ - padding-left:5px; -} -#AppInfoModuleDiv{ - font-weight:bold; - padding:3px; -} - -/* HEADER - QUICK MENU */ - -#QuickMenuDiv{ - float:right; - margin-top:7px; -} -#QuickMenuDiv ul{ - margin-top:10px; - list-style:none; - float:right; -} -#QuickMenuDiv ul li{ - float: left; - display:inline; - margin: 0px 3px; -} - -/* BODY */ - -#BodyDiv { - clear:both; - overflow:hidden; - text-align:center; /* needed to center some buttons on SelectSupplier.php */ -} -#BodyWrapDiv{ - background:lightsteelblue; - box-shadow:2px 2px 3px inset; - margin:0 5px; -} - -/* BODY - MAIN MENU */ - -#MainMenuDiv{ - float:left; - background:steelblue; - white-space:nowrap; - text-align:center; - padding-left:3px; - padding-top:3px; - width:11%; -} -#MainMenuDiv ul{ - margin:0; - padding:0; -} -#MainMenuDiv li{ - list-style:none; -} -#MainMenuDiv li a, -#MainMenuDiv li a:hover, -#MainMenuDiv .main_menu_selected a{ - display:block; /* REQUIRED */ - border-radius:10px; - color:white; - text-decoration:none; - padding:3px; - margin-bottom:5px; -} -#MainMenuDiv li a:hover{ - color:cyan; - box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; -} -#MainMenuDiv .main_menu_selected a{ /* the selected button */ - box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; -} - -/* BODY - SUB MENU */ - -#SubMenuDiv{ - display:table; /* display as table, sub menu will auto adjust width */ - float:right; - overflow: hidden; - margin-left:auto; - margin-right:auto; - width:88%; /* main menu is 10% */ - text-align:left; -} -#SubMenuDiv ul{ - margin:0; - padding:0; -} -#SubMenuDiv li{ - list-style:none; /* REQUIRED: hide bullets */ -} -#SubMenuDiv p{ -} - -#SubMenuDiv a{ - color:black; - text-decoration:none; -} -#SubMenuDiv a:hover{ - color:black; - text-decoration:underline; -} - -.menu_group_headers { - background:steelblue; - border:2px outset white; - color:white; - font-weight:bold; - text-align:center; - padding:3px; -} - -.menu_group_item { - padding:2px; - text-align:left; -} -.menu_group_item:hover{ - background:lightblue; - text-align:left; -} - -.menu_group_item p { /* bullet */ - color: red; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ - text-indent: -10px; /* this makes the bullet to appear as the li tag previously used */ - margin: 0 0 0 12px; - text-align:left; -} -.menu_group_item a{ - color:black; - text-decoration:none; -} -.menu_group_item a:hover{ - color:red; - text-decoration:none; -} - -#TransactionsDiv,#InquiriesDiv,#MaintenanceDiv{ - background:whitesmoke; - border:2px solid steelblue; - display:table-cell; -} -#InquiriesDiv div{ /* to center custom report/form header */ - background:lightsteelblue; - font-weight:bold; - color:black; - padding:2px; -} - -/*** FOOTER ***/ - -#FooterDiv{ - clear:both; - color:white; - height:53px; - padding:0; -} -#FooterWrapDiv{ - padding:5px; -} -#FooterLogoDiv{ - background:white; - border:2px outset steelblue; - border-radius:8px 8px 8px 8px; - float:left; - padding:3px; -} -#FooterVersionDiv{ - float:left; - margin-left:10px; - margin-top:15px; -} -#FooterTimeDiv{ - float:right; - margin-top:15px; -} -#Report { - /* Division id for reports. */} -#Report table { - /* Body of a report formatted with table tag. */ -} -.centre { - text-align:center; - /* Class selector to horizontal align a text (centre) in an element. */ -} -.number { - text-align:right; - /* Class selector to horizontal align a number (right) in an element. */ -} -.text { - text-align:left; - /* Class selector to horizontal align a text (left) in an element. */ -} -.page_title_text { - color:black; - font-weight:bold; - margin:0 auto; /* . */ - padding:5px; - text-align:center; - /* Class selector for page title. */ +} + +body { + font-family:Arial, Verdana, Helvetica, sans-serif; + font-size:10pt; + background: silver; + margin:0; + padding:0; +} + +/* default styles */ + +a{ + color:blue; + text-decoration:none; +} +a:hover{ + color:red; + text-decoration:underline; +} +a:active{} + +img{ /* icon on page title, etc */ + border:none; + vertical-align:middle; +} + +p.good { + font-weight: bold; + color: green; +} +p.bad { + font-weight: bold; + color:red; +} + +table { + width:auto; + max-width:90%; + margin:5px auto; + padding-bottom:5px; +} +table.selection { + width:auto; + max-width:90%; +/*padding-bottom:5px;*/ +} +th { + background-color:skyblue; + color:black; + font-weight:normal; + padding:3px; +} +th.ascending { + cursor: s-resize; +} +th.descending { + cursor: n-resize; +} +th:after { + content: ""; + float: right; + margin-top: 7px; + visibility: hidden; +} +th.ascending:after { + border-width: 0 4px 4px; + border-style: solid; + border-color: #000 transparent; + visibility: visible; +} +th.descending:after { + border-bottom: none; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #000; + visibility: visible; +} +th.number { + color: white;/* Should be black ? */ + text-align: right; +} +th.text { + color: white;/* Should be black ? */ + text-align: left; +} +td { + font-family: Arial, Verdana, Helvetica, sans-serif; + text-align: left; +} +td.select { + background-color: whitesmoke; + padding:3px; +} + +div.centre { + padding:5px; + text-align:center; +} + +input { /*specifies the input field text characteristics*/ + font-family: Arial, Verdana, Helvetica, sans-serif; + font-style: italic; +} +input.image { + border-width: 0px; + background-color: transparent; +} +input:hover{ + background:#9ffffb; +} +select { + font-family: Arial, Verdana, Helvetica, sans-serif; +} +input.inputerror, input.error, select.error, select.selecterror, label.error { + color:red; + border: 2px solid red; +} +input:required, select:required, textarea:required { + background-color:lightyellow; +} +select:hover { /* drop down */ + background:#9ffffb; +} + +textarea{ + font-family: Arial, Verdana, Helvetica, sans-serif; +} +textarea:hover{ + background:#9ffffb; +} + +tr.striped_row:nth-of-type(even) { + background-color:gainsboro; +} + +tr.striped_row:nth-of-type(odd) { + background-color:whitesmoke; +} + +div.error { + background-color: mistyrose; + width: 98%; + margin: 5px auto; + color: red; + border: 1px solid red; +} +div.warn { + background-color: pink; + width: 98%; + margin: 5px auto; + color: maroon; + border: 1px solid maroon; +} +div.success { + background-color: aquamarine; + width: 98%; + margin: 5px auto; + color: green; + border: 1px solid green; +} +div.info { + background-color: lightskyblue; + width: 98%; + margin: 5px auto; + color:navy; + border: 1px solid navy; +} +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + border: maroon 1px solid; + padding-top:2px; + padding-bottom: 2px; + z-index: 1; + width: 80%; + float: none; + visibility: visible; + margin: 0 auto; + position: static; + font-family: Arial, Verdana, Helvetica, sans-serif; + font-weight: normal; + color: black; + text-align:center; + padding-left: 24px; + min-height:26px; +} + +/* date picker */ +.dpTbl { + border: solid navy 1px; + background:white; +} +.dpTD { + border: 0; + width: 20px; + background-color: whitesmoke; + text-align: right; + cursor: pointer; +} +.dpDayHighlight { + border: 0; + width: 20px; + background-color: yellow; + text-align: right; + cursor: pointer; +} +.dpTDHover { + border: 0; + width: 20px; + background-color: gainsboro; + text-align: right; + cursor: pointer; +} + +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: whitesmoke; + border: 1px solid darkslategray; + margin: 0 auto; +} +.tableheader { + font-weight: normal; + background-color: skyblue; + color: white; +} +.notavailable { + font-weight: lighter; + font-style: italic; + color: gray; +} +.label { + font-weight: bold; + font-style: normal; + color: black; + background-color: gainsboro; +} +.table_index { + background-color: aliceblue; +} +li { +/*list-style-image: url(bullet.gif);*/ +} + +/* CANVAS */ + +#CanvasDiv { + background:steelblue; + border-radius:20px; + box-shadow:3px 3px 4px #86C3D7 inset, -3px -3px 4px #383878 inset, 0 0 10px black; + margin:10px; +} + +/* HEADER */ + +#HeaderDiv { + overflow:hidden; + color:white; + padding:5px 10px 0; +} +#HeaderDiv a{ + border-radius:10px; + color:white; + text-decoration:none; + padding:3px; +} +#HeaderDiv a:hover{ + color:cyan; + border-radius:10px; + box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; + padding:3px; +} +#HeaderWrapDiv{ +} + +/* HEADER - APP INFO */ + +#AppInfoDiv{ + float:left; /* REQUIRED: to the left */ +} +#AppInfoCompanyDiv{ + display:table-cell; /* REQUIRED: as a cell */ +} +#AppInfoUserDiv{ + display:table-cell; /* REQUIRED: as a cell */ + padding-left:5px; +} +#AppInfoModuleDiv{ + font-weight:bold; + padding:3px; +} + +/* HEADER - QUICK MENU */ + +#QuickMenuDiv{ + float:right; + margin-top:7px; +} +#QuickMenuDiv ul{ + margin-top:10px; + list-style:none; + float:right; +} +#QuickMenuDiv ul li{ + float: left; + display:inline; + margin: 0px 3px; +} + +/* BODY */ + +#BodyDiv { + clear:both; + overflow:hidden; + text-align:center; /* needed to center some buttons on SelectSupplier.php */ +} +#BodyWrapDiv{ + background:lightsteelblue; + box-shadow:2px 2px 3px inset; + margin:0 5px; +} + +/* BODY - MAIN MENU */ + +#MainMenuDiv{ + float:left; + background:steelblue; + white-space:nowrap; + text-align:center; + padding-left:3px; + padding-top:3px; + width:11%; +} +#MainMenuDiv ul{ + margin:0; + padding:0; +} +#MainMenuDiv li{ + list-style:none; +} +#MainMenuDiv li a, +#MainMenuDiv li a:hover, +#MainMenuDiv .main_menu_selected a{ + display:block; /* REQUIRED */ + border-radius:10px; + color:white; + text-decoration:none; + padding:3px; + margin-bottom:5px; +} +#MainMenuDiv li a:hover{ + color:cyan; + box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; +} +#MainMenuDiv .main_menu_selected a{ /* the selected button */ + box-shadow:2px 2px 3px #86C3D7, -2px -2px 3px #383878; +} + +/* BODY - SUB MENU */ + +#SubMenuDiv{ + display:table; /* display as table, sub menu will auto adjust width */ + float:right; + overflow: hidden; + margin-left:auto; + margin-right:auto; + width:88%; /* main menu is 10% */ + text-align:left; +} +#SubMenuDiv ul{ + margin:0; + padding:0; +} +#SubMenuDiv li{ + list-style:none; /* REQUIRED: hide bullets */ +} +#SubMenuDiv p{ +} + +#SubMenuDiv a{ + color:black; + text-decoration:none; +} +#SubMenuDiv a:hover{ + color:black; + text-decoration:underline; +} + +.menu_group_headers { + background:steelblue; + border:2px outset white; + color:white; + font-weight:bold; + text-align:center; + padding:3px; +} + +.menu_group_item { + padding:2px; + text-align:left; +} +.menu_group_item:hover{ + background:lightblue; + text-align:left; +} + +.menu_group_item p { /* bullet */ + color: red; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ + text-indent: -10px; /* this makes the bullet to appear as the li tag previously used */ + margin: 0 0 0 12px; + text-align:left; +} +.menu_group_item a{ + color:black; + text-decoration:none; +} +.menu_group_item a:hover{ + color:red; + text-decoration:none; +} + +#TransactionsDiv,#InquiriesDiv,#MaintenanceDiv{ + background:whitesmoke; + border:2px solid steelblue; + display:table-cell; +} +#InquiriesDiv div{ /* to center custom report/form header */ + background:lightsteelblue; + font-weight:bold; + color:black; + padding:2px; +} + +/*** FOOTER ***/ + +#FooterDiv{ + clear:both; + color:white; + height:53px; + padding:0; +} +#FooterWrapDiv{ + padding:5px; +} +#FooterLogoDiv{ + background:white; + border:2px outset steelblue; + border-radius:8px 8px 8px 8px; + float:left; + padding:3px; +} +#FooterVersionDiv{ + float:left; + margin-left:10px; + margin-top:15px; +} +#FooterTimeDiv{ + float:right; + margin-top:15px; +} +#Report { + /* Division id for reports. */} +#Report table { + /* Body of a report formatted with table tag. */ +} +.centre { + text-align:center; + /* Class selector to horizontal align a text (centre) in an element. */ +} +.number { + text-align:right; + /* Class selector to horizontal align a number (right) in an element. */ +} +.text { + text-align:left; + /* Class selector to horizontal align a text (left) in an element. */ +} +.page_title_text { + color:black; + font-weight:bold; + margin:0 auto; /* . */ + padding:5px; + text-align:center; + /* Class selector for page title. */ } /* END Style for all. ********************************************************/ diff --git a/css/aguapop/login.css b/css/aguapop/login.css index d2d04029a..8cfaf7f66 100644 --- a/css/aguapop/login.css +++ b/css/aguapop/login.css @@ -1,86 +1,86 @@ -/*** - -"Wood" Login theme for WebERP - -by Hindra Joshua - -***/ - - -/* $Id: login.css 4559 2011-05-01 09:45:18Z daintree $*/ -body { -background:lightgray; -color:white; -font:14px "Lucida Grande","Arial","Helvetica","Verdana","sans-serif"; -text-align:center; -} - -img{ -vertical-align:middle; -} - -#container { -background:steelblue; -border:thin solid gray; -border-radius:15px 15px 15px 15px; -box-shadow:3px 3px 4px #86C3D7 inset, -3px -3px 4px #383878 inset, 0 0 10px black; -margin-left:auto; -margin-right:auto; -margin-top:50px; -width:300px; -z-index:1000; -} - -#login_logo { -background:url("../webERP.gif") no-repeat scroll center center #FFFFFF; -border:medium outset gray; -border-radius:19px 19px 19px 19px; -height:44px; -margin:10% auto; -padding:12px; -width:190px; -} - -/*input{ - background:none repeat scroll 0 0 transparent; - border:thick outset #FFEEBB; - border-radius:15px 15px 15px 15px; - padding:10px; - vertical-align:middle; - width:50%; -} - -input:hover { - background:none repeat scroll 0 0 transparent; - border:thick inset #FFEEBB; - border-radius:15px 15px 15px 15px; - padding:10px; - vertical-align:middle; - width:50%; -}*/ - -input.button { -background:none repeat scroll 0 0 transparent; -border:thick outset steelblue; -border-radius:15px 15px 15px 15px; -padding:10px; -vertical-align:middle; -width:50%; -font-weight:bold; -box-shadow:3px 3px 4px black; -color:white; -} - -input.button:hover { -background:none repeat scroll 0 0 transparent; -border:thick inset steelblue; -border-radius:15px 15px 15px 15px; -padding:10px; -vertical-align:middle; -width:50%; -box-shadow:3px 3px 4px black inset; -} - -#demo_text{ - padding:10px; +/*** + +"Wood" Login theme for WebERP + +by Hindra Joshua + +***/ + + +/* $Id: login.css 4559 2011-05-01 09:45:18Z daintree $*/ +body { +background:lightgray; +color:white; +font:14px "Lucida Grande","Arial","Helvetica","Verdana","sans-serif"; +text-align:center; +} + +img{ +vertical-align:middle; +} + +#container { +background:steelblue; +border:thin solid gray; +border-radius:15px 15px 15px 15px; +box-shadow:3px 3px 4px #86C3D7 inset, -3px -3px 4px #383878 inset, 0 0 10px black; +margin-left:auto; +margin-right:auto; +margin-top:50px; +width:300px; +z-index:1000; +} + +#login_logo { +background:url("../webERP.gif") no-repeat scroll center center #FFFFFF; +border:medium outset gray; +border-radius:19px 19px 19px 19px; +height:44px; +margin:10% auto; +padding:12px; +width:190px; +} + +/*input{ + background:none repeat scroll 0 0 transparent; + border:thick outset #FFEEBB; + border-radius:15px 15px 15px 15px; + padding:10px; + vertical-align:middle; + width:50%; +} + +input:hover { + background:none repeat scroll 0 0 transparent; + border:thick inset #FFEEBB; + border-radius:15px 15px 15px 15px; + padding:10px; + vertical-align:middle; + width:50%; +}*/ + +input.button { +background:none repeat scroll 0 0 transparent; +border:thick outset steelblue; +border-radius:15px 15px 15px 15px; +padding:10px; +vertical-align:middle; +width:50%; +font-weight:bold; +box-shadow:3px 3px 4px black; +color:white; +} + +input.button:hover { +background:none repeat scroll 0 0 transparent; +border:thick inset steelblue; +border-radius:15px 15px 15px 15px; +padding:10px; +vertical-align:middle; +width:50%; +box-shadow:3px 3px 4px black inset; +} + +#demo_text{ + padding:10px; } \ No newline at end of file diff --git a/css/default/default.css b/css/default/default.css index 0e7424e6e..39ea7d53e 100644 --- a/css/default/default.css +++ b/css/default/default.css @@ -144,11 +144,11 @@ textarea { textarea:hover { } -.EvenTableRows { +tr.striped_row:nth-of-type(even) { background-color:#CCCCCC; } -.OddTableRows { +tr.striped_row:nth-of-type(odd) { background-color:#EEEEEE; } @@ -194,24 +194,6 @@ div.page_help_text { text-align:center; } -div.system_check { - border:#a52a2a 1px solid; - padding-left:3px; - z-index:1; - width:40%; - float:none; - visibility:visible; - margin:0 auto; - position:static; - background:lightgray; - font-family:Arial, Verdana, Helvetica, sans-serif; - padding-top:1px; - padding-bottom:1px; - font-weight:normal; - color:black; - text-align:left; -} - .dpTbl { /* date picker background */ border:thin solid black; background:white; diff --git a/css/fluid/default.css b/css/fluid/default.css index 55c45b899..ec67e72b2 100644 --- a/css/fluid/default.css +++ b/css/fluid/default.css @@ -119,10 +119,11 @@ textarea.texterror{ background-color:#fddbdb; } -.EvenTableRows{ +tr.striped_row:nth-of-type(even) { background-color:#CCCCCC; } -.OddTableRows{ + +tr.striped_row:nth-of-type(odd) { background-color:#EEEEEE; } diff --git a/css/fresh/default.css b/css/fresh/default.css index 715f98507..87590c19a 100644 --- a/css/fresh/default.css +++ b/css/fresh/default.css @@ -124,11 +124,13 @@ textarea{ } textarea:hover{ } -.EvenTableRows { - background-color: #72824D; + +tr.striped_row:nth-of-type(even) { + background-color:#72824D; } -.OddTableRows { - background-color: #CAF17C; + +tr.striped_row:nth-of-type(odd) { + background-color:#CAF17C; } div.error { @@ -169,9 +171,6 @@ div.page_help_text { } /*** calendar picker ***/ -#calendar{ - -} .dpTbl { border: solid navy 1px; } diff --git a/css/gel/default.css b/css/gel/default.css index 606e15343..d1f180c88 100755 --- a/css/gel/default.css +++ b/css/gel/default.css @@ -136,12 +136,14 @@ textarea{ } textarea:hover{ } -.EvenTableRows { - background-color: #CCCCCC; +tr.striped_row:nth-of-type(even) { + background-color:#CCCCCC; } -.OddTableRows { - background-color: #EEEEEE; + +tr.striped_row:nth-of-type(odd) { + background-color:#EEEEEE; } + textarea{ background: url(images/inputtxt.png) #eee; color:#000; @@ -190,22 +192,6 @@ DIV.page_help_text { color: black; text-align:center; } -DIV.system_check { /*** is this used??? */ - border: #a52a2a 1px solid; - padding-left: 3px; - z-index: 1; - width: 40%; - float: none; - visibility: visible; - margin: 0 auto; - position: static; - background: lightgray; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - color: black; - text-align:left; -} .dpTbl { border: solid navy 1px; diff --git a/css/professional-rtl/default.css b/css/professional-rtl/default.css index 9f1b6d3cc..d919a3762 100644 --- a/css/professional-rtl/default.css +++ b/css/professional-rtl/default.css @@ -83,11 +83,12 @@ td.select { text-align:right; cursor:pointer; } -.EvenTableRows { - background-color: #CCCCCC; +tr.striped_row:nth-of-type(even) { + background-color:#CCCCCC; } -.OddTableRows { - background-color: #EEEEEE; + +tr.striped_row:nth-of-type(odd) { + background-color:#EEEEEE; } th { /* table heading */ diff --git a/css/professional/default.css b/css/professional/default.css index 5f8df6338..8e6448980 100644 --- a/css/professional/default.css +++ b/css/professional/default.css @@ -80,11 +80,12 @@ td.select { cursor:pointer; } -.EvenTableRows { - background-color: #CCCCCC; +tr.striped_row:nth-of-type(even) { + background-color:#CCCCCC; } -.OddTableRows { - background-color: #EEEEEE; + +tr.striped_row:nth-of-type(odd) { + background-color:#EEEEEE; } th { /* table heading */ diff --git a/css/silverwolf/default.css b/css/silverwolf/default.css index f16de1a62..f47fe4eb4 100755 --- a/css/silverwolf/default.css +++ b/css/silverwolf/default.css @@ -158,11 +158,12 @@ select{ font-family:Arial, Verdana, Helvetica, sans-serif; font-size:100%; } -.EvenTableRows{ - background-color:#ccc; +tr.striped_row:nth-of-type(even) { + background-color:#CCCCCC; } -.OddTableRows{ - background-color:#eee; + +tr.striped_row:nth-of-type(odd) { + background-color:#EEEEEE; } div.error{ diff --git a/css/wood/default.css b/css/wood/default.css index 436a54c56..425575cff 100644 --- a/css/wood/default.css +++ b/css/wood/default.css @@ -1,587 +1,569 @@ -/* $Id: default.css 7166 2015-02-21 21:18:59Z Joshua $*/ -/* - -"Wood" Theme for WebERP - -v3, 2012-08-03 - -by Hindra Joshua - -Changes: -- Wood textures scaled down -- Add shadow effects -- Light color -- Some fixes -- Text links fix - -Notes: -- You can remove desk.jpg and/or wood.jpg to get a new look without the textures! - +/* $Id: default.css 7166 2015-02-21 21:18:59Z Joshua $*/ +/* + +"Wood" Theme for WebERP + +v3, 2012-08-03 + +by Hindra Joshua + +Changes: +- Wood textures scaled down +- Add shadow effects +- Light color +- Some fixes +- Text links fix + +Notes: +- You can remove desk.jpg and/or wood.jpg to get a new look without the textures! + */ button img { /* Describes how button image should be displayed. */ height:24px; width:24px; -} - -body{ - font-family:Arial, Verdana, Helvetica, sans-serif; - font-size:10pt; - margin:10px; - background:url(images/desk.jpg) #631; -} - -/* default styles */ - -a{ - color:blue; - text-decoration:none; -} -a:hover{ - color:red; - text-decoration:underline; -} - -img{ /* icon on page title, etc */ - border:none; - vertical-align:middle; -} - -p{ -} -p.good { - font-weight: bold; - color: green; -} -p.bad { - font-weight: bold; - color:red; -} - -table{ /* most data display/input used tables */ - background:none repeat scroll 0 0 white; - box-shadow:3px 3px 4px #663311; - text-align:center; - width:auto; - max-width:90%; - margin:5px auto; - padding:3px; -} -table .selection{ /* nested table for more complex data display/input */ - background:#feb; - box-shadow:none; -} -th { /* table headers */ - background-color: #ffd980; - color: black; - font-size:100%; - font-weight: normal; - text-align: center; -} -th.ascending { - cursor: s-resize; -} -th.descending { - cursor: n-resize; -} -th:after { - content: ""; - float: right; - margin-top: 7px; - visibility: hidden; -} -th.ascending:after { - border-width: 0 4px 4px; - border-style: solid; - border-color: #000 transparent; - visibility: visible; -} -th.descending:after { - border-bottom: none; - border-left: 4px solid transparent; - border-right: 4px solid transparent; - border-top: 4px solid #000; - visibility: visible; -} -td { - text-align: left; -} -td.select { - background-color:#ffb; -} - -.centre{ /* used by buttons */ - text-align:center; - margin:5px; -} - -input { /* used for text box and buttons (buttons should have their own styles) */ - font-family: Arial, Verdana, Helvetica, sans-serif; - font-size:100%; -} -input.image { - border-width:0px; - background-color: transparent; -} -input:hover{ - background:#fff791; -} - -select { /* drop down */ - font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 100%; -} -select:hover { /* drop down */ - background:#fff791; -} -input.inputerror, input.error, select.error, select.selecterror, label.error { - color:red; - border: 2px solid red; -} -input:required, select:required, textarea:required { - background-color:lightyellow; -} -textarea{ - font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 100%; -} -textarea:hover{ - background:#fff791; -} - -.EvenTableRows { - background-color: #f5e6c9; -} -.OddTableRows { - background-color: #f2fac0; -} - -div{ /* some input/buttons need to be centered */ -} -div.error { - background-color:#FDDBDB; - border: 1px solid red; - box-shadow:3px 3px 4px; - color: red; - margin:0 auto 10px; - padding:10px; - width:80%; -} -div.warn { - background-color:#F5DBFD; - border: 1px solid maroon; - box-shadow:3px 3px 4px; - color: maroon; - margin:0 auto 10px; - padding:10px; - width:80%; -} -div.success { - background-color:#B9ECB4; - border: 1px solid darkgreen; - box-shadow:3px 3px 4px; - color: darkgreen; - margin:0 auto 10px; - padding:10px; - width:80%; -} -div.info { - background-color:#C7CCF6; - border:0 solid navy; - box-shadow:3px 3px 4px; - color:navy; - margin:0 auto 10px; - padding:10px; - width:80%; -} -div.page_help_text { - background: lightgrey url(images/help.png) top left no-repeat; - border: #A52A2A 1px solid; - box-shadow:3px 3px 4px; - color: black; - float: none; - font-family: Arial, Verdana, Helvetica, sans-serif; - font-size: 100%; - font-weight: normal; - margin:0 auto 10px; - padding:10px; - padding-bottom: 2px; - padding-left: 10px; - padding-top:2px; - position: static; - text-align:center; - visibility: visible; - width:80%; - z-index: 1; -} -div.system_check { /* probably not used anywhere */ - background: lightgray; - border: #A52A2A 1px solid; - box-shadow:3px 3px 4px; - color: black; - float: none; - font-family: arial, verdana, helvetica, sans-serif; - font-size:100%; - font-weight: normal; - margin:0 auto 10px; - padding:10px; - position: static; - text-align:left; - visibility: visible; - width:80%; - z-index: 1; -} - -/* date picker */ - -.dpTbl { /* date picker background */ - border:thin solid black; - background:white; - box-shadow: 3px 3px 4px #000; /* shadow on modern browsers */ -} -.dpTD { - border: 0; - width:20px; - background-color: #EEEEEE; - text-align:right; - cursor:pointer; -} -.dpDayHighlight { - border: 0; - width:20px; - background-color: yellow; - text-align:right; - cursor:pointer; -} -.dpTDHover { - border: 0; - width:20px; - background-color: #CCCCCC; - text-align:right; - cursor:pointer; -} - -/* MISC */ - -/* Table type is used for UI tables type 1 */ -.table1 { - width:90%; - background: #eee; - border: 0px 0px 2px 2px solid #222; - margin: 0 auto; -} -.tableheader { - font-weight: normal; - background-color: #777C59; - color: white; -} -.notavailable { - font-weight:lighter; - font-style:italic; - color:#555555; -} -.label { - font-weight:bold; - font-style:normal; - font-size:120%; - color:black; - background-color:#cccccc; -} -.table_index { - background-color: #F1FFDD; -} -/*li { -list-style-image: url(bullet.gif); -}*/ - -.header{ - background-image:url(""); - background-repeat:no-repeat; - background-attachment:fixed; - border:none; - margin:0px; - padding:0px; -} -input.inputerror{ - background-color:#fddbdb; -} -textarea.texterror{ - background-color:#fddbdb; -} -select.selecterror{ - background-color:#fddbdb; -} -.OsRow{ - background-color:#234567; - color:white; -} - -/* CANVAS */ - -#CanvasDiv{ - background:url(images/wood.jpg) #feb; - border:3px outset #feb; - border-radius:15px 15px 15px 15px; - padding:3px; - box-shadow: 5px 5px 6px #000; /* modern browser only! */ -} - -/* HEADER */ - -#HeaderDiv{ - color:black; - overflow:hidden; -} -#HeaderDiv a{ - color: black; - font-weight: normal; - text-decoration: none; - border:2px outset #feb; - border-radius:10px; - padding:3px 5px; - box-shadow:2px 2px 3px black; - margin-right:2px; - background:none; -} -#HeaderDiv a:hover{ - color: black; - font-weight: normal; - text-decoration: none; - border:2px outset #feb; - border-radius:10px; - padding:3px 5px; - color:red; - box-shadow:2px 2px 3px black; -} -#HeaderDiv a:active{ - color: red; - text-decoration: none; - border:2px inset #feb; - border-radius:10px; - padding:3px 5px; - box-shadow:2px 2px 3px black inset; -} - -#HeaderWrapDiv{ -} - -/* HEADER - APP INFO */ - -#AppInfoDiv{ - float:left; /* REQUIRED: to the left */ -} -#AppInfoCompanyDiv{ - display:table-cell; /* REQUIRED: as a cell */ -} -#AppInfoUserDiv{ - display:table-cell; /* REQUIRED: as a cell */ - padding-left:5px; -} -#AppInfoModuleDiv{ - font-weight:bold; - font-size:120%; - padding:3px; -} - -/* HEADER - QUICK MENU */ - -#QuickMenuDiv{ - float:right; /* to the right side */ - margin-top:3px; -} -#QuickMenuDiv ul{ - list-style:none; /* hide the bullets */ -} -#QuickMenuDiv li{ - display:inline; /* items are inline */ -} - -/* BODY */ - -#BodyDiv { - clear:both; - overflow:hidden; - text-align:center; /* need to center some text/button on SelectSupplier.php */ -} -#BodyWrapDiv{ - color:black; -} - -/* BODY - MAIN MENU */ - -#MainMenuDiv{ - float:left; - white-space:nowrap; - text-align:center; - width:11%; -} -#MainMenuDiv ul{ - margin:0 3px 0 0; - padding:0; -} -#MainMenuDiv li{ - list-style:none; /* REQUIRED */ - padding:0; /* REQUIRED */ -} - -/* links as buttons */ - -#MainMenuDiv li a, -#MainMenuDiv li a:hover, -#MainMenuDiv li a:active, -#MainMenuDiv .main_menu_selected a, -#MainMenuDiv .main_menu_selected a:hover{ /* common styles */ -display:block; /* REQUIRED */ -color:black; -text-decoration:none; -background:none; -border:2px outset #feb; -border-radius:10px; -box-shadow:2px 2px 3px black; -padding:3px; -margin-top:2px; -margin-bottom:2px; -} -#MainMenuDiv li a:hover{ -color:red; -} -#MainMenuDiv li a:active, -#MainMenuDiv .main_menu_selected a:hover{ /* pressed */ - color:red; - border:2px inset #feb; - box-shadow:2px 2px 3px black inset; -} -#MainMenuDiv .main_menu_selected a{ /* the selected button */ - border:2px inset #feb; - box-shadow:2px 2px 3px black inset; -} - -/* BODY - SUB MENU */ - -#SubMenuDiv{ - display:table; /* display as table, sub menu will auto adjust width */ - text-align:left; - background:url(images/desk.jpg) #631; - border:3px inset #feb; - border-radius:15px; - box-shadow: 5px 5px 6px #000 inset; /* modern browser only! */ - margin:0 auto; - padding:5px; - width:87%; -} -#SubMenuDiv ul{ - background:url(images/wood.jpg) #feb; - border:3px outset #feb; - border-radius:10px; - box-shadow: 5px 5px 6px #000; /* shadow: modern browser only! */ - padding:0; /* REQUIRED: remove extra gaps (ex-bullets) */ - margin:5px; -} -#SubMenuDiv li{ - list-style:none; /* REQUIRED: hide bullets */ -} - -.menu_group_headers { - background:url(images/desk.jpg) #631; - border:3px outset #631; - border-radius:10px 10px 0 0; - color:white; - font-weight:bold; - text-align:center; - padding:2px; - margin:-3px -3px 0; -} - -.menu_group_item,.menu_group_item:hover{ - color:black; - border:1px inset transparent; - border-radius:7px; - padding:2px; -} -.menu_group_item:hover{ - border:1px inset #feb; - box-shadow:1px 1px 2px black inset; -} -.menu_group_item a{ - color:black; - text-decoration:none; - text-align:left; -} -.menu_group_item a:hover{ - color:red; - text-decoration:none; -} - -.menu_group_item p { - color: red; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ - text-indent: -10px; /* this makes the bullet to appear as the li tag previously used */ - margin: 0 0 0 12px; -} - -#TransactionsDiv,#InquiriesDiv,#MaintenanceDiv{ -display:table-cell; -} -#InquiriesDiv div{ /* header for standard reports/forms, custom reports */ - background:url("images/desk.jpg") #631; - border:3px outset #663311; - color:white; - font-weight:bold; - margin:0 -3px; - padding:2px; -} - -/* FOOTER */ - -#FooterDiv{ - clear:both; - color:black; - overflow:hidden; -} -#FooterWrapDiv{ -} -#FooterLogoDiv{ - background:white; - border:2px outset #feb; - border-radius:8px 8px 8px 8px; - float:left; - padding:3px; - margin-left:0px; - margin-top:3px; -} -#FooterVersionDiv{ - float:left; - margin-left:10px; - margin-top:17px; -} -#FooterTimeDiv{ - float:right; - margin-top:17px; -} -#Report { - /* Division id for reports. */} -#Report table { - /* Body of a report formatted with table tag. */ -} -.centre { - text-align:center; - /* Class selector to horizontal align a text (centre) in an element. */ -} -.number { - text-align:right; - /* Class selector to horizontal align a number (right) in an element. */ -} -.text { - text-align:left; - /* Class selector to horizontal align a text (left) in an element. */ -} -.page_title_text { - color:black; - font-weight:bold; - margin:5px auto; - padding:5px; - text-align:center; - /* Class selector for page title. */ +} + +body{ + font-family:Arial, Verdana, Helvetica, sans-serif; + font-size:10pt; + margin:10px; + background:url(images/desk.jpg) #631; +} + +/* default styles */ + +a{ + color:blue; + text-decoration:none; +} +a:hover{ + color:red; + text-decoration:underline; +} + +img{ /* icon on page title, etc */ + border:none; + vertical-align:middle; +} + +p{ +} +p.good { + font-weight: bold; + color: green; +} +p.bad { + font-weight: bold; + color:red; +} + +table{ /* most data display/input used tables */ + background:none repeat scroll 0 0 white; + box-shadow:3px 3px 4px #663311; + text-align:center; + width:auto; + max-width:90%; + margin:5px auto; + padding:3px; +} +table .selection{ /* nested table for more complex data display/input */ + background:#feb; + box-shadow:none; +} +th { /* table headers */ + background-color: #ffd980; + color: black; + font-size:100%; + font-weight: normal; + text-align: center; +} +th.ascending { + cursor: s-resize; +} +th.descending { + cursor: n-resize; +} +th:after { + content: ""; + float: right; + margin-top: 7px; + visibility: hidden; +} +th.ascending:after { + border-width: 0 4px 4px; + border-style: solid; + border-color: #000 transparent; + visibility: visible; +} +th.descending:after { + border-bottom: none; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid #000; + visibility: visible; +} +td { + text-align: left; +} +td.select { + background-color:#ffb; +} + +.centre{ /* used by buttons */ + text-align:center; + margin:5px; +} + +input { /* used for text box and buttons (buttons should have their own styles) */ + font-family: Arial, Verdana, Helvetica, sans-serif; + font-size:100%; +} +input.image { + border-width:0px; + background-color: transparent; +} +input:hover{ + background:#fff791; +} + +select { /* drop down */ + font-family: Arial, Verdana, Helvetica, sans-serif; + font-size: 100%; +} +select:hover { /* drop down */ + background:#fff791; +} +input.inputerror, input.error, select.error, select.selecterror, label.error { + color:red; + border: 2px solid red; +} +input:required, select:required, textarea:required { + background-color:lightyellow; +} +textarea{ + font-family: Arial, Verdana, Helvetica, sans-serif; + font-size: 100%; +} +textarea:hover{ + background:#fff791; +} + +tr.striped_row:nth-of-type(even) { + background-color:#f5e6c9; +} + +tr.striped_row:nth-of-type(odd) { + background-color:#f2fac0; +} + +div.error { + background-color:#FDDBDB; + border: 1px solid red; + box-shadow:3px 3px 4px; + color: red; + margin:0 auto 10px; + padding:10px; + width:80%; +} +div.warn { + background-color:#F5DBFD; + border: 1px solid maroon; + box-shadow:3px 3px 4px; + color: maroon; + margin:0 auto 10px; + padding:10px; + width:80%; +} +div.success { + background-color:#B9ECB4; + border: 1px solid darkgreen; + box-shadow:3px 3px 4px; + color: darkgreen; + margin:0 auto 10px; + padding:10px; + width:80%; +} +div.info { + background-color:#C7CCF6; + border:0 solid navy; + box-shadow:3px 3px 4px; + color:navy; + margin:0 auto 10px; + padding:10px; + width:80%; +} +div.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + border: #A52A2A 1px solid; + box-shadow:3px 3px 4px; + color: black; + float: none; + font-family: Arial, Verdana, Helvetica, sans-serif; + font-size: 100%; + font-weight: normal; + margin:0 auto 10px; + padding:10px; + padding-bottom: 2px; + padding-left: 10px; + padding-top:2px; + position: static; + text-align:center; + visibility: visible; + width:80%; + z-index: 1; +} + +/* date picker */ + +.dpTbl { /* date picker background */ + border:thin solid black; + background:white; + box-shadow: 3px 3px 4px #000; /* shadow on modern browsers */ +} +.dpTD { + border: 0; + width:20px; + background-color: #EEEEEE; + text-align:right; + cursor:pointer; +} +.dpDayHighlight { + border: 0; + width:20px; + background-color: yellow; + text-align:right; + cursor:pointer; +} +.dpTDHover { + border: 0; + width:20px; + background-color: #CCCCCC; + text-align:right; + cursor:pointer; +} + +/* MISC */ + +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px solid #222; + margin: 0 auto; +} +.tableheader { + font-weight: normal; + background-color: #777C59; + color: white; +} +.notavailable { + font-weight:lighter; + font-style:italic; + color:#555555; +} +.label { + font-weight:bold; + font-style:normal; + font-size:120%; + color:black; + background-color:#cccccc; +} +.table_index { + background-color: #F1FFDD; +} +/*li { +list-style-image: url(bullet.gif); +}*/ + +.header{ + background-image:url(""); + background-repeat:no-repeat; + background-attachment:fixed; + border:none; + margin:0px; + padding:0px; +} +input.inputerror{ + background-color:#fddbdb; +} +textarea.texterror{ + background-color:#fddbdb; +} +select.selecterror{ + background-color:#fddbdb; +} +.OsRow{ + background-color:#234567; + color:white; +} + +/* CANVAS */ + +#CanvasDiv{ + background:url(images/wood.jpg) #feb; + border:3px outset #feb; + border-radius:15px 15px 15px 15px; + padding:3px; + box-shadow: 5px 5px 6px #000; /* modern browser only! */ +} + +/* HEADER */ + +#HeaderDiv{ + color:black; + overflow:hidden; +} +#HeaderDiv a{ + color: black; + font-weight: normal; + text-decoration: none; + border:2px outset #feb; + border-radius:10px; + padding:3px 5px; + box-shadow:2px 2px 3px black; + margin-right:2px; + background:none; +} +#HeaderDiv a:hover{ + color: black; + font-weight: normal; + text-decoration: none; + border:2px outset #feb; + border-radius:10px; + padding:3px 5px; + color:red; + box-shadow:2px 2px 3px black; +} +#HeaderDiv a:active{ + color: red; + text-decoration: none; + border:2px inset #feb; + border-radius:10px; + padding:3px 5px; + box-shadow:2px 2px 3px black inset; +} + +#HeaderWrapDiv{ +} + +/* HEADER - APP INFO */ + +#AppInfoDiv{ + float:left; /* REQUIRED: to the left */ +} +#AppInfoCompanyDiv{ + display:table-cell; /* REQUIRED: as a cell */ +} +#AppInfoUserDiv{ + display:table-cell; /* REQUIRED: as a cell */ + padding-left:5px; +} +#AppInfoModuleDiv{ + font-weight:bold; + font-size:120%; + padding:3px; +} + +/* HEADER - QUICK MENU */ + +#QuickMenuDiv{ + float:right; /* to the right side */ + margin-top:3px; +} +#QuickMenuDiv ul{ + list-style:none; /* hide the bullets */ +} +#QuickMenuDiv li{ + display:inline; /* items are inline */ +} + +/* BODY */ + +#BodyDiv { + clear:both; + overflow:hidden; + text-align:center; /* need to center some text/button on SelectSupplier.php */ +} +#BodyWrapDiv{ + color:black; +} + +/* BODY - MAIN MENU */ + +#MainMenuDiv{ + float:left; + white-space:nowrap; + text-align:center; + width:11%; +} +#MainMenuDiv ul{ + margin:0 3px 0 0; + padding:0; +} +#MainMenuDiv li{ + list-style:none; /* REQUIRED */ + padding:0; /* REQUIRED */ +} + +/* links as buttons */ + +#MainMenuDiv li a, +#MainMenuDiv li a:hover, +#MainMenuDiv li a:active, +#MainMenuDiv .main_menu_selected a, +#MainMenuDiv .main_menu_selected a:hover{ /* common styles */ +display:block; /* REQUIRED */ +color:black; +text-decoration:none; +background:none; +border:2px outset #feb; +border-radius:10px; +box-shadow:2px 2px 3px black; +padding:3px; +margin-top:2px; +margin-bottom:2px; +} +#MainMenuDiv li a:hover{ +color:red; +} +#MainMenuDiv li a:active, +#MainMenuDiv .main_menu_selected a:hover{ /* pressed */ + color:red; + border:2px inset #feb; + box-shadow:2px 2px 3px black inset; +} +#MainMenuDiv .main_menu_selected a{ /* the selected button */ + border:2px inset #feb; + box-shadow:2px 2px 3px black inset; +} + +/* BODY - SUB MENU */ + +#SubMenuDiv{ + display:table; /* display as table, sub menu will auto adjust width */ + text-align:left; + background:url(images/desk.jpg) #631; + border:3px inset #feb; + border-radius:15px; + box-shadow: 5px 5px 6px #000 inset; /* modern browser only! */ + margin:0 auto; + padding:5px; + width:87%; +} +#SubMenuDiv ul{ + background:url(images/wood.jpg) #feb; + border:3px outset #feb; + border-radius:10px; + box-shadow: 5px 5px 6px #000; /* shadow: modern browser only! */ + padding:0; /* REQUIRED: remove extra gaps (ex-bullets) */ + margin:5px; +} +#SubMenuDiv li{ + list-style:none; /* REQUIRED: hide bullets */ +} + +.menu_group_headers { + background:url(images/desk.jpg) #631; + border:3px outset #631; + border-radius:10px 10px 0 0; + color:white; + font-weight:bold; + text-align:center; + padding:2px; + margin:-3px -3px 0; +} + +.menu_group_item,.menu_group_item:hover{ + color:black; + border:1px inset transparent; + border-radius:7px; + padding:2px; +} +.menu_group_item:hover{ + border:1px inset #feb; + box-shadow:1px 1px 2px black inset; +} +.menu_group_item a{ + color:black; + text-decoration:none; + text-align:left; +} +.menu_group_item a:hover{ + color:red; + text-decoration:none; +} + +.menu_group_item p { + color: red; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ + text-indent: -10px; /* this makes the bullet to appear as the li tag previously used */ + margin: 0 0 0 12px; +} + +#TransactionsDiv,#InquiriesDiv,#MaintenanceDiv{ +display:table-cell; +} +#InquiriesDiv div{ /* header for standard reports/forms, custom reports */ + background:url("images/desk.jpg") #631; + border:3px outset #663311; + color:white; + font-weight:bold; + margin:0 -3px; + padding:2px; +} + +/* FOOTER */ + +#FooterDiv{ + clear:both; + color:black; + overflow:hidden; +} +#FooterWrapDiv{ +} +#FooterLogoDiv{ + background:white; + border:2px outset #feb; + border-radius:8px 8px 8px 8px; + float:left; + padding:3px; + margin-left:0px; + margin-top:3px; +} +#FooterVersionDiv{ + float:left; + margin-left:10px; + margin-top:17px; +} +#FooterTimeDiv{ + float:right; + margin-top:17px; +} +#Report { + /* Division id for reports. */} +#Report table { + /* Body of a report formatted with table tag. */ +} +.centre { + text-align:center; + /* Class selector to horizontal align a text (centre) in an element. */ +} +.number { + text-align:right; + /* Class selector to horizontal align a number (right) in an element. */ +} +.text { + text-align:left; + /* Class selector to horizontal align a text (left) in an element. */ +} +.page_title_text { + color:black; + font-weight:bold; + margin:5px auto; + padding:5px; + text-align:center; + /* Class selector for page title. */ } /* END Style for all. ********************************************************/ diff --git a/css/xenos/default.css b/css/xenos/default.css index b9745ecfb..63823eec4 100755 --- a/css/xenos/default.css +++ b/css/xenos/default.css @@ -203,10 +203,11 @@ textarea{ -moz-border-radius: 4px; border-radius: 4px; } -.EvenTableRows { +tr.striped_row:nth-of-type(even) { background-color:white; } -.OddTableRows { + +tr.striped_row:nth-of-type(odd) { background-color:#CCCCCC; } @@ -238,9 +239,6 @@ div.page_help_text { } /*** Calendar picker ***/ -#calendar{ - -} .dpTbl { border:1px solid #C3C3C3; -moz-box-shadow: 0px 0px 8px #999999; diff --git a/doc/Change.log b/doc/Change.log index 04aeb8ee9..8e9d7294d 100644 --- a/doc/Change.log +++ b/doc/Change.log @@ -1,5 +1,6 @@ webERP Change Log +9/2/18 PaulT: Replace old method of table row alternating color handing with improved CSS. Also, this change removes some empty/unused properties from a few css file and removes old URL 'SID' references in files already modified for this commit. Due to SVN issues with TestPlanResults.php, this one file will be committed later. 9/2/18 Tim (PaulT commit): ConnectDB_xxxx.inc files: Add function DB_table_exists() function to all DB support files, by Tim suggestion. Note that this function will be used in other files in a future commit. 7/2/18 Paul Becker (PaulT commit): Z_SalesIntegrityCheck.php: Fix that the does not take into account discountpercent so it shows an issue where non exists. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8084) 7/2/18 Tim (PaulT commit) UserSettings.php: Fix the 'Maximum Number of Records to Display' from populating with the session default at page load instead of the user's setting. Applied Tim's improved handling. (Reported in forums by Paul Becker: http://www.weberp.org/forum/showthread.php?tid=8081) diff --git a/includes/InputSerialItemsFile.php b/includes/InputSerialItemsFile.php index 4da62b7fb..11dfab611 100644 --- a/includes/InputSerialItemsFile.php +++ b/includes/InputSerialItemsFile.php @@ -26,22 +26,16 @@ $TotalQuantity = 0; /*Variable to accumulate total quantity received */ $RowCounter =0; -$k=0; + /*Display the batches already entered with quantities if not serialised */ foreach ($LineItem->SerialItems as $Bundle){ $RowCounter++; //only show 1st 10 lines if ($RowCounter < 10){ - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - echo '' . $Bundle->BundleRef . ''; + echo ' + ' . $Bundle->BundleRef . ''; if ($LineItem->Serialised==0){ echo '' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . ''; diff --git a/includes/InputSerialItemsKeyed.php b/includes/InputSerialItemsKeyed.php index 6046998bf..518187f2d 100644 --- a/includes/InputSerialItemsKeyed.php +++ b/includes/InputSerialItemsKeyed.php @@ -29,7 +29,6 @@ $TotalQuantity = 0; /*Variable to accumulate total quantity received */ $RowCounter =0; -$k=0; foreach ($LineItem->SerialItems as $Bundle){ if ($RowCounter == 10){ @@ -39,15 +38,8 @@ $RowCounter++; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $Bundle->BundleRef . ''; + echo ' + ' . $Bundle->BundleRef . ''; if ($LineItem->Serialised==0){ echo '' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . ''; diff --git a/includes/OutputSerialItems.php b/includes/OutputSerialItems.php index 5b2cdba0f..de42b2b98 100644 --- a/includes/OutputSerialItems.php +++ b/includes/OutputSerialItems.php @@ -69,7 +69,6 @@ $TotalQuantity = 0; /*Variable to accumulate total quantity received */ $RowCounter =0; -$k=0; foreach ($LineItem->SerialItems as $Bundle){ if ($RowCounter == 10){ @@ -79,15 +78,8 @@ $RowCounter++; } - if ($k==1){ - echo ''; - $k=0; - } else { - echo ''; - $k=1; - } - - echo '' . $Bundle->BundleRef . ''; + echo ' + ' . $Bundle->BundleRef . ''; if ($LineItem->Serialised==0 and $Perishable==0){ echo '' . locale_number_format($Bundle->BundleQty, $LineItem->DecimalPlaces) . '';