Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }