public RMS.Common.ObjectModel.CPaymentSummary GetTotalPaymentSummary(long inStartDate, long inEndDate) { CPaymentSummary oPaymentSummary = new CPaymentSummary(); try { this.OpenConnection(); String sSql1 = String.Format(SqlQueries.GetQuery(Query.PaymentSummaryGetTotal), inStartDate, inEndDate); IDataReader oReader = this.ExecuteReader(sSql1); if (oReader != null) { while (oReader.Read()) { oPaymentSummary = ReaderToPaymentSummary(oReader); } } } catch (Exception ex) { Logger.Write("Exception : " + ex + " in GetTotalPaymentSummary()", LogLevel.Error, "Database"); if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occured at GetTotalPaymentSummary()", ex); } else { throw new Exception("Exception occure at GetTotalPaymentSummary()", ex); } } finally { this.CloseConnection(); } return oPaymentSummary; }
public void FillLabels() { CashLabel.Text = "0.000"; EFTLabel.Text = "0.000"; ChequeLabel.Text = "0.000"; VoucherLabel.Text = "0.000"; DiscountLabel.Text = "0.000"; DepositeLabel.Text = "0.000"; lblNetSaleValue.Text = "0.000"; lblServiceCharge.Text = "0.000"; if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0); else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now; CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); if (tempViewType == 0) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummary(tempCurrentDate).Data; } else if (tempViewType == 1) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "Table").Data; } else if (tempViewType == 2) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "TakeAway").Data; } else if (tempViewType == 3) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "Tabs").Data; } else if (tempViewType == 4) { //tempPayamentSummary = (CPaymentSummary)tempResult.Data; } if (tempPayamentSummary != null) { CashLabel.Text = (tempPayamentSummary.TotalCashPayment - tempPayamentSummary.ServiceChargeCash).ToString("F02"); EFTLabel.Text = (tempPayamentSummary.TotalEFTPayment - tempPayamentSummary.ServiceChargeEft).ToString("F02"); ChequeLabel.Text = (tempPayamentSummary.TotalChequePayment - tempPayamentSummary.ServiceChargeCheque).ToString("F02"); AccLabel.Text = (tempPayamentSummary.TotalAccPayment - tempPayamentSummary.ServiceChargeAcc).ToString("F02"); VoucherLabel.Text = tempPayamentSummary.TotalVoucherPayment.ToString("F02"); DiscountLabel.Text = tempPayamentSummary.TotalDiscount.ToString("F02"); DepositeLabel.Text = tempPayamentSummary.TotalDepositePayment.ToString("F02"); lblServiceCharge.Text=tempPayamentSummary.TotalServicePayment.ToString("F02"); lblGrossValue.Text = (tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment).ToString("F02"); lblNetSaleValue.Text = ((tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment ) - tempPayamentSummary.TotalDiscount - tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.TotalServicePayment).ToString("F02"); lblCashService.Text = tempPayamentSummary.ServiceChargeCash.ToString("F02"); lblChequeService.Text = tempPayamentSummary.ServiceChargeCheque.ToString("F02"); lblEftService.Text = tempPayamentSummary.ServiceChargeEft.ToString("F02"); lblServiceAcc.Text = tempPayamentSummary.ServiceChargeAcc.ToString("F02"); lblServiceVoucher.Text = tempPayamentSummary.ServiceChargeVoucher.ToString("F02"); } }
private void PrintSummaryButton_Click(object sender, EventArgs e) { try { if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0); else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now; CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummary(tempCurrentDate).Data; CPrintMethods tempPrintMethods = new CPrintMethods(); string serialHeader = ""; string serialFooter = ""; string serialBody = ""; serialBody += " Payment Summary Report"; String DateString = "Billing Date: " + tempCurrentDate.ToLongDateString(); serialBody += "\r\n".PadRight((int)(45 - DateString.Length) / 2) + DateString + "\r\n\r\n"; if (tempPayamentSummary != null) { serialBody += "Payable Summary:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\nGross Sale:" + (tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.ServiceChargeVoucher).ToString("F02"); serialBody += "\r\nNet Sale:" + (Convert.ToDouble(lblGrossValue.Text) - tempPayamentSummary.TotalDiscount - tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.TotalServicePayment + tempPayamentSummary.ServiceChargeVoucher).ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nNet Sales Breakdown:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\nTotal Cash: " + (tempPayamentSummary.TotalCashPayment-tempPayamentSummary.ServiceChargeCash).ToString("F02"); serialBody += "\r\n EFT: " + (tempPayamentSummary.TotalEFTPayment-tempPayamentSummary.ServiceChargeEft).ToString("F02"); serialBody += "\r\n Cheque: " + (tempPayamentSummary.TotalChequePayment-tempPayamentSummary.ServiceChargeCheque).ToString("F02"); serialBody += "\r\n Account: " + (tempPayamentSummary.TotalAccPayment - tempPayamentSummary.ServiceChargeAcc).ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nPromotions and Discounts:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Voucher: " + tempPayamentSummary.TotalVoucherPayment.ToString("F02"); serialBody += "\r\n Discount: " + tempPayamentSummary.TotalDiscount.ToString("F02"); serialBody += "\r\n Service Ch: " + tempPayamentSummary.TotalServicePayment.ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nService Charge Breakdown:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Cash: " + tempPayamentSummary.ServiceChargeCash.ToString("F02"); serialBody += "\r\n Cheque: " + tempPayamentSummary.ServiceChargeCheque.ToString("F02"); serialBody += "\r\n Voucher: " + tempPayamentSummary.ServiceChargeVoucher.ToString("F02"); serialBody += "\r\n Eft: " + tempPayamentSummary.ServiceChargeEft.ToString("F02"); serialBody += "\r\n Accounts: " + tempPayamentSummary.ServiceChargeAcc.ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Deposit Used: " + tempPayamentSummary.TotalDepositePayment.ToString("F02"); } serialBody += "\r\n\r\n"; tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, ""); this.WriteString(serialBody);///Write to a file when print command is executed } catch (Exception exp) { throw exp; } }
private void PrintDetailButton_Click(object sender, EventArgs e) { try { CPrintMethods tempPrintMethods = new CPrintMethods(); string serialHeader = ""; string serialFooter = ""; string serialBody = ""; serialBody += " Payment Detail Report"; String DateString = "Billing Date: " + tempCurrentDate.ToLongDateString(); serialBody += "\r\n".PadRight((int)(45 - DateString.Length) / 2) + DateString + "\r\n\r\n"; if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0); else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now; CPaymentSummaryManager tempSummaryByOrderManager = new CPaymentSummaryManager(); List<CPaymentSummaryByOrder> tempSummaryByOrder = (List<CPaymentSummaryByOrder>)tempSummaryByOrderManager.GetTotalPaymentSummaryForViewReport(tempCurrentDate).Data; CPaymentSummaryByOrder[] tempSummaryByOrderArray = tempSummaryByOrder.ToArray(); serialBody += "SL Order Table Payment Total"; serialBody += "\r\n Type Number Type"; serialBody += "\r\n--- -------- ---- --------------- ------"; for (int counter = 0; counter < tempSummaryByOrderArray.Length; counter++) { bool tempbool = false; float tempCashPayment = 0; float tempChequePayment = 0; float tempVoucherPayment = 0; float tempDiscount = 0; float tempDepositePayment = 0; float tempEFTPayment = 0; float tempServicePayment = 0; float.TryParse(tempSummaryByOrderArray[counter].TotalCashPayment.ToString(), out tempCashPayment); float.TryParse(tempSummaryByOrderArray[counter].TotalChequePayment.ToString(), out tempChequePayment); float.TryParse(tempSummaryByOrderArray[counter].TotalVoucherPayment.ToString(), out tempVoucherPayment); float.TryParse(tempSummaryByOrderArray[counter].TotalDepositePayment.ToString(), out tempDepositePayment); float.TryParse(tempSummaryByOrderArray[counter].TotalEFTPayment.ToString(), out tempEFTPayment); float.TryParse(tempSummaryByOrderArray[counter].TotalServicePayment.ToString(), out tempServicePayment); float.TryParse(tempSummaryByOrderArray[counter].Discount.ToString(), out tempDiscount); serialBody += "\r\n" + ((int)(counter + 1)).ToString().PadRight(3) + " " + (tempSummaryByOrderArray[counter].OrderType.Trim()).PadRight(8, ' ') + " " + tempSummaryByOrderArray[counter].TableNumber.ToString().PadRight(4, ' ') + " ";// +tempPayString.Trim().PadRight(13, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment; if (tempCashPayment > 0) { string temp = "Cash:(" + tempCashPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment+tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempChequePayment > 0) { string temp = "Cheque(" + tempChequePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment+tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempVoucherPayment > 0) { string temp = "Voucher(" + tempVoucherPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment + tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempEFTPayment > 0) { string temp = "EFT(" + tempEFTPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment + tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempServicePayment > 0) { string temp = "Sevice(" + tempServicePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment + tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempDiscount > 0) { string temp = "Discount(" + tempDiscount.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment + tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempDepositePayment > 0) { string temp = "Deposit(" + tempDepositePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + (tempSummaryByOrderArray[counter].TotalPayment + tempSummaryByOrderArray[counter].TotalServicePayment).ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } } CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummary(tempCurrentDate).Data; if (tempPayamentSummary != null) { serialBody += "Payable Summary:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\nGross Sale:" + (tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.ServiceChargeVoucher).ToString("F02"); serialBody += "\r\nNet Sale:" + (Convert.ToDouble(lblGrossValue.Text) - tempPayamentSummary.TotalDiscount - tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.TotalServicePayment + tempPayamentSummary.ServiceChargeVoucher).ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nNet Sales Breakdown:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\nTotal Cash: " + (tempPayamentSummary.TotalCashPayment-tempPayamentSummary.ServiceChargeCash) .ToString("F02"); serialBody += "\r\n EFT: " + (tempPayamentSummary.TotalEFTPayment-tempPayamentSummary.ServiceChargeEft).ToString("F02"); serialBody += "\r\n Cheque: " + (tempPayamentSummary.TotalChequePayment-tempPayamentSummary.ServiceChargeCheque).ToString("F02"); serialBody += "\r\n Account: " + (tempPayamentSummary.TotalAccPayment - tempPayamentSummary.ServiceChargeAcc).ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nPromotions and Discounts:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Voucher: " + tempPayamentSummary.TotalVoucherPayment.ToString("F02"); serialBody += "\r\n Discount: " + tempPayamentSummary.TotalDiscount.ToString("F02"); serialBody += "\r\n Service Ch: " + tempPayamentSummary.TotalServicePayment.ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\nService Charge Breakdown:"; serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Cash: " + tempPayamentSummary.ServiceChargeCash.ToString("F02"); serialBody += "\r\n Cheque: " + tempPayamentSummary.ServiceChargeCheque.ToString("F02"); serialBody += "\r\n Voucher: " + tempPayamentSummary.ServiceChargeVoucher.ToString("F02"); serialBody += "\r\n Eft: " + tempPayamentSummary.ServiceChargeEft.ToString("F02"); serialBody += "\r\n Accounts: " + tempPayamentSummary.ServiceChargeAcc.ToString("F02"); serialBody += "\r\n----------------------------------------"; serialBody += "\r\n Deposit Used: " + tempPayamentSummary.TotalDepositePayment.ToString("F02"); serialBody += "\r\n\r\n"; } serialBody += "\r\n\r\n"; tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, ""); this.WriteString(serialBody);///Write to a file when print command is executed } catch (Exception exp) { throw exp; } }
public void LabelPayTextLabels(string inRefNo, string inPrice, string inTableNo) { if (!tempSearch && m_oViewed) { if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0); else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now; CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); if (tempViewType == 0) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummary(tempCurrentDate).Data; } else if (tempViewType == 1) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "Table").Data; } else if (tempViewType == 2) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "TakeAway").Data; } else if (tempViewType == 3) { tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "Tabs").Data; } else if (tempViewType == 4) { //tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByOrderType(tempCurrentDate, "Tabs").Data; //tempPayamentSummary = (CPaymentSummary)tempResult.Data; } if (tempPayamentSummary != null) { if ((tempPayamentSummary.TotalCashPayment - tempPayamentSummary.ServiceChargeCash)>0) { CashLabel.Text = (tempPayamentSummary.TotalCashPayment - tempPayamentSummary.ServiceChargeCash).ToString("F02"); } if (tempPayamentSummary.TotalEFTPayment - tempPayamentSummary.ServiceChargeEft > 0) { EFTLabel.Text = (tempPayamentSummary.TotalEFTPayment - tempPayamentSummary.ServiceChargeEft).ToString("F02"); } if ((tempPayamentSummary.TotalChequePayment - tempPayamentSummary.ServiceChargeCheque) > 0) { ChequeLabel.Text = (tempPayamentSummary.TotalChequePayment - tempPayamentSummary.ServiceChargeCheque).ToString("F02"); } if ((tempPayamentSummary.TotalAccPayment - tempPayamentSummary.ServiceChargeAcc) > 0) { AccLabel.Text = (tempPayamentSummary.TotalAccPayment - tempPayamentSummary.ServiceChargeAcc).ToString("F02"); } VoucherLabel.Text = tempPayamentSummary.TotalVoucherPayment.ToString("F02"); DiscountLabel.Text = tempPayamentSummary.TotalDiscount.ToString("F02"); DepositLabel.Text = tempPayamentSummary.TotalDepositePayment.ToString("F02"); TotalPayLabel.Text = tempPayamentSummary.TotalPayment.ToString("F02"); lblServiceCharge.Text = tempPayamentSummary.TotalServicePayment.ToString("F02"); lblGrossValue.Text = (tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment).ToString("F02"); lblNetSaleValue.Text = ((tempPayamentSummary.TotalPayment + tempPayamentSummary.TotalServicePayment + tempPayamentSummary.TotalDiscount + tempPayamentSummary.TotalVoucherPayment) - tempPayamentSummary.TotalDiscount - tempPayamentSummary.TotalVoucherPayment - tempPayamentSummary.TotalServicePayment).ToString("F02"); lblCashService.Text = tempPayamentSummary.ServiceChargeCash.ToString("F02"); lblChequeService.Text = tempPayamentSummary.ServiceChargeCheque.ToString("F02"); lblEftService.Text = tempPayamentSummary.ServiceChargeEft.ToString("F02"); lblServiceAcc.Text = tempPayamentSummary.ServiceChargeAcc.ToString("F02"); lblServiceVoucher.Text = tempPayamentSummary.ServiceChargeVoucher.ToString("F02"); } else { CashLabel.Text = "0.000"; EFTLabel.Text = "0.000"; ChequeLabel.Text = "0.000"; VoucherLabel.Text = "0.000"; DiscountLabel.Text = "0.000"; DepositLabel.Text = "0.000"; TotalPayLabel.Text = "0.000"; lblGrossValue.Text = "0.000"; lblNetSaleValue.Text = "0.000"; lblCashService.Text = "0.000"; lblChequeService.Text = "0.000"; lblEftService.Text = "0.000"; lblServiceAcc.Text = "0.000"; lblServiceCharge.Text = "0.000"; lblServiceVoucher.Text = "0.000"; } } else if (tempSearch) { float tempCash = 0; float tempEFT = 0; float tempCheque = 0; float tempVoucher = 0; float tempDiscount = 0; float tempDeposite = 0; float tempTotal = 0; float tempService = 0; float tempAcc = 0; double tempCashService = 0; double tempChequeService = 0; double tempEftService = 0; double tempVoucherService = 0; double tempAccservice = 0; if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) != 0) tempCurrentDate = new DateTime(tempCurrentDate.Year, tempCurrentDate.Month, tempCurrentDate.Day, 8, 0, 0); else if (tempCurrentDate.Date.CompareTo(DateTime.Today.Date) == 0) tempCurrentDate = DateTime.Now; CPaymentSummaryManager tempSummaryByOrderManager = new CPaymentSummaryManager(); List<CPaymentSummaryByOrder> inSummaryByOrder = (List<CPaymentSummaryByOrder>)tempSummaryByOrderManager.GetTotalPaymentSummaryForViewReportBySearch(tempCurrentDate, inRefNo, inPrice, inTableNo, m_bRef, m_bPrice, m_bTable).Data; if (inSummaryByOrder != null) { CPaymentSummaryByOrder[] tempPaymentSummaryByOrder = inSummaryByOrder.ToArray(); for (int arrayIndex = 0; arrayIndex < tempPaymentSummaryByOrder.Length; arrayIndex++) { if (tempViewType == 0) { tempCash += tempPaymentSummaryByOrder[arrayIndex].TotalCashPayment; tempCheque += tempPaymentSummaryByOrder[arrayIndex].TotalChequePayment; tempEFT += tempPaymentSummaryByOrder[arrayIndex].TotalEFTPayment; tempVoucher += tempPaymentSummaryByOrder[arrayIndex].TotalVoucherPayment; tempDiscount += tempPaymentSummaryByOrder[arrayIndex].Discount; tempDeposite += tempPaymentSummaryByOrder[arrayIndex].TotalDepositePayment; tempTotal += tempPaymentSummaryByOrder[arrayIndex].TotalPayment; tempService += tempPaymentSummaryByOrder[arrayIndex].TotalServicePayment; tempAcc += tempPaymentSummaryByOrder[arrayIndex].TotalAccPayment; tempCashService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCash; tempChequeService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCheque; tempEftService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeEft; tempAccservice += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeAcc; tempVoucherService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeVoucher; } else if (tempViewType == 1 && tempPaymentSummaryByOrder[arrayIndex].OrderType.Equals("Table")) { tempCash += tempPaymentSummaryByOrder[arrayIndex].TotalCashPayment; tempCheque += tempPaymentSummaryByOrder[arrayIndex].TotalChequePayment; tempEFT += tempPaymentSummaryByOrder[arrayIndex].TotalEFTPayment; tempVoucher += tempPaymentSummaryByOrder[arrayIndex].TotalVoucherPayment; tempDiscount += tempPaymentSummaryByOrder[arrayIndex].Discount; tempDeposite += tempPaymentSummaryByOrder[arrayIndex].TotalDepositePayment; tempTotal += tempPaymentSummaryByOrder[arrayIndex].TotalPayment; tempService += tempPaymentSummaryByOrder[arrayIndex].TotalServicePayment; tempAcc += tempPaymentSummaryByOrder[arrayIndex].TotalAccPayment; tempCashService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCash; tempChequeService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCheque; tempEftService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeEft; tempAccservice += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeAcc; tempVoucherService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeVoucher; } else if (tempViewType == 2 && tempPaymentSummaryByOrder[arrayIndex].OrderType.Equals("TakeAway")) { tempCash += tempPaymentSummaryByOrder[arrayIndex].TotalCashPayment; tempCheque += tempPaymentSummaryByOrder[arrayIndex].TotalChequePayment; tempEFT += tempPaymentSummaryByOrder[arrayIndex].TotalEFTPayment; tempVoucher += tempPaymentSummaryByOrder[arrayIndex].TotalVoucherPayment; tempDiscount += tempPaymentSummaryByOrder[arrayIndex].Discount; tempDeposite += tempPaymentSummaryByOrder[arrayIndex].TotalDepositePayment; tempTotal += tempPaymentSummaryByOrder[arrayIndex].TotalPayment; tempService += tempPaymentSummaryByOrder[arrayIndex].TotalServicePayment; tempAcc += tempPaymentSummaryByOrder[arrayIndex].TotalAccPayment; tempCashService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCash; tempChequeService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCheque; tempEftService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeEft; tempAccservice += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeAcc; tempVoucherService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeVoucher; } else if (tempViewType == 3 && tempPaymentSummaryByOrder[arrayIndex].OrderType.Equals("Tabs")) { tempCash += tempPaymentSummaryByOrder[arrayIndex].TotalCashPayment; tempCheque += tempPaymentSummaryByOrder[arrayIndex].TotalChequePayment; tempEFT += tempPaymentSummaryByOrder[arrayIndex].TotalEFTPayment; tempVoucher += tempPaymentSummaryByOrder[arrayIndex].TotalVoucherPayment; tempDiscount += tempPaymentSummaryByOrder[arrayIndex].Discount; tempDeposite += tempPaymentSummaryByOrder[arrayIndex].TotalDepositePayment; tempTotal += tempPaymentSummaryByOrder[arrayIndex].TotalPayment; tempService += tempPaymentSummaryByOrder[arrayIndex].TotalServicePayment; tempAcc += tempPaymentSummaryByOrder[arrayIndex].TotalAccPayment; tempCashService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCash; tempChequeService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCheque; tempEftService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeEft; tempAccservice += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeAcc; tempVoucherService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeVoucher; } else if (tempViewType == 4 && tempPaymentSummaryByOrder[arrayIndex].OrderType.Equals("Deposit")) { tempCash += tempPaymentSummaryByOrder[arrayIndex].TotalCashPayment; tempCheque += tempPaymentSummaryByOrder[arrayIndex].TotalChequePayment; tempEFT += tempPaymentSummaryByOrder[arrayIndex].TotalEFTPayment; tempVoucher += tempPaymentSummaryByOrder[arrayIndex].TotalVoucherPayment; tempDiscount += tempPaymentSummaryByOrder[arrayIndex].Discount; tempDeposite += tempPaymentSummaryByOrder[arrayIndex].TotalDepositePayment; tempTotal += tempPaymentSummaryByOrder[arrayIndex].TotalPayment; tempService += tempPaymentSummaryByOrder[arrayIndex].TotalServicePayment; tempAcc += tempPaymentSummaryByOrder[arrayIndex].TotalAccPayment; tempCashService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCash; tempChequeService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeCheque; tempEftService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeEft; tempAccservice += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeAcc; tempVoucherService += tempPaymentSummaryByOrder[arrayIndex].ServiceChargeVoucher; } } CashLabel.Text = (tempCash-tempCashService).ToString("F02"); EFTLabel.Text = (tempEFT-tempEftService).ToString("F02"); ChequeLabel.Text = (tempCheque-tempChequeService).ToString("F02"); AccLabel.Text = (tempAcc - tempAccservice).ToString("F02"); VoucherLabel.Text = tempVoucher.ToString("F02"); DiscountLabel.Text = tempDiscount.ToString("F02"); DepositLabel.Text = tempDeposite.ToString("F02"); TotalPayLabel.Text = tempTotal.ToString("F02"); lblGrossValue.Text = (tempTotal+tempService+tempDiscount+tempVoucher).ToString("F02"); lblNetSaleValue.Text = (tempTotal).ToString("F02"); lblCashService.Text = tempCashService.ToString("F02"); lblChequeService.Text = tempChequeService.ToString("F02"); lblEftService.Text = tempEftService.ToString("F02"); lblServiceAcc.Text = tempAccservice.ToString("F02"); lblServiceVoucher.Text = tempVoucherService.ToString("F02"); } else { CashLabel.Text = "0.000"; EFTLabel.Text = "0.000"; ChequeLabel.Text = "0.000"; VoucherLabel.Text = "0.000"; DiscountLabel.Text = "0.000"; DepositLabel.Text = "0.000"; TotalPayLabel.Text = "0.000"; lblGrossValue.Text = "0.000"; lblNetSaleValue.Text = "0.000"; lblServiceCharge.Text = "0.000"; lblCashService.Text = "0.000"; lblChequeService.Text = "0.000"; lblEftService.Text = "0.000"; lblServiceAcc.Text = "0.000"; lblServiceVoucher.Text = "0.000"; } } }
private CPaymentSummary ReaderToPaymentSummary(IDataReader oReader) { CPaymentSummary oPaymentSummary = new CPaymentSummary(); float tempTotalOtherPayment = 0; if (oReader["total"] != null) { float temp = 0; float.TryParse(oReader["total"].ToString(), out temp); oPaymentSummary.TotalPayment = temp; } if (oReader["cash_total"] != null) { float temp = 0; float.TryParse(oReader["cash_total"].ToString(), out temp); oPaymentSummary.TotalCashPayment = temp; } if (oReader["EFT_total"] != null) { float temp = 0; float.TryParse(oReader["EFT_total"].ToString(), out temp); oPaymentSummary.TotalEFTPayment = temp; } if (oReader["cheque_total"] != null) { float temp = 0; float.TryParse(oReader["cheque_total"].ToString(), out temp); oPaymentSummary.TotalChequePayment = temp; } if (oReader["voucher_total"] != null) { float temp = 0; float.TryParse(oReader["voucher_total"].ToString(), out temp); oPaymentSummary.TotalVoucherPayment = temp; } if (oReader["service_total"] != null) { float temp = 0; float.TryParse(oReader["service_total"].ToString(), out temp); oPaymentSummary.TotalServicePayment = temp; } if (oReader["deposit_total"] != null) { float temp = 0; float.TryParse(oReader["deposit_total"].ToString(), out temp); oPaymentSummary.TotalDepositPayment = temp; } return oPaymentSummary; }
public CResult GetTotalPaymentSummaryByPC(DateTime inCurrentDate, int inPCID) { CResult tempResult = new CResult(); GetTimeSpan(inCurrentDate); CPaymentSummary oPaymentSummary = new CPaymentSummary(); try { this.OpenConnection(); String sSql1 = String.Format(SqlQueries.GetQuery(Query.PaymentSummaryGetTotalByPC), m_oStartTime, m_oEndTime, inPCID); IDataReader oReader = this.ExecuteReader(sSql1); if (oReader != null) { while (oReader.Read()) { oPaymentSummary = ReaderToPaymentSummary(oReader); } } tempResult.Data = oPaymentSummary; tempResult.IsSuccess = true; } catch (Exception ex) { Logger.Write("Exception : " + ex + " in GetTotalPaymentSummaryByPC()", LogLevel.Error, "Database"); tempResult.IsException = true; if (ex.GetType().Equals(typeof(SqlException))) { SqlException oSQLEx = ex as SqlException; if (oSQLEx.Number != 7619) throw new Exception("Exception occured at GetTotalPaymentSummaryByPC()", ex); } else { throw new Exception("Exception occure at GetTotalPaymentSummary()", ex); } } finally { this.CloseConnection(); } return tempResult; }
private CPaymentSummary ReaderToPaymentSummary(IDataReader oReader) { CPaymentSummary oPaymentSummary = new CPaymentSummary(); float tempTotalOtherPayment = 0; if (oReader["total"] != null) oPaymentSummary.TotalPayment = float.Parse(oReader["total"].ToString()); if (oReader["cash_total"] != null) { oPaymentSummary.TotalCashPayment = float.Parse(oReader["cash_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalCashPayment; } if (oReader["EFT_total"] != null) { oPaymentSummary.TotalEFTPayment = float.Parse(oReader["EFT_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalEFTPayment; } if (oReader["cheque_total"] != null) { oPaymentSummary.TotalChequePayment = float.Parse(oReader["cheque_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalChequePayment; } if (oReader["voucher_total"] != null) { oPaymentSummary.TotalVoucherPayment = float.Parse(oReader["voucher_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalVoucherPayment; } if (oReader["service_total"] != null) { oPaymentSummary.TotalServicePayment = float.Parse(oReader["service_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalServicePayment; } if (oReader["discount_total"] != null) { oPaymentSummary.TotalDiscount = float.Parse(oReader["discount_total"].ToString()); } if (oReader["deposit_total"] != null) { oPaymentSummary.TotalDepositePayment = float.Parse(oReader["deposit_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalServicePayment; } if (oReader["guest_total"] != null) oPaymentSummary.GuestServedCount = int.Parse(oReader["guest_total"].ToString()); if (oReader["table_total"] != null) oPaymentSummary.TableServedCount = int.Parse(oReader["table_total"].ToString()); if (oPaymentSummary.TotalPayment != 0 && tempTotalOtherPayment < oPaymentSummary.TotalPayment) oPaymentSummary.TotalOtherPayment = oPaymentSummary.TotalPayment - tempTotalOtherPayment; return oPaymentSummary; }
public CPaymentSummaryDAO() { CPaymentSummary oPaymentSummary = new CPaymentSummary(); }
private void TillReportingButton_Click(object sender, EventArgs e) { try { CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data; CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT(); string serialHeader = "IBACS RMS"; string serialFooter = ""; string serialBody = ""; serialBody += " Till Report"; String DateString = "Date: " + DateTime.Now.ToLongDateString(); serialBody += "\r\n".PadRight((int)(45 - DateString.Length) / 2) + DateString + "\r\n\r\n"; CPaymentSummaryManager tempSummaryByOrderManager = new CPaymentSummaryManager(); List<CPaymentSummaryByOrder> tempSummaryByOrder = (List<CPaymentSummaryByOrder>)tempSummaryByOrderManager.GetTotalPaymentSummaryForViewReportByPC(DateTime.Now, tempPcInfo.PcID).Data; CPaymentSummaryByOrder[] tempSummaryByOrderArray = tempSummaryByOrder.ToArray(); serialBody += "SL Order Table Payment Total"; serialBody += "\r\n Type Number Type"; serialBody += "\r\n--- -------- ---- --------------- ------"; for (int i = 0; i < tempSummaryByOrderArray.Length; i++) { bool tempbool = false; float tempAccPayment = 0; float tempCashPayment = 0; float tempChequePayment = 0; float tempVoucherPayment = 0; float tempDiscount = 0; float tempDepositePayment = 0; float tempEFTPayment = 0; float tempServicePayment = 0; float.TryParse(tempSummaryByOrderArray[i].TotalAccPayment.ToString(), out tempAccPayment); float.TryParse(tempSummaryByOrderArray[i].TotalCashPayment.ToString(), out tempCashPayment); float.TryParse(tempSummaryByOrderArray[i].TotalChequePayment.ToString(), out tempChequePayment); float.TryParse(tempSummaryByOrderArray[i].TotalVoucherPayment.ToString(), out tempVoucherPayment); float.TryParse(tempSummaryByOrderArray[i].TotalDepositePayment.ToString(), out tempDepositePayment); float.TryParse(tempSummaryByOrderArray[i].TotalEFTPayment.ToString(), out tempEFTPayment); float.TryParse(tempSummaryByOrderArray[i].TotalServicePayment.ToString(), out tempServicePayment); float.TryParse(tempSummaryByOrderArray[i].Discount.ToString(), out tempDiscount); //Modified By Baruri on 30/07/2008 for discarding table number for take way. if (tempSummaryByOrderArray[i].OrderType.Trim().ToUpper().Replace(" ", "") == "Take Away".Trim().ToUpper().Replace(" ", "")) { serialBody += "\r\n" + ((int)(i + 1)).ToString().PadRight(3) + " " + (tempSummaryByOrderArray[i].OrderType.Trim()).PadRight(9, ' ') + " " + " ".PadRight(4, ' ') + " ";// +tempPayString.Trim().PadRight(13, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment; } else { serialBody += "\r\n" + ((int)(i + 1)).ToString().PadRight(3) + " " + (tempSummaryByOrderArray[i].OrderType.Trim()).PadRight(9, ' ') + " " + tempSummaryByOrderArray[i].TableNumber.ToString().PadRight(4, ' ') + " ";// +tempPayString.Trim().PadRight(13, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment; } if (tempCashPayment > 0) { string temp = "Cash:(" + tempCashPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempChequePayment > 0) { string temp = "Cheque(" + tempChequePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempVoucherPayment > 0) { string temp = "Voucher(" + tempVoucherPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempEFTPayment > 0) { string temp = "EFT(" + tempEFTPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempAccPayment > 0) { string temp = "ACC(" + tempAccPayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempServicePayment > 0) { string temp = "Sevice(" + tempServicePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempDiscount > 0) { string temp = "Discount(" + tempDiscount.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } if (tempDepositePayment > 0) { string temp = "Deposit(" + tempDepositePayment.ToString("F02") + ")"; if (!tempbool) { serialBody += temp.PadRight(15, ' ') + " " + tempSummaryByOrderArray[i].TotalPayment.ToString("F02") + "\r\n"; tempbool = true; } else { serialBody += " " + temp.PadRight(15, ' ') + "\r\n"; } } } CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByPC(DateTime.Now, tempPcInfo.PcID).Data; if (tempPayamentSummary != null) { serialBody += "\r\n\r\nCash Pay: " + tempPayamentSummary.TotalCashPayment; serialBody += "\r\nEFT Pay: " + tempPayamentSummary.TotalEFTPayment; // serialBody += "\r\nCheque Pay: " + tempPayamentSummary.TotalChequePayment; // serialBody += "\r\nVoucher Pay: " + tempPayamentSummary.TotalVoucherPayment; serialBody += "\r\nDiscount: " + tempPayamentSummary.TotalDiscount; serialBody += "\r\nDeposite Used: " + tempPayamentSummary.TotalDepositePayment; serialBody += "\r\n\r\nTotal Pay: " + tempPayamentSummary.TotalPayment; } // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, ""); tempPrintMethods.USBPrint(serialBody, PrintDestiNation.CLIENT, false); } catch (Exception exp) { MessageBox.Show(exp.Message); } }
private void CSystemManagementForm_Activated(object sender, EventArgs e) { try { CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data; CPaymentSummaryManager tempPaymentSummaryManager = new CPaymentSummaryManager(); CPaymentSummary tempPayamentSummary = new CPaymentSummary(); tempPayamentSummary = (CPaymentSummary)tempPaymentSummaryManager.GetTotalPaymentSummaryByPC(DateTime.Now, tempPcInfo.PcID).Data; if (tempPayamentSummary != null) PopulateSummaryDataGridView(tempPayamentSummary); PaymentSummaryDataGridView.Update(); // LoadGraph(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void PopulateSummaryDataGridView(CPaymentSummary inPaymentSummary) { try { string[] row1 = new string[] { "Total", ((float)(inPaymentSummary.TotalPayment)).ToString("F02") }; string[] row2 = new string[] { "Cash Paymnet", ((float)(inPaymentSummary.TotalCashPayment)).ToString("F02") }; string[] row3 = new string[] { "EFT Payment", ((float)(inPaymentSummary.TotalEFTPayment)).ToString("F02") }; string[] row4 = new string[] { "Cheque Payment", ((float)(inPaymentSummary.TotalChequePayment)).ToString("F02") }; string[] row5 = new string[] { "Voucher Payment", ((float)(inPaymentSummary.TotalVoucherPayment)).ToString("F02") }; string[] row6 = new string[] { "Deposit Payment", ((float)(inPaymentSummary.TotalDepositePayment)).ToString("F02") }; string[] row7 = new string[] { "Food Sales", ((float)(inPaymentSummary.PaymentFoodType)).ToString("F02") }; string[] row8 = new string[] { "Non Food Sales", ((float)(inPaymentSummary.PaymentNonFoodType)).ToString("F02") }; string[] row9 = new string[] { "Other Payments", ((float)(inPaymentSummary.TotalOtherPayment)).ToString("F02") }; string[] row10 = new string[] { "Tables Served", ((int)(inPaymentSummary.TableServedCount)).ToString() }; string[] row11 = new string[] { "Guests Served", ((int)(inPaymentSummary.GuestServedCount)).ToString() }; string[] row12 = new string[] { "Service Charge", ((float)(inPaymentSummary.TotalServicePayment)).ToString("F02") }; string[] row13 = new string[] { "Discount", ((float)(inPaymentSummary.TotalDiscount)).ToString("F02") }; object[] rows = new object[] { row1, row6, row2, row3, row4, row5, row7, row8, row9, row10, row11, row12, row13 }; PaymentSummaryDataGridView.Rows.Clear(); foreach (string[] rowArray in rows) { PaymentSummaryDataGridView.Rows.Add(rowArray); } PaymentSummaryDataGridView.AllowUserToResizeRows = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private CPaymentSummary ReaderToPaymentSummary(IDataReader oReader) { CPaymentSummary oPaymentSummary = new CPaymentSummary(); float tempTotalOtherPayment = 0; if (oReader["total"] != null) oPaymentSummary.TotalPayment = float.Parse(oReader["total"].ToString()); if (oReader["cash_total"] != null) { oPaymentSummary.TotalCashPayment = float.Parse(oReader["cash_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalCashPayment; } if (oReader["EFT_total"] != null) { oPaymentSummary.TotalEFTPayment = float.Parse(oReader["EFT_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalEFTPayment; } if (oReader["cheque_total"] != null) { oPaymentSummary.TotalChequePayment = float.Parse(oReader["cheque_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalChequePayment; } if (oReader["voucher_total"] != null) { oPaymentSummary.TotalVoucherPayment = float.Parse(oReader["voucher_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalVoucherPayment; } if (oReader["service_total"] != null) { oPaymentSummary.TotalServicePayment = float.Parse(oReader["service_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalServicePayment; } if (oReader["discount_total"] != null) { oPaymentSummary.TotalDiscount = float.Parse(oReader["discount_total"].ToString()); } if (oReader["deposit_total"] != null) { oPaymentSummary.TotalDepositePayment = float.Parse(oReader["deposit_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalServicePayment; } if (oReader["acc_total"] != null) { oPaymentSummary.TotalAccPayment = float.Parse(oReader["acc_total"].ToString()); tempTotalOtherPayment += oPaymentSummary.TotalAccPayment; } if (oReader["guest_total"] != null) oPaymentSummary.GuestServedCount = int.Parse(oReader["guest_total"].ToString()); if (oReader["table_total"] != null) oPaymentSummary.TableServedCount = int.Parse(oReader["table_total"].ToString()); //This portion is for service charge break down if (oReader["total_cash"] != null) oPaymentSummary.ServiceChargeCash = double.Parse(oReader["total_cash"].ToString()); if (oReader["total_cheque"] != null) oPaymentSummary.ServiceChargeCheque = double.Parse(oReader["total_cheque"].ToString()); if (oReader["total_voucher"] != null) oPaymentSummary.ServiceChargeVoucher = double.Parse(oReader["total_voucher"].ToString()); if (oReader["total_acc"] != null) oPaymentSummary.ServiceChargeAcc = double.Parse(oReader["total_acc"].ToString()); if (oReader["total_eft"] != null) oPaymentSummary.ServiceChargeEft = double.Parse(oReader["total_eft"].ToString()); if (oPaymentSummary.TotalPayment != 0 && tempTotalOtherPayment < oPaymentSummary.TotalPayment) oPaymentSummary.TotalOtherPayment = oPaymentSummary.TotalPayment - tempTotalOtherPayment; return oPaymentSummary; }