private void ChkBillBtn_Click(object sender, EventArgs e) { try { if (aBillGeneralRow["IsChecked"].ToString() == "0") { string ChkdBy = SharedFunctions.ReturnLoggedUserName(); string ChkDate = DateTime.Now.ToShortDateString(); if (!BillGeneralMgmt.UpdateBillToChecked(ChkdBy, ChkDate, int.Parse(InvoiceNumTxtBox.Text))) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [DB-ERROR-EditBill-ChkBillBtn_Click] " + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } else { MessageBox.Show(MsgTxt.CheckedSuccesfullyTxt, MsgTxt.AddedSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } else { MessageBox.Show(MsgTxt.AlreadyCheckedTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [EditBill-ChkBillBtn_Click] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void EditBillBtn_Click(object sender, EventArgs e) { try { int TestParse = 0; if (int.TryParse(BillNumberTxtBox.Text, out TestParse)) { BillNumberTxtBox.BackColor = BillNumberBGColor; if (BillGeneralMgmt.IsBillExist(int.Parse(BillNumberTxtBox.Text))) { DataTable aDataTableToPass = BillDetailedMgmt.SelectBillByBillNumber(int.Parse(BillNumberTxtBox.Text)); if (aDataTableToPass == null) { throw new Exception("aDataTableToPass==null"); } EditBill aEditBill = new EditBill(); aEditBill.TopMost = true; aEditBill.AddDgView(aDataTableToPass); DataRow aGeneralBillDataRow = BillGeneralMgmt.SelectBillByNumber(int.Parse(BillNumberTxtBox.Text)); if (aGeneralBillDataRow == null) { aEditBill.Close(); throw new Exception("aGeneralBillDataRow==null"); } aEditBill.UpdateVariables(aGeneralBillDataRow); aEditBill.Show(); this.Close(); } else { MessageBox.Show(MsgTxt.BillNumberNotExistTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); BillNumberTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor; return; } } else { MessageBox.Show(MsgTxt.ErrorPleaseEnterCorrectAmount, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); BillNumberTxtBox.BackColor = SharedVariables.TxtBoxRequiredColor; return; } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [EditBillBtn_Click] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } }
private void ListBillsDGView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (PrivilegesManager.GetEventStatues(Calcium_RMS.Events.EditBills) == EventStatus.Permit) { if (e.RowIndex < 0) { return; } else { DataTable aDataTableToPass = BillDetailedMgmt.SelectBillByBillNumber(int.Parse(ListBillsDGView.Rows[e.RowIndex].Cells["Number"].Value.ToString())); if (aDataTableToPass != null) { EditBill aEditBill = new EditBill(); // aEditBill.Parent = Helper.Instance.ActiveMainWindow; aEditBill.AddDgView(aDataTableToPass); DataRow aGeneralBillDataRow = BillGeneralMgmt.SelectBillByNumber(int.Parse(ListBillsDGView.Rows[e.RowIndex].Cells["Number"].Value.ToString())); if (aGeneralBillDataRow != null) { aEditBill.UpdateVariables(aGeneralBillDataRow); aEditBill.Dock = DockStyle.Fill; aEditBill.Show(); } } } } else { MessageBox.Show(MsgTxt.PrivUserNotAllowedTxt, MsgTxt.InformationCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBills:ListBillsDGView_CellDoubleClick()] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); //throw; } }
private void ListBillsBtn_Click(object sender, EventArgs e) { try { int FilterCustomerID = -1; if (CustomerNameChkBox.Checked) { FilterCustomerID = CustomerMgmt.SelectCustomerIDByPhone1(CustomerPhoneTxtBox.Text); if (FilterCustomerID == -1) { MessageBox.Show("Customer Not Found"); } } aCustomerTable = CustomerMgmt.SelectAllCustomers(); aCurrencyTable = CurrencyMgmt.SelectAll(); aUsersTable = UsersMgmt.SelectAllUsers(); aAccountsTable = AccountsMgmt.SelectAll(); aPriceLevelTable = PriceLevelsMgmt.SelectAll(); aPaymentMethodTable = PaymentMethodMgmt.SelectAll(); ListBillsDGView.Rows.Clear(); int FilterTellerNameID = 0; if (TellerNameChkBox.Checked && TellerNameComboBox.SelectedValue != null) { FilterTellerNameID = int.Parse(TellerNameComboBox.SelectedValue.ToString()); } string FilterDateFrom = ""; string FilterDateTo = ""; if (DateCheckBox.Checked) { FilterDateFrom = DateFrompicker.Value.ToShortDateString(); FilterDateTo = DateToPicker.Value.ToShortDateString(); } bool FilterCheckedBills = CkeckedBillsChkBox.Checked; bool FilterIsRevised = IsRevisedChkBox.Checked; bool FilterUnCheckedBills = UncheckedBillChkBox.Checked; bool FilterUnRevisedBills = UnRevisedChkBox.Checked; bool FilterCashCreditBills = CreditBillsChkBox.Checked; aBillTable = BillGeneralMgmt.SelectAllBills(FilterTellerNameID, FilterDateFrom, FilterDateTo, FilterCheckedBills, FilterIsRevised, FilterUnCheckedBills, FilterUnRevisedBills, FilterCustomerID, FilterCashCreditBills); if (aBillTable == null) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBillsBtn_Click:DB-ERROR aBillTable=null] \n \n", MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TotalITemsTxtBox.Text = aBillTable.Rows.Count.ToString(); if (aBillTable.Rows.Count > 0) { RowNum = 0; if (ListBillsDGView.Rows.Count < ItemsPerPage) { //TestingFor Paging pagesnumber = (int)aBillTable.Rows.Count / ItemsPerPage; if ((double.Parse(aBillTable.Rows.Count.ToString()) / ItemsPerPage - int.Parse(aBillTable.Rows.Count.ToString()) / ItemsPerPage) > 0) { pagesnumber++; } foreach (DataRow r in aBillTable.Rows) { if (ListBillsDGView.Rows.Count < ItemsPerPage) { ListBillsDGView.Rows.Add(); ListBillsDGView.Rows[RowNum].Cells["Number"].Value = aBillTable.Rows[RowNum]["Number"].ToString(); ListBillsDGView.Rows[RowNum].Cells["Date"].Value = aBillTable.Rows[RowNum]["Date"].ToString(); ListBillsDGView.Rows[RowNum].Cells["BillTime"].Value = aBillTable.Rows[RowNum]["BillTime"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalItems"].Value = aBillTable.Rows[RowNum]["TotalItems"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalTax"].Value = aBillTable.Rows[RowNum]["TotalTax"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalPrice"].Value = aBillTable.Rows[RowNum]["TotalPrice"].ToString(); for (int i = 0; i < aUsersTable.Rows.Count; i++) { if (int.Parse(aUsersTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["TellerID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["TellerID"].Value = aUsersTable.Rows[i]["UserName"].ToString();//aBillTable.Rows[RowNum]["TellerID"].ToString(); break; } } for (int i = 0; i < aCustomerTable.Rows.Count; i++) { if (int.Parse(aCustomerTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["CustomerID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["CustomerID"].Value = aCustomerTable.Rows[i]["Name"].ToString(); break; } } for (int i = 0; i < aPriceLevelTable.Rows.Count; i++) { if (int.Parse(aPriceLevelTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["PriceLevelID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["PriceLevelID"].Value = aPriceLevelTable.Rows[i]["Name"].ToString(); break; } } for (int i = 0; i < aPaymentMethodTable.Rows.Count; i++) { if (int.Parse(aPaymentMethodTable.Rows[i]["ID"].ToString()) == int.Parse(aBillTable.Rows[RowNum]["PaymentMethodID"].ToString())) { ListBillsDGView.Rows[RowNum].Cells["PaymentMethodID"].Value = aPaymentMethodTable.Rows[i]["Name"].ToString(); break; } } ListBillsDGView.Rows[RowNum].Cells["TotalCost"].Value = aBillTable.Rows[RowNum]["TotalCost"].ToString(); ListBillsDGView.Rows[RowNum].Cells["Comments"].Value = aBillTable.Rows[RowNum]["Comments"].ToString(); ListBillsDGView.Rows[RowNum].Cells["SalesDiscount"].Value = aBillTable.Rows[RowNum]["SalesDiscount"].ToString(); ListBillsDGView.Rows[RowNum].Cells["DiscountPerc"].Value = aBillTable.Rows[RowNum]["DiscountPerc"].ToString(); ListBillsDGView.Rows[RowNum].Cells["CashIn"].Value = aBillTable.Rows[RowNum]["CashIn"].ToString(); ListBillsDGView.Rows[RowNum].Cells["TotalDiscount"].Value = aBillTable.Rows[RowNum]["TotalDiscount"].ToString(); if (aBillTable.Rows[RowNum]["IsChecked"].ToString() == "0") { ListBillsDGView.Rows[RowNum].Cells["IsChecked"].Value = UiText.NoTxt; } else { ListBillsDGView.Rows[RowNum].Cells["IsChecked"].Value = UiText.YesTxt; } if (aBillTable.Rows[RowNum]["IsRevised"].ToString() == "0") { ListBillsDGView.Rows[RowNum].Cells["IsRevised"].Value = UiText.NoTxt; } else { ListBillsDGView.Rows[RowNum].Cells["IsRevised"].Value = UiText.YesTxt; } ListBillsDGView.Rows[RowNum].Cells["CheckedDate"].Value = aBillTable.Rows[RowNum]["CheckedDate"].ToString(); ListBillsDGView.Rows[RowNum].Cells["CheckedBy"].Value = aBillTable.Rows[RowNum]["CheckedBy"].ToString(); ListBillsDGView.Rows[RowNum].Cells["ReviseDate"].Value = aBillTable.Rows[RowNum]["ReviseDate"].ToString(); ListBillsDGView.Rows[RowNum].Cells["RevisedBy"].Value = aBillTable.Rows[RowNum]["RevisedBy"].ToString(); ListBillsDGView.Rows[RowNum].Cells["ReviseLoss"].Value = aBillTable.Rows[RowNum]["ReviseLoss"].ToString(); RowNum++; } } PageOfTotalTxtBox.Text = "1/" + pagesnumber.ToString(); currentpage = 1; } } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [ListBillsBtn_Click] \n Exception: \n" + ex.ToString(), MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private void Add1000Sale_Click(object sender, EventArgs e) { int cnt = 1; DateTime date = DateTime.Now; var randAmount = new Random(); int userId = int.Parse(UsersMgmt.SelectAllUsers().Rows[0]["ID"].ToString()); while (cnt++ < NumberOfBills) { try { int numofDetailed = randAmount.Next(1, 20); var aBillGeneral = new BillGeneral(); aBillGeneral.Bill_General_AccountID = 1; aBillGeneral.Bill_General_CashIn = 100; aBillGeneral.Bill_General_Currency = "JOD"; aBillGeneral.Bill_General_CurrencyID = 1; aBillGeneral.Bill_General_CustomerID = 1; aBillGeneral.Bill_General_Date = date.Subtract(TimeSpan.FromDays(randAmount.Next(1, 2000))).ToShortDateString(); aBillGeneral.Bill_General_DiscountPerc = 0; aBillGeneral.Bill_General_IsCashCredit = 0; aBillGeneral.Bill_General_NetAmount = 100; aBillGeneral.Bill_General_Number = BillGeneralMgmt.NextBillNumber(); aBillGeneral.Bill_General_PaymentMethodID = 1; aBillGeneral.Bill_General_PriceLevel = 1; aBillGeneral.Bill_General_SalesDiscount = 0; aBillGeneral.Bill_General_SubTotal = 100; aBillGeneral.Bill_General_TellerID = userId; aBillGeneral.Bill_General_Time = DateTime.Now.ToShortTimeString(); aBillGeneral.Bill_General_TotalCost = randAmount.Next(50, 99); aBillGeneral.Bill_General_TotalDiscount = 0; aBillGeneral.Bill_General_TotalItems = numofDetailed; aBillGeneral.Bill_General_TotalPrice = 100; aBillGeneral.Bill_General_TotalTax = 16; aBillGeneral.CustomerAccountAmountOld = 0; aBillGeneral.Bill_General_Comments = "Test Sale"; aBillGeneral.Bill_General_CreditCardInfo = "NotCredit"; Random aRandom = new Random(); if (BillGeneralMgmt.InsertBill(aBillGeneral)) { while (numofDetailed > 0) { BillDetailed aBillDetailed = new BillDetailed(); string aBarcode = "Test Item " + aRandom.Next(1, (int)NumberOfItems); DataTable aItemRow = ItemsMgmt.SelectItemByBarCode(aBarcode); if (aItemRow.Rows.Count != 0) { aBillDetailed.Bill_Detailed_ItemDescription = aItemRow.Rows[0]["Description"].ToString(); aBillDetailed.Bill_Detailed_ItemID = int.Parse(aItemRow.Rows[0]["ID"].ToString()); aBillDetailed.Bill_Detailed_Number = aBillGeneral.Bill_General_Number; aBillDetailed.Bill_Detailed_OldAvaQty = double.Parse(aItemRow.Rows[0]["Qty"].ToString()); aBillDetailed.Bill_Detailed_OldAvgUnitCost = double.Parse(aItemRow.Rows[0]["AvgUnitCost"].ToString()); aBillDetailed.Bill_Detailed_Qty = numofDetailed; aBillDetailed.Bill_Detailed_SellPrice = double.Parse(aItemRow.Rows[0]["SellPrice"].ToString()); aBillDetailed.Bill_Detailed_TotalPerUnit = aBillDetailed.Bill_Detailed_Qty * aBillDetailed.Bill_Detailed_SellPrice; BillDetailedMgmt.InsertItem(aBillDetailed); } numofDetailed--; } } if (cnt % 100 == 0) { label1.Text = $"Adding Bill {cnt}/{NumberOfBills} ... ({(cnt / NumberOfBills) * 100 })%"; Application.DoEvents(); } } catch (Exception ex) { MessageBox.Show($"Error in {cnt} \n {ex}"); } } }
private void ReviseBillBtn_Click(object sender, EventArgs e) { try { if (aBillGeneralRow["IsRevised"].ToString() == "0") { if (CashMethodComboBox.SelectedIndex == 1)//iscredit { int CustomerID = CustomerMgmt.SelectCustomerIDByPhone1(PhoneTxtBox.Text); DataRow aCustomerAccount = CustomersAccountsMgmt.SelectCustomerAccountRowByCusID(CustomerID); double OldAmount = double.Parse(aCustomerAccount["Amount"].ToString()); double NewAmount = OldAmount - double.Parse(TotalTxtBox.Text); int AccountID = int.Parse(aCustomerAccount["ID"].ToString()); CustomersAccountsMgmt.UpdateAccountAmountByAccountID(AccountID, NewAmount); } else {//int.Parse(AccountComboBox.SelectedValue.ToString()); int AccountID = int.Parse(aBillGeneralRow["AccountID"].ToString()); DataRow aAccountRow = AccountsMgmt.SelectAccountRowByID(AccountID); double OldAmount = double.Parse(aAccountRow["Amount"].ToString()); double NewAmount = OldAmount - double.Parse(TotalTxtBox.Text);; AccountsMgmt.UpdateAccountAmountByAccountID(AccountID, NewAmount); } //Mark the check (if any) as revised DataRow aMethodRow = PaymentMethodMgmt.SelectMethodRowByID(int.Parse(aBillGeneralRow["PaymentMethodID"].ToString())); if (aMethodRow["IsCheck"].ToString() == "1") { ChecksMgmt.MakeCheckRevised(int.Parse(aBillGeneralRow["CheckNumber"].ToString()), DateTime.Now.ToShortDateString()); } //Now Update AvgUnitCost double CostLoss = 0; foreach (DataGridViewRow r in TeldgView.Rows) { if (!r.IsNewRow) { int ItemID = ItemsMgmt.SelectItemIDByBarcode(TeldgView.Rows[r.Index].Cells["Barcode"].Value.ToString()); double OldAvgUnitCost = BillDetailedMgmt.SelectOldAvgUnitCostByID(ItemID, int.Parse(aBillGeneralRow["Number"].ToString())); double ReturnQty = double.Parse(TeldgView.Rows[r.Index].Cells["Qty"].Value.ToString()); double CurrentAvgUnitCost = ItemsMgmt.SelectItemCostByBarcode(TeldgView.Rows[r.Index].Cells["Barcode"].Value.ToString()); double CurrentAvaQty = ItemsMgmt.SelectItemQtyByID(ItemID); double NewAvgUnitCost = CurrentAvgUnitCost; if ((ReturnQty + CurrentAvaQty) != 0) //to avoid division by zero { NewAvgUnitCost = ((CurrentAvgUnitCost * CurrentAvaQty) + (ReturnQty * OldAvgUnitCost)) / (ReturnQty + CurrentAvaQty); } CostLoss += (NewAvgUnitCost - OldAvgUnitCost) * BillDetailedMgmt.SelectAllItemsSoldAfterBillNumber(ItemID, int.Parse(aBillGeneralRow["Number"].ToString())); ItemsMgmt.UpdateItemQtyandAvgUnitCostByID(ItemID, (ReturnQty + CurrentAvaQty), NewAvgUnitCost); BillDetailedMgmt.MakeItemAsRevised(int.Parse(aBillGeneralRow["Number"].ToString()), ItemID); } } //Now we should mark the bill general as reversed if (!BillGeneralMgmt.UpdateBillToRevised(SharedFunctions.ReturnLoggedUserName(), DateTime.Now.ToShortDateString(), int.Parse(aBillGeneralRow["Number"].ToString()), CostLoss)) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [DB-ERROR-EditBill-ReviseBillBtn_Click] " + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } MessageBox.Show(MsgTxt.ReversedSuccessfullyTxt, MsgTxt.AddedSuccessfully, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(MsgTxt.AlreadyReversedTxt, MsgTxt.WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } catch (Exception ex) { MessageBox.Show(MsgTxt.UnexpectedError + "\n IN [EditBill-ReviseBillBtn_Click] \n Exception: \n" + ex.ToString() + "\n" + MsgTxt.FormWillCloseNowTxt, MsgTxt.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); throw; } }
public string EndOfPeriodReport(string TellerName, int FilterTellerNameID, string FilterDateFrom, string FilterDateTo, bool TableBorder = false, bool Preview = true, bool PrintToThermal = false, bool ExportToPdf = false, bool ExportToExcel = false, string ExportPath = "", bool colored = false) { /**************************************** END OF PERIOD *********************************/ /* For Teller : Teller Name (s) Date From ----------> To * Printed On : Date::Time * Printed By : Current User Name * ************************************************************************************* * [CASH] * ---------------------------------------- |-------------------------------------------- * | TYPE | AMOUNT (JOD) | * -------------------------------------------------------------------------------------- * | CASH SALES | XXXXXX.XXX | * -------------------------------------------------------------------------------------- * |_______________TOTAL____________________|_______________XXXXXX.XXX__________________| * */ List <DataTable> aDTList = new List <DataTable>(); DataTable aTempTable = null; DataRow aTempRow = null; /*Row Used For filling the datatables*/ #region REPORT HEADER string RCV = "<b>" + Text.ReportsText.ReceivedRepTxt + "</b>"; string REV = "<b>" + Text.ReportsText.ReversedRepTxt + "</b>"; List <string> aStringList = ReportsHelper.ImportReportHeader(0, 1); List <string> aFooterList = ReportsHelper.ImportReportHeader(1, 1); aStringList.Add(SharedVariables.Line_Solid_10px_Black); aStringList.Add(Text.ReportsNames.EndOfPeriodRepNm); aStringList.Add("<h2>" + Text.ReportsText.TellerRepTxt + ": <b>" + TellerName + "</b></h2>"); aStringList.Add("<h2>" + Text.ReportsText.DateRepTxt + " " + Text.ReportsText.FromRepTxt + " : " + FilterDateFrom + " " + Text.ReportsText.ToRepTxt + " :" + FilterDateTo + "</h2>"); aStringList.Add("<h2>" + Text.ReportsText.PrintedOnrepTxt + " : " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "</h2>"); aStringList.Add("<h2>" + Text.ReportsText.PrintedByrepTxt + ": <b>" + SharedFunctions.ReturnLoggedUserName() + "</b></h2>"); aStringList.Add(SharedVariables.Line_Solid_10px_Black); #endregion REPORT HEADER #region CASH_HANDLING { /*cash scope*/ double CashSalesDiscount = BillGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 0); double CashSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 0); /*Cash Sales Amount*/ double ReversedCashSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 0); double CashSalesReturns = ReturnItemsCustGeneralMGMT.SelectCustomersReturns(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, -1); double NetTotalCashSales = CashSales - ReversedCashSales - CashSalesReturns; /*discount removed since it is in the added to the sales*/ #region CASH_HANDLING_SALES DataTable aCashTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashTableHeader.Columns.Add(Text.ReportsText.CashSalesRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashTableHeader); /*Receieved Cash Sales Handling*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CshSalesRepTxt;/*Cash Sales*/ aTempRow[1] = CashSales + CashSalesDiscount; /*Reversed Cash Sales Handling*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevCashSalesRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedCashSales; /*Cash Sales Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashSalesDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = CashSalesDiscount; /*Cash Sales Returns*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashSalesReturnsRepTxt; /*Cash Sales Returns;*/ aTempRow[1] = CashSalesReturns; /*NET Cash Sales*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalCashSales + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CASH_HANDLING_SALES double CashCustPayment = CustomersPaymentsMgmt.SelectCustomerPayments(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, PaymentMethodMgmt.CASH_PAYMENT_METHOD); double CashVendorPayment = VendorsPaymentsMgmt.SelectCustomerPayments(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, PaymentMethodMgmt.CASH_PAYMENT_METHOD); double NetCashPayments = CashCustPayment - CashVendorPayment; #region CASH_HANDLING_PAYMENTS DataTable aPaymentsTableHeader = new DataTable(); /*Only Header For Cash section*/ aPaymentsTableHeader.Columns.Add(Text.ReportsText.CashPaymentsRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aPaymentsTableHeader); /*Cash Customer Payments*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashCustPaymentsRepTxt;/*Cash Sales*/ aTempRow[1] = CashCustPayment; /*Cash Vendors Payments*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashVendPaymentsRepTxt;/*Cash Sales*/ aTempRow[1] = CashVendorPayment; /*Net Cash Payments*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetCashPayments + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CASH_HANDLING_PAYMENTS double CashPurchaseDiscount = PurchaseVoucherGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, -1); double CashPurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 0);/*Cash Sales Amount*/ double ReversedCashPurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, -1); double CashPurchaseReturns = ReturnItemsVendorGeneralMgmt.SelectVendorReturns(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, -1); double NetTotalCashPurchase = -CashPurchase + ReversedCashPurchase + CashPurchaseReturns; /*discount removed since it is in the added to the sales*/ #region CASH_HANDLING_PURCHASE DataTable aCashPurchaseTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashPurchaseTableHeader.Columns.Add(Text.ReportsText.CashPurchaseRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashPurchaseTableHeader); /*CASH PURCHASES*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashPurchaseRepTxt; aTempRow[1] = CashPurchase + CashPurchaseDiscount; /*REVERSED CASH PURCHASES*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevCashPurchaseRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedCashPurchase; /*Cash Purchase Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashPurchaseDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = CashPurchaseDiscount; /*Cash Purchase Returns*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CashPurchaseReturnRepTxt; /*Cash Sales Returns;*/ aTempRow[1] = CashPurchaseReturns; /*NET Cash Purchase*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalCashPurchase + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CASH_HANDLING_PURCHASE double TotalCash = NetTotalCashSales + NetCashPayments - NetTotalCashPurchase; DataTable aFinalCashTable = new DataTable(); aFinalCashTable.Columns.Add(Text.ReportsText.TotalCashAmountTxt + " " + TotalCash.ToString() + " JOD <hr/>"); aDTList.Add(aFinalCashTable); }/*end cash scope*/ #endregion CASH_HANDLING #region INVOICE_CARD_HANDLING { /*Invoice Scope*/ double InvoiceSalesDiscount = BillGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); double InvoiceSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); /*Cash Sales Amount*/ double ReversedInvoiceSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); double NetTotalInvoiceSales = InvoiceSales - ReversedInvoiceSales; /*discount removed since it is in the added to the sales*/ #region INVOICE_HANDLING_SALES DataTable aCashTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashTableHeader.Columns.Add(Text.ReportsText.InvoiceSalesRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashTableHeader); /*Receieved Cash Sales Handling*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.InvoiceSalesRepTxt;/*Cash Sales*/ aTempRow[1] = InvoiceSalesDiscount + InvoiceSales; /*Reversed Cash Sales Handling*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevInvoiceSalesRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedInvoiceSales; /*Cash Sales Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.InvoiceDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = InvoiceSalesDiscount; /*NET Cash Sales*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalInvoiceSales + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion INVOICE_HANDLING_SALES double InvoicePurchaseDiscount = PurchaseVoucherGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); double InvoicePurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); /*Cash Sales Amount*/ double ReversedInvoicePurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CASH_PAYMENT_METHOD, 1); double NetTotalInvoicePurchase = -InvoicePurchase + ReversedInvoicePurchase; /*discount removed since it is in the added to the sales*/ #region Invoice_HANDLING_PURCHASE DataTable aCashPurchaseTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashPurchaseTableHeader.Columns.Add(Text.ReportsText.InvoicePurchaseRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashPurchaseTableHeader); /*CASH PURCHASES*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.InvoicePurchaseRepTxt; aTempRow[1] = InvoicePurchase + InvoicePurchaseDiscount; /*REVERSED CASH PURCHASES*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevInvoicePurchaseRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedInvoicePurchase; /*Cash Purchase Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.InvoicePurchaseDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = InvoicePurchaseDiscount; /*NET Cash Purchase*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalInvoicePurchase + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion Invoice_HANDLING_PURCHASE double TotalInvoice = NetTotalInvoiceSales - NetTotalInvoicePurchase; DataTable aFinalInvoiceTable = new DataTable(); aFinalInvoiceTable.Columns.Add(Text.ReportsText.TotalInvoiceAmountTxt + " " + TotalInvoice.ToString() + " JOD <hr/>"); aDTList.Add(aFinalInvoiceTable); }/*End Invoice Scope*/ #endregion INVOICE_CARD_HANDLING #region CREDIT_CARD_HANDLING { /*Credit Scope*/ double CreditSalesDiscount = BillGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); double CreditSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); /*Cash Sales Amount*/ double ReversedCreditSales = BillGeneralMgmt.SelectSalesAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); double NetTotalCreditSales = CreditSales - ReversedCreditSales; /*discount removed since it is in the added to the sales*/ #region CREDIT_HANDLING_SALES DataTable aCashTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashTableHeader.Columns.Add(Text.ReportsText.CreditSalesRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashTableHeader); /*Receieved Cash Sales Handling*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditSalesRepTxt;/*Cash Sales*/ aTempRow[1] = CreditSales + CreditSalesDiscount; /*Reversed Cash Sales Handling*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevCreditSalesRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedCreditSales; /*Cash Sales Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditSalesDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = CreditSalesDiscount; /*NET Cash Sales*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalCreditSales + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CREDIT_HANDLING_SALES double CreditCustPayment = CustomersPaymentsMgmt.SelectCustomerPayments(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD); double CreditVendorPayment = VendorsPaymentsMgmt.SelectCustomerPayments(FilterDateFrom, FilterDateTo, FilterTellerNameID, 0, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD); double NetCreditPayments = CreditCustPayment - CreditVendorPayment; #region CREDIT_HANDLING_PAYMENTS DataTable aPaymentsTableHeader = new DataTable(); /*Only Header For Cash section*/ aPaymentsTableHeader.Columns.Add(Text.ReportsText.CreditPaymentsRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aPaymentsTableHeader); /*Cash Customer Payments*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditCustPaymentsRepTxt;/*Cash Sales*/ aTempRow[1] = CreditCustPayment; /*Cash Vendors Payments*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditVendPaymentsRepTxt;/*Cash Sales*/ aTempRow[1] = CreditVendorPayment; /*Net Cash Payments*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetCreditPayments + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CREDIT_HANDLING_PAYMENTS double CreditPurchaseDiscount = PurchaseVoucherGeneralMgmt.SelectTotalDiscount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); double CreditPurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, -1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); /*Cash Sales Amount*/ double ReversedCreditPurchase = PurchaseVoucherGeneralMgmt.SelectPurchaseAmount(FilterDateFrom, FilterDateTo, FilterTellerNameID, 1, PaymentMethodMgmt.CREDITCARD_PAYMENT_METHOD, -1); double NetTotalCreditPurchase = -CreditPurchase + ReversedCreditPurchase; /*discount removed since it is in the added to the sales*/ #region CREDIT_HANDLING_PURCHASE DataTable aCashPurchaseTableHeader = new DataTable(); /*Only Header For Cash section*/ aCashPurchaseTableHeader.Columns.Add(Text.ReportsText.CreditPurchaseRepTxt); /*Title Only row, this is empty datatable*/ aDTList.Add(aCashPurchaseTableHeader); /*CASH PURCHASES*/ aTempTable = GetEndOfPeriodInnerTable(TableBorder); aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditPurchaseRepTxt; aTempRow[1] = CreditPurchase + CreditPurchaseDiscount; /*REVERSED CASH PURCHASES*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.RevCreditPurchaseRepTxt;/*ReversedCash Sales*/ aTempRow[1] = ReversedCreditPurchase; /*Cash Purchase Discounts*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = Text.ReportsText.CreditPurchaseDiscountRepTxt;/*ReversedCash Sales*/ aTempRow[1] = CreditPurchaseDiscount; /*NET Cash Purchase*/ aTempRow = aTempTable.Rows.Add(); aTempRow[0] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.MANUAL_TD_OPTION_END + ReportsHelper.MANUAL_TD_END; aTempRow[1] = ReportsHelper.MANUAL_TD_OPTION_START + ReportsHelper.NOBORDER + ReportsHelper.UNDERLINE + ReportsHelper.BOLD + ReportsHelper.MANUAL_TD_OPTION_END + Text.ReportsText.TotalTxt + " " + NetTotalCreditPurchase + ReportsHelper.MANUAL_TD_END; aDTList.Add(aTempTable); #endregion CREDIT_HANDLING_PURCHASE double TotalCredit = NetTotalCreditSales + NetCreditPayments - NetTotalCreditPurchase; DataTable aFinalCreditTable = new DataTable(); aFinalCreditTable.Columns.Add(Text.ReportsText.TotalCreditAmountTxt + " " + TotalCredit.ToString() + " JOD <hr/>"); aDTList.Add(aFinalCreditTable); }/*End Credit Scope*/ #endregion CREDIT_HANDLING_PURCHASE #region SENDING_FOR_PRINTING_MANAGER if (Preview) { PrintingManager.Instance.PrintTables(aDTList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, PrintToThermal, false, false, "", false, "", colored); return("True"); } else if (ExportToPdf) { PrintingManager.Instance.PrintTables(aDTList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, false, false, true, ExportPath, false, "", colored); return("True"); } else if (ExportToExcel) { PrintingManager.Instance.PrintTables(aDTList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, false, false, false, "", ExportToExcel, ExportPath, colored); return("True"); } else if (PrintToThermal) { PrintingManager.Instance.PrintTables(aDTList, aStringList, aFooterList, ReportsHelper.TempOutputPath, ReportsHelper.TempOutputPath, PrintToThermal, true); return("True"); } else { return("ERROR"); } #endregion SENDING_FOR_PRINTING_MANAGER }