Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        private void ViewButton_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 tempSummaryByOrderManager = new CPaymentSummaryManager();
                List<CPaymentSummaryByOrder> tempSummaryByOrder = (List<CPaymentSummaryByOrder>)tempSummaryByOrderManager.GetTotalPaymentSummaryForViewReport(tempCurrentDate).Data;
                ViewReportDataGridView.Rows.Clear();

                if (tempSummaryByOrder != null)
                {
                    PopulateViewReportDataGridView(tempSummaryByOrder);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 3
0
        public void PopulateViewReportDataGridView()
        {
            ReferenceTextBox.Clear();
            ReferenceCheckBox.Checked = false;
            PriceTextBox.Clear();
            PriceCheckBox.Checked = false;
            TableNoTextBox.Clear();
            checkBox2.Checked = false;
            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 tempSummaryByOrderManager = new CPaymentSummaryManager();
                List<CPaymentSummaryByOrder> inSummaryByOrder = (List<CPaymentSummaryByOrder>)tempSummaryByOrderManager.GetTotalPaymentSummaryForViewReport(tempCurrentDate).Data;
                ViewReportDataGridView.Rows.Clear();

                if (inSummaryByOrder != null)
                {
                    CPaymentSummaryByOrder[] tempPaymentSummaryByOrder = inSummaryByOrder.ToArray();

                    for (int orderIndex = 0; orderIndex < tempPaymentSummaryByOrder.Length; orderIndex++)
                    {
                        int sl = orderIndex + 1;
                        String tempPayString = "";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalCashPayment > 0) tempPayString += "CSH(" + tempPaymentSummaryByOrder[orderIndex].TotalCashPayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalChequePayment > 0) tempPayString += "CHQ(" + tempPaymentSummaryByOrder[orderIndex].TotalChequePayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalVoucherPayment > 0) tempPayString += "VOU(" + tempPaymentSummaryByOrder[orderIndex].TotalVoucherPayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalEFTPayment > 0) tempPayString += "EFT(" + tempPaymentSummaryByOrder[orderIndex].TotalEFTPayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalAccPayment > 0) tempPayString += "ACC(" + tempPaymentSummaryByOrder[orderIndex].TotalAccPayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalServicePayment > 0) tempPayString += "SRV(" + tempPaymentSummaryByOrder[orderIndex].TotalServicePayment.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].Discount > 0) tempPayString += "DIS(" + tempPaymentSummaryByOrder[orderIndex].Discount.ToString("F02") + ") ";
                        if (tempPaymentSummaryByOrder[orderIndex].TotalDepositePayment > 0) tempPayString += "DEP(" + tempPaymentSummaryByOrder[orderIndex].TotalDepositePayment.ToString("F02") + ") ";

                        String[] tempString ={ tempPaymentSummaryByOrder[orderIndex].OrderID.ToString(), sl.ToString(), tempPaymentSummaryByOrder[orderIndex].OrderType, tempPaymentSummaryByOrder[orderIndex].TableNumber.ToString(), tempPayString, (tempPaymentSummaryByOrder[orderIndex].TotalPayment+tempPaymentSummaryByOrder[orderIndex].TotalServicePayment).ToString("F02"), "Void" };

                        ViewReportDataGridView.Rows.Add(tempString);
                    }

                    for (int rowIndex = 0; rowIndex < ViewReportDataGridView.RowCount; rowIndex++)
                    {
                        if (tempViewType == 0)
                        {
                            ViewReportDataGridView.Rows[rowIndex].Visible = true;
                        }
                        else if (tempViewType == 1 && !tempPaymentSummaryByOrder[rowIndex].OrderType.Equals("Table"))
                        {
                            ViewReportDataGridView.Rows[rowIndex].Visible = false;
                        }
                        else if (tempViewType == 2 && !tempPaymentSummaryByOrder[rowIndex].OrderType.Equals("TakeAway"))
                        {
                            ViewReportDataGridView.Rows[rowIndex].Visible = false;
                        }
                        else if (tempViewType == 3 && !tempPaymentSummaryByOrder[rowIndex].OrderType.Equals("Tabs"))
                        {
                            ViewReportDataGridView.Rows[rowIndex].Visible = false;
                        }
                        else if (tempViewType == 4 && !tempPaymentSummaryByOrder[rowIndex].OrderType.Equals("Deposit"))
                        {
                            ViewReportDataGridView.Rows[rowIndex].Visible = false;
                        }
                    }

                    m_oViewed = true;
                    tempSearch = false;
                    LabelPayTextLabels("", "", "");
                }
                if (ViewReportDataGridView.RowCount < 15)
                {
                    ViewReportDataGridView.RowCount = 15;
                }

            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }