public DialogResult OnEnterPress() { string password = passwordFiled.Text; CUserManager tempUserManager = new CUserManager(); CUserInfo tempUserInfo = new CUserInfo(); CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>(); tempUserInfo = (CUserInfo)tempUserManager.GetUserInfoByUsername(CCurrentUser.User_name).Data; CLogin oLogin = new CLogin(); CUserInfo oUserInfo = new CUserInfo(); CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data; oUserInfo.UserName = CCurrentUser.User_name; RMSGlobal.LoginUserName = CCurrentUser.User_name; RMSGlobal.m_iLoginUserID = tempUserInfo.UserID; oUserInfo.Password = password; oUserInfo.PCID = tempPcInfo.PcID; RMSGlobal.m_connectionString = oConstant.DBConnection; oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL); CResult oResult = oLogin.ProcessLogin(oUserInfo); if (oResult.IsSuccess && oResult.Data != null) { CUserLogin oUserLogin = (CUserLogin)oResult.Data; oConstant.UserInfo = oUserLogin.UserInfo; lblErrorMessage.Hide(); } else { string tempStr = oResult.Message; if (!tempStr.Equals(String.Empty)) { lblErrorMessage.Text = tempStr; } lblErrorMessage.Show(); return DialogResult.None; } CCurrentUser.User_id = tempUserInfo.UserID; CCurrentUser.Type = tempUserInfo.Type; passwordFiled.Clear(); return DialogResult.OK; }
private void SaveButton_Click(object sender, EventArgs e) { try { CDepositManager tempDepositManager = new CDepositManager(); CDeposit tempDeposit = new CDeposit(); Double tempCash = 0.000; Double tempEFT = 0.000; Double tempCheque = 0.000; Double tempAccount = 0.000; Double tempTotal = 0.000; Double.TryParse(g_CashLabel.Text.Substring(1), out tempCash); Double.TryParse(g_EFTLabel.Text.Substring(1), out tempEFT); Double.TryParse(g_ChequeLabel.Text.Substring(1), out tempCheque); Double.TryParse(g_AccountLabel.Text.Substring(1), out tempAccount); Double.TryParse(g_DepositTotalLabel.Text.Substring(1), out tempTotal); if (tempTotal == 0) { MessageBox.Show("Zero amount given for deposit. Please recheck", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tempDeposit.DepositBalance = tempTotal; tempDeposit.DepositTime = DateTime.Now.Ticks; tempDeposit.CustomerID=m_iCustomerID; tempDeposit.DepositTotalAmount = tempTotal; tempDeposit.DepositType = m_sDepositType; tempDeposit.Status = 1; CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo=new CPcInfo(); CResult oResult= tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); if (oResult.IsSuccess && oResult.Data != null) { tempPcInfo = (CPcInfo)oResult.Data; } tempDeposit.PcID = tempPcInfo.PcID; oResult = tempDepositManager.InsertDeposit(tempDeposit); if (oResult.IsSuccess && oResult.Data != null) { tempDeposit = (CDeposit)oResult.Data; } //get customer name & phone CCustomerManager tempCustomerManager= new CCustomerManager(); CCustomerInfo tempCustomerInfo= new CCustomerInfo(); oResult = tempCustomerManager.CustomerInfoGetByCustomerID(m_iCustomerID); if(oResult.IsSuccess && oResult.Data!=null) { tempCustomerInfo = (CCustomerInfo)oResult.Data; } //string serialBody = "\r\n Deposit Token\r\n"; //serialBody += "\r\n Customer Name: "+tempCustomerInfo.CustomerName; //serialBody += "\r\n Phone: " + tempCustomerInfo.CustomerPhone+"\r\n"; //serialBody += "\r\n By " + tempDeposit.DepositType; //serialBody += "\r\n---------------------------------"; //serialBody += "\r\n Total: " + tempDeposit.DepositBalance.ToString("F02"); //serialBody += "\r\n"; //serialBody += "\r\nS/N: " + tempDeposit.DepositID.ToString(); string serialBody = "\r\n Deposit Token\r\n"; DateTime tempODate = new DateTime(tempDeposit.DepositTime); string tempODateString = "Deposit Date: " + tempODate.ToLongDateString(); serialBody += "".PadRight((int)((45 - tempODateString.Length) / 2), ' ') + tempODateString.Trim() + "\r\n"; string tempDateString = "Reprint Date: " + DateTime.Now.ToLongDateString(); serialBody += "".PadRight((int)((45 - tempDateString.Length) / 2), ' ') + tempDateString.Trim() + "\r\n\r\n"; serialBody += "Customer Name: " + tempCustomerInfo.CustomerName + "\r\n"; string tempAddressString = "Customer Address: " + tempCustomerInfo.CustomerAddress.Trim(); if (tempAddressString.Length > 40) { tempAddressString = tempAddressString.Substring(0, 40) + "\r\n".PadRight(19, ' ') + tempAddressString.Substring(40); } serialBody += tempAddressString + "\r\n"; serialBody += "Phone: " + tempCustomerInfo.CustomerPhone + "\r\n\r\n"; serialBody += "Deposit Type: " + tempDeposit.DepositType + "\r\n"; serialBody += "Deposited Amount: " + tempDeposit.DepositTotalAmount.ToString("F02") + "\r\n"; double tempDepositUsed = (tempDeposit.DepositTotalAmount - tempDeposit.DepositBalance); serialBody += "Deposit Used: " + tempDepositUsed.ToString("F02") + "\r\n"; serialBody += "---------------------------------\r\n"; serialBody += "Total Balance: " + tempDeposit.DepositBalance.ToString("F02") + "\r\n\r\n"; serialBody += "S/N: " + tempDeposit.DepositID.ToString() + "\r\n"; CPrintMethods tempPrintMethods = new CPrintMethods(); tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER,"",serialBody,"",tempDeposit.DepositID.ToString()); this.Close(); } catch (Exception eee) { } }
private void PrintBeverageVoidItems() { string Cat1ID = String.Empty; bool itemAvailable = false; try { StringPrintFormater strPrintFormatter = new StringPrintFormater(29); int papersize = 29; CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT(); string serialHeader = ""; string serialFooter = ""; COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_orderID).Data; List<CSerialPrintContent> serialBody = new List<CSerialPrintContent>(); CSerialPrintContent tempSerialPrintContent = new CSerialPrintContent(); if ("Table" == tempOrderInfo.OrderType) { //tempSerialPrintContent = new CSerialPrintContent(); //tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); //serialBody.Add(tempSerialPrintContent); //tempSerialPrintContent = new CSerialPrintContent(); //tempSerialPrintContent.StringLine = "Print Date:" + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt"); //serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "\r\n\r\nTable No:" + tempOrderInfo.TableNumber.ToString() + "\r\n"; tempSerialPrintContent.Bold = true; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "COVERS:" + tempOrderInfo.GuestCount.ToString() + "\r\n"; tempSerialPrintContent.Bold = true; serialBody.Add(tempSerialPrintContent); } tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = " Void Beverages/Non-Foods\n"; serialBody.Add(tempSerialPrintContent); if ("Table" == tempOrderInfo.OrderType) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Print Date:" + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt"); serialBody.Add(tempSerialPrintContent); //tempSerialPrintContent = new CSerialPrintContent(); //tempSerialPrintContent.StringLine = "Table No:" + tempOrderInfo.TableNumber.ToString() + "\r\n"; //tempSerialPrintContent.Bold = true; //serialBody.Add(tempSerialPrintContent); //tempSerialPrintContent = new CSerialPrintContent(); //tempSerialPrintContent.StringLine = "COVERS:" + tempOrderInfo.GuestCount.ToString() + "\r\n"; //tempSerialPrintContent.Bold = true; //serialBody.Add(tempSerialPrintContent); } else if ("TakeAway" == tempOrderInfo.OrderType) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Order Date: " + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Print Date: " + System.DateTime.Now.ToString("dd/MM/yy hh:mm tt"); serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Type: " + tempOrderInfo.Status; serialBody.Add(tempSerialPrintContent); CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data; tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Customer Name: " + tempCustomerInfo.CustomerName; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Phone:" + tempCustomerInfo.CustomerPhone; serialBody.Add(tempSerialPrintContent); if (tempOrderInfo.Status.Equals("Delivery")) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Address:"; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "----------------------------------------"; serialBody.Add(tempSerialPrintContent); if (tempCustomerInfo.FloorAptNumber.Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Floor or Apartment:" + tempCustomerInfo.FloorAptNumber; serialBody.Add(tempSerialPrintContent); } if (tempCustomerInfo.BuildingName.Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Building Name:" + tempCustomerInfo.BuildingName; serialBody.Add(tempSerialPrintContent); } if (tempCustomerInfo.HouseNumber.Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "House Number:" + tempCustomerInfo.HouseNumber; serialBody.Add(tempSerialPrintContent); } string[] street = new string[0]; street = tempCustomerInfo.StreetName.Split('-'); if (street.Length > 1) { if (street[0].ToString().Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Street:" + street[0].ToString(); serialBody.Add(tempSerialPrintContent); } if (street[1].ToString().Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = street[1].ToString(); serialBody.Add(tempSerialPrintContent); } } else if (street.Length > 0 && street.Length < 2) { if (street[0].ToString().Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Street:" + street[0].ToString(); serialBody.Add(tempSerialPrintContent); } } if (tempCustomerInfo.CustomerPostalCode.Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Postal Code:" + tempCustomerInfo.CustomerPostalCode; serialBody.Add(tempSerialPrintContent); } if (tempCustomerInfo.CustomerTown.Length > 0) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Town:" + tempCustomerInfo.CustomerTown; serialBody.Add(tempSerialPrintContent); } tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "----------------------------------------"; serialBody.Add(tempSerialPrintContent); CDelivery objDelivery = new CDelivery(); objDelivery.DeliveryOrderID = m_orderID; CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery); objDelivery = (CDelivery)objDeliveryInfo.Data; if (objDelivery != null) { tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "\r\nDelivery Time:" + objDelivery.DeliveryTime; serialBody.Add(tempSerialPrintContent); } } } tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Order Information"; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "----------------------------------------"; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Item Qty"; serialBody.Add(tempSerialPrintContent); tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "----------------------------------------"; serialBody.Add(tempSerialPrintContent); Hashtable htOrderedItems = new Hashtable(); string categoryOrder = String.Empty; PrintUtility printUtility = new PrintUtility(); foreach(ListViewItem lsvItem in lsvRemovable.Items) { if (lsvItem.SubItems[5].Text.ToString().Replace(" ", "").ToUpper() == "NonFood".Replace(" ", "").ToUpper()) { tempSerialPrintContent = new CSerialPrintContent(); // tempSerialPrintContent.StringLine = "(Void)" + lsvItem.Text.ToString() + " "; // tempSerialPrintContent.StringLine += CPrintMethods.GetFixedString(lsvItem.SubItems[1].Text.ToString(), 30); tempSerialPrintContent.StringLine = strPrintFormatter.ItemLabeledText( printUtility.MultipleLine("(Void)" + lsvItem.Text + " ", papersize - 5, lsvItem.SubItems[1].Text.ToString(), papersize), ""); serialBody.Add(tempSerialPrintContent); itemAvailable = true; // tempSerialPrintContent.StringLine += // strPrintFormatter.ItemLabeledText( // printUtility.MultipleLine(objReport.ItemName.ToString(), papersize - 32, priceString, papersize), ""); } } tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "----------------------------------------"; serialBody.Add(tempSerialPrintContent); //New at 22.08.2008 tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = "Order Prepared By :" + RMSGlobal.LoginUserName; serialBody.Add(tempSerialPrintContent); CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult objResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (objResult.IsSuccess && objResult.Data != null) { tempPcInfo = (CPcInfo)objResult.Data; } tempSerialPrintContent = new CSerialPrintContent(); tempSerialPrintContent.StringLine = tempPcInfo.Name.Trim(); serialBody.Add(tempSerialPrintContent); if (itemAvailable == true) //If there is items for printing { for (int printCopy = 0; printCopy < m_barPrintedCopy; printCopy++) { // tempPrintMethods.SerialPrint(PRINTER_TYPES.NORMAL_PRINTER, serialHeader, serialBody, serialFooter, tempOrderInfo.SerialNo.ToString()); } string printingObject = ""; //Write to the text file for (int arrayIndex = 0; arrayIndex < serialBody.Count; arrayIndex++) { printingObject += serialBody[arrayIndex].StringLine.ToString() + "\r\n"; } tempPrintMethods.USBPrint(printingObject, PrintDestiNation.BEVARAGE, false); this.WriteString(printingObject);///Write to a file when print command is executed } } catch (Exception exp) { MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void KitchenPrintVoidCopy() { Hashtable htOrderedItems = new Hashtable(); bool itemAvailable = false; try { CPrintMethodsEXT tempPrintMethods = new CPrintMethodsEXT(); CCommonConstants oConstant = ConfigManager.GetConfig<CCommonConstants>(); COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(m_orderID); COrderInfo tempOrderInfo = new COrderInfo(); StringPrintFormater strPrintFormatter = new StringPrintFormater(29); int papersize = 29; if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } string serialHeader = ""; string serialFooter = ""; string serialBody = ""; if ("Table" == tempOrderInfo.OrderType) { serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString(); serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); } serialBody += "\r\n Kitchen Copy"; if (!tempOrderInfo.Status.Equals("Seated") && "Table"== tempOrderInfo.OrderType) { serialBody += "\r\nReprint"; } serialBody += "\r\n\r\nOrdered Date:" + tempOrderInfo.OrderTime.ToString("dd/MM/yy hh:mm tt"); serialBody += "\r\nPrint Date: " + DateTime.Now.ToString("dd/MM/yy hh:mm tt"); if ("Table" == tempOrderInfo.OrderType) { //serialBody += "\r\n\r\nTable NO:" + tempOrderInfo.TableNumber.ToString(); //serialBody += "\r\nCovers:" + tempOrderInfo.GuestCount.ToString(); } else if ("TakeAway" == tempOrderInfo.OrderType) { serialBody += "\r\n\r\n Take Away"; serialBody += "\r\n Type: " + tempOrderInfo.Status; CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerInfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(tempOrderInfo.CustomerID).Data; serialBody += "\r\n Customer Name: " + tempCustomerInfo.CustomerName; serialBody += "\r\nPhone:" + tempCustomerInfo.CustomerPhone; if (tempOrderInfo.Status.Equals("Delivery")) { serialBody += "\r\nAddress:"; if (tempCustomerInfo.FloorAptNumber.Length > 0) { serialBody += "\r\nFloor or Apartment:" + tempCustomerInfo.FloorAptNumber; } if (tempCustomerInfo.BuildingName.Length > 0) { serialBody += "\r\nBuilding Name:" + tempCustomerInfo.BuildingName; } if (tempCustomerInfo.HouseNumber.Length > 0) { serialBody += "\r\nHouse Number:" + tempCustomerInfo.HouseNumber; } string[] street = new string[0]; street = tempCustomerInfo.StreetName.Split('-'); if (street.Length > 1) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } if (street[1].ToString().Length > 0) { serialBody += "\r\n" + street[1].ToString(); } } else if (street.Length > 0 && street.Length < 2) { if (street[0].ToString().Length > 0) { serialBody += "\r\nStreet:" + street[0].ToString(); } } if (tempCustomerInfo.CustomerPostalCode.Length > 0) { serialBody += "\r\nPostal Code:" + tempCustomerInfo.CustomerPostalCode; } if (tempCustomerInfo.CustomerTown.Length > 0) { serialBody += "\r\nTown:" + tempCustomerInfo.CustomerTown; } serialBody += "\r\n----------------------------------------"; CDelivery objDelivery = new CDelivery(); objDelivery.DeliveryOrderID = m_orderID; CResult objDeliveryInfo = tempOrderManager.GetDeliveryInfo(objDelivery); objDelivery = (CDelivery)objDeliveryInfo.Data; serialBody += "\r\nDelivery Time:" + objDelivery.DeliveryTime; } } serialBody += "\r\n\r\nOrder Information"; serialBody += "\r\n---------------------------------"; serialBody += "\r\n Item Qty"; serialBody += "\r\n---------------------------------"; PrintUtility printUtility = new PrintUtility(); foreach (ListViewItem lsvItem in lsvRemovable.Items) { if (lsvItem.SubItems[5].Text.Replace(" ", "").ToUpper() == "Food".Replace(" ", "").ToUpper()) { // serialBody += "\r\n(Void)" + CPrintMethods.GetFixedString(lsvItem.Text, 20) + " "; // serialBody += lsvItem.SubItems[0].Text; itemAvailable = true; serialBody += "\r\n" + strPrintFormatter.ItemLabeledText( printUtility.MultipleLine("(Void)" + lsvItem.Text + " ", papersize - 5, lsvItem.SubItems[1].Text.ToString(), papersize), ""); } } serialBody += "\r\n---------------------------------"; serialBody += "\r\nOrder Prepared By:" + RMSGlobal.LoginUserName; CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult objResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (objResult.IsSuccess && objResult.Data != null) { tempPcInfo = (CPcInfo)objResult.Data; } serialBody += "\r\nTerminal Name:" + tempPcInfo.Name; serialBody += "\r\n\r\n [ E N D ]\r\n\r\n"; CPrintingFormat tempPrintingFormat = new CPrintingFormat(); tempPrintingFormat.Header = serialHeader; tempPrintingFormat.Body = serialBody.ToUpper(); tempPrintingFormat.Footer = serialFooter; tempPrintingFormat.OrderID = m_orderID; tempPrintingFormat.PrintType = (int)PRINTER_TYPES.Serial; if (itemAvailable == true) { CLogin oLogin = new CLogin(); oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oConstant.RemoteURL); for (int printCopy = 0; printCopy < m_printedCopy; printCopy++) { // oLogin.PostPrintingRequest(tempPrintingFormat); tempPrintMethods.USBPrint(serialBody, PrintDestiNation.KITCHEN, false); } this.WriteString(serialBody);//Writing to the specified file } } catch (Exception exp) { throw exp; } }
private void CTableOrderForm_Activated(object sender, EventArgs e) { try { CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult oResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempPcInfo = (CPcInfo)oResult.Data; } m_TerminalName = "Terminal Name:" + tempPcInfo.Name; this.SetPrintedItemBackColor(); } catch (Exception exp) { Console.Write(exp.Message); } }
private void g_CashButton_Click(object sender, EventArgs e) { try { Double tempTotal = Double.Parse(g_BalanceLabel.Text); Double tempInput = Double.Parse(g_InputTextBox.Text.Substring(1)); if (tempTotal > tempInput) { CMessageBox tempMessageBox = new CMessageBox("Error", "Paid Amount less than Balance Amount."); tempMessageBox.ShowDialog(); return; } CPaymentManager tempPaymentManager = new CPaymentManager(); ///insert into payment table CPayment tempPayment = new CPayment(); tempPayment.OrderID = orderID; //get pc id from pc ip CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult oResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempPcInfo = (CPcInfo)oResult.Data; } tempPayment.PcID = tempPcInfo.PcID; tempPayment.TotalAmount = Double.Parse(g_BalanceLabel.Text); tempPayment.CashAmount = tempPayment.TotalAmount; tempPayment.PaymentTime = System.DateTime.Now; oResult = tempPaymentManager.InsertPayment(tempPayment); if (oResult.IsSuccess && oResult.Data != null) { tempPayment = (CPayment)oResult.Data; } ////update order info status COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(orderID).Data; //tempOrderInfo.Status = "Paid"; //tempOrderManager.UpdateOrderInfo(tempOrderInfo); //opening cash drawer try { CPrintMethods tempPrintMethods = new CPrintMethods(); tempPrintMethods.OpenDrawer(); } catch (Exception eee) { } //archiving tempOrderManager.InsertOrderArchive(tempOrderInfo); tempOrderManager.InsertOrderDetailsArchive(tempOrderInfo); tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Tabs"); Reload(); } catch (Exception eee) { } }
private void UpdateCalculation(int paymentMethodIndex) { try { Double tempTotalPaid = 0.0; Debug.WriteLine("UpdateCalc 1"); tempTotalPaid += Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length)) + Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)) + Double.Parse(complementorylabel.Text.Substring(Program.currency.Length)); Debug.WriteLine("UpdateCalc 2"); Double tempBillTotal = m_dTotalAmount + Convert.ToDouble("0" + g_ServiceChargeLabel.Text.Substring(Program.currency.Length)); Debug.WriteLine("UpdateCalc 3"); Double tempDifference = tempBillTotal - tempTotalPaid; Debug.WriteLine("UpdateCalc 4"); if (tempDifference > 0) { m_dBalance = tempDifference; g_BalaceLabel.Text = String.Format("Balance Due {0}" + m_dBalance.ToString("F02"), Program.currency); Debug.WriteLine("UpdateCalc 5"); } else { if (CurrentPaymentMethod.Equals("Cash")) { if (m_isAddServiceCharge == false) { g_CashLabel.Text = Program.currency + m_dBalance.ToString("F02"); } } else if (CurrentPaymentMethod.Equals("EFT")) { if (m_isAddServiceCharge == false) { g_EFTLabel.Text = Program.currency + m_dBalance.ToString("F02"); } } else if (CurrentPaymentMethod.Equals("Due")) { if (m_isAddServiceCharge == false) { g_ChequeLabel.Text = Program.currency + m_dBalance.ToString("F02"); } } else if (CurrentPaymentMethod.Equals("Voucher")) { if (m_isAddServiceCharge == false) { g_VoucherLabel.Text = Program.currency + m_dBalance.ToString("F02"); } } else if (CurrentPaymentMethod.Equals("Account")) { if (m_isAddServiceCharge == false) { g_AccountLabel.Text = Program.currency + m_dBalance.ToString("F02"); } } else if (CurrentPaymentMethod.Equals("Discount")) { g_DiscountLabel.Text = Program.currency + m_dBalance.ToString("F02"); } else if (CurrentPaymentMethod.Equals("Deposit")) { g_DepositUsedLabel.Text = Program.currency + m_dBalance.ToString("F02"); } else if (CurrentPaymentMethod.Equals("Complementory")) { if (m_isAddServiceCharge == false) { complementorylabel.Text = Program.currency + m_dBalance.ToString("F02"); } } Debug.WriteLine("UpdateCalc 6"); m_dBalance = -tempDifference; g_BalaceLabel.Text = "Pay Back " + Program.currency + (m_dBalance-tipsamount).ToString("F02"); Debug.WriteLine("UpdateCalc 7"); CPaymentManager tempPaymentManager = new CPaymentManager(); /***********************/ /********New Print******/ /***********************/ if (isCheatManuallyhandled()) { DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo); if (dresult == DialogResult.Yes) { makeOpen = true; } if (dresult == DialogResult.No) { makeOpen = false; } } DataSet tempDataSet = new DataSet(); tempDataSet.ReadXml("Config/Print_Config.xml"); if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true")) { Debug.WriteLine("UpdateCalc 17"); PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3 } COrderManager temmpOrderManager = new COrderManager(); COrderDiscount tempOrderDiscount = new COrderDiscount(); CResult ooResult = temmpOrderManager.OrderDiscountGetByOrderID(m_iOrderID); double itemDiscount = 0; if (ooResult.IsSuccess && ooResult.Data != null) { tempOrderDiscount = (COrderDiscount) ooResult.Data; itemDiscount = tempOrderDiscount.TotalItemDiscount; } //Check whether payment data exists if (m_cPayment == null) { Debug.WriteLine("UpdateCalc 8"); ///insert into payment table CPayment tempPayment = new CPayment(); tempPayment.OrderID = m_iOrderID; //get pc id from pc ip CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data; tempPayment.PcID = tempPcInfo.PcID; Debug.WriteLine("UpdateCalc 9"); tempPayment.TotalAmount = m_dTotalAmount; tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)); tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)); tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length)); tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount; //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length)); tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length)); tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length)); tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)); tempPayment.DepositID = m_oDeposit.DepositID; tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length)); tempPayment.PaymentTime = System.DateTime.Now; tempPayment.ServiceChargeCash = m_serviceCharge_cash; tempPayment.ServiceChargeCheque = m_serviceCharge_cheque; tempPayment.ServiceChargeEft = m_serviceCharge_eft; tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher; tempPayment.ServiceChargeAcc = m_serviceCharge_accounts; tempPayment.DueMessage = dueMessage; tempPayment.ComplementoryMessage = complementoryMessage; double totalCost = GetTotalCost(m_iOrderID); tempPayment.TotalCost = totalCost; tempPayment.TipsAmount = tipsamount; tempPayment.VatImposed = Program.vat.ToString(); tempPayment.membershipDiscount = (double)membershipdiscount; tempPayment.ItemDiscount = itemDiscount; //tempPayment.VatImposed = Program.vat.ToString(); tempPayment.GuestBill = gusetBillStr; COrderWaiterDao orderWaiterDao = new COrderWaiterDao(); // Change by Mithu COrderwaiter orderWaiter = orderWaiterDao.GetOrderwaiterByOrderID(m_iOrderID); // Change by Mithu try { tempPayment.Waiter = orderWaiter.WaiterName; } catch (Exception) { } if (makeOpen) tempPayment.Vat_stat = true; else tempPayment.Vat_stat = false; tempPayment.PaymentPerson = RMSGlobal.LoginUserName; DataSet tempStockDataSet = new DataSet(); tempStockDataSet.ReadXml("Config/StockSetting.xml"); bool isAllowedToOrder = Convert.ToBoolean(tempStockDataSet.Tables[0].Rows[0]["AllowedtoOrder"].ToString()); if (!isAllowedToOrder) { COrderDetailsDAO aDao = new COrderDetailsDAO(); List<COrderDetails> aList = new List<COrderDetails>(); double cost = 0.0; try { aList = aDao.OrderDetailsGetAll(); var check = from list in aList where list.OrderID == tempPayment.OrderID select list; SaleReportDAO aSaleReportDao = new SaleReportDAO(); aSaleReportDao.InsertOrUpdateSaleRawmaterialsReport(check); } catch { } } CResult oResult = tempPaymentManager.InsertPayment(tempPayment); if (oResult.IsSuccess && oResult.Data != null) { tempPayment = (CPayment)oResult.Data; m_cPayment = tempPayment; Debug.WriteLine("UpdateCalc 10"); } } else { Debug.WriteLine("UpdateCalc 11"); //update payment table CPayment tempPayment = new CPayment(); tempPayment.PaymentID = m_cPayment.PaymentID; tempPayment.OrderID = m_iOrderID; tempPayment.TotalAmount = m_dTotalAmount; tempPayment.CashAmount = Double.Parse(g_CashLabel.Text.Substring(Program.currency.Length)); tempPayment.EFTAmount = Double.Parse(g_EFTLabel.Text.Substring(Program.currency.Length)); tempPayment.ChequeAmount = Double.Parse(g_ChequeLabel.Text.Substring(Program.currency.Length)); tempPayment.ServiceAmount = m_serviceCharge_cash + m_serviceCharge_voucher + m_serviceCharge_eft + m_serviceCharge_cheque + m_serviceCharge_accounts - tipsamount; //Double.Parse(g_ServiceChargeLabel.Text.Substring(Program.currency.Length)); tempPayment.VoucherAmount = Double.Parse(complementorylabel.Text.Substring(Program.currency.Length)); tempPayment.Discount = Double.Parse(g_DiscountLabel.Text.Substring(Program.currency.Length)); tempPayment.AccountPay = Double.Parse(g_AccountLabel.Text.Substring(Program.currency.Length)); tempPayment.DepositID = m_oDeposit.DepositID; tempPayment.DepositAmount = Double.Parse(g_DepositUsedLabel.Text.Substring(Program.currency.Length)); tempPayment.PaymentTime = System.DateTime.Now; tempPayment.ServiceChargeCash = m_serviceCharge_cash; tempPayment.ServiceChargeCheque = m_serviceCharge_cheque; tempPayment.ServiceChargeEft = m_serviceCharge_eft; tempPayment.ServiceChargeVoucher = m_serviceCharge_voucher; tempPayment.ServiceChargeAcc = m_serviceCharge_accounts; tempPayment.VatImposed = Program.vat.ToString(); tempPayment.TipsAmount = tipsamount; tempPayment.GuestBill = gusetBillStr; tempPayment.membershipDiscount = (double)membershipdiscount; tempPayment.ItemDiscount = itemDiscount; //tempPayment.DueMessage = dueMessage; //tempPayment.ComplementoryMessage = complementoryMessage; if (isCheatManuallyhandled()) { DialogResult dresult = MessageBox.Show("Make It Open?", "Message", MessageBoxButtons.YesNo); if (dresult == DialogResult.Yes) { makeOpen = true; } if (dresult == DialogResult.No) { makeOpen = false; } } if (makeOpen) tempPayment.Vat_stat = true; else tempPayment.Vat_stat = false; tempPayment.PaymentPerson = RMSGlobal.LoginUserName; tempPaymentManager.UpdatePayment(tempPayment); m_cPayment = tempPayment; Debug.WriteLine("UpdateCalc 12"); } //Update Deposit CDepositManager tempDepositManager = new CDepositManager(); tempDepositManager.UpdateDeposit(m_oDeposit); //opening cash drawer try { CPrintMethods tempPrintMethods = new CPrintMethods(); tempPrintMethods.OpenDrawer(); #region "Tracking Area" CCommonConstants m_oCommonConstants; //Drawer Opening log DateTime dtPayment = DateTime.Now; dtPayment = new DateTime(dtPayment.Year, dtPayment.Month, dtPayment.Day, dtPayment.Hour, dtPayment.Minute, dtPayment.Second); Int64 dateTime = dtPayment.Ticks; m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); CUserInfo objUserInfo = m_oCommonConstants.UserInfo; tempPaymentManager.SaveDrawerLogs(RMSGlobal.Terminal_Id, objUserInfo.UserName, dateTime); #endregion Debug.WriteLine("UpdateCalc 18"); } catch (Exception eee) { Debug.WriteLine("UpdateCalc 19"); Debug.WriteLine(eee.ToString()); } ///Print Payment Bill /// /* DataSet tempDataSet = new DataSet(); tempDataSet.ReadXml("Config/Print_Config.xml"); if (tempDataSet.Tables[0].Rows[0]["PrintPaymentBill"].ToString().ToLower().Equals("true")) { Debug.WriteLine("UpdateCalc 17"); PrintPaymentBill(paymentMethodIndex);//Payment method index .Cash=1,EFT=2,Cheque=3 } */ COrderManager tempOrderManager = new COrderManager(); COrderInfo tempOrderInfo = null; if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are processed { tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data; tempOrderManager.UpdateOrderInfo(tempOrderInfo); Debug.WriteLine("UpdateCalc 13"); tempOrderManager.InsertOrderArchive(tempOrderInfo); Debug.WriteLine("UpdateCalc 14"); tempOrderManager.InsertOrderDetailsArchive(tempOrderInfo); Debug.WriteLine("UpdateCalc 15"); } else //If online orders are processed { tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(m_iOrderID).Data; tempOrderManager.InsertOnlineOrderArchive(tempOrderInfo); Debug.WriteLine("Online orders archiving"); } tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, m_sTableType); Debug.WriteLine("UpdateCalc 16"); //insert voucher tempOrderManager.InsertOrderVoucher(m_oOrderVoucher); ///back to main screen /// CFormManager.Forms.Pop(); Form tempForm = CFormManager.Forms.Pop(); tempForm.Show(); this.Close(); } g_BalaceLabel.ForeColor = Color.Red; } catch (Exception eee) { //MessageBox.Show(eee.ToString()); Debug.WriteLine("UpdateCalc catch"); Debug.WriteLine(eee.ToString()); } }
public void LoadGraph() { ChartEngine tempChartEngine = new ChartEngine(); tempChartEngine.Size = GraphPictureBox.Size; tempChartEngine.ShowXValues = true; tempChartEngine.ShowYValues = true; // tempChartEngine.Padding = 40; tempChartEngine.BottomChartPadding = 30; tempChartEngine.LeftChartPadding = 40; ChartText tempChartText = new ChartText(); tempChartText.Text = "Hourly Sales"; tempChartEngine.Title = tempChartText; CPaymentManager tempPaymentManager = new CPaymentManager(); CResult oResult = tempPaymentManager.GetSortedPayment(DateTime.Now); double MaxAmount = 0.0; if (oResult.IsSuccess && oResult.Data != null) { MaxAmount = (double)oResult.Data; } // tempChartEngine.YValuesInterval = (int)Math.Floor(MaxAmount / 20); tempChartEngine.YValuesInterval = GetInterVal(MaxAmount); tempChartEngine.YCustomEnd = GetCustomEnd(GetInterVal(MaxAmount), MaxAmount); ChartCollection tempChartCollection = new ChartCollection(tempChartEngine); tempChartEngine.Charts = tempChartCollection; DateTime inCurrentDate = DateTime.Now; GetTimeSpan(inCurrentDate); //Data Access try { CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CPcInfo tempPcInfo = (CPcInfo)tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()).Data; DataSet tempHourlySaleDataSet = new DataSet(); CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>(); String sSql = String.Format("select 'NewTime' as \"NewTime\",bill_print_time.payment_time as \"Time\",payment.total_amount as \"Amount\" from payment,bill_print_time where payment.order_id=bill_print_time.order_id and bill_print_time.payment_time>={0} and bill_print_time.payment_time<{1} and payment.pc_id={2}", m_oStartTime, m_oEndTime, tempPcInfo.PcID); SqlDataAdapter tempSqlDataAdapter = new SqlDataAdapter(sSql, oConstants.DBConnection); tempSqlDataAdapter.Fill(tempHourlySaleDataSet); sSql = String.Format("select 'NewTime' as \"NewTime\",deposit_time as \"Time\",total_amount as \"Amount\" from deposit where deposit_time >= {0} and deposit_time < {1} and deposit.pc_id={2}", m_oStartTime, m_oEndTime, tempPcInfo.PcID); tempSqlDataAdapter = new SqlDataAdapter(sSql, oConstants.DBConnection); tempSqlDataAdapter.Fill(tempHourlySaleDataSet); ConvertTime(ref tempHourlySaleDataSet); //start dummy time DataRow row1 = tempHourlySaleDataSet.Tables[0].NewRow(); row1["NewTime"] = "0:00"; row1["Amount"] = "0.000"; //end dummy time DataRow row2 = tempHourlySaleDataSet.Tables[0].NewRow(); row2["NewTime"] = "23:59"; row2["Amount"] = "0.000"; tempHourlySaleDataSet.Tables[0].Rows.Add(row1); tempHourlySaleDataSet.Tables[0].Rows.Add(row2); Chart tempLineChart = new LineChart(); tempLineChart.Line.Color = Color.Red; tempLineChart.ShowLineMarkers = false; tempLineChart.Line.Width = (float)2.0; DataTableReader oReader = tempHourlySaleDataSet.Tables[0].CreateDataReader(); tempLineChart.DataSource = oReader; tempLineChart.DataXValueField = "NewTime"; tempLineChart.DataYValueField = "Amount"; tempLineChart.DataBind(); tempChartCollection.Add(tempLineChart); Image image = tempChartEngine.GetBitmap(); GraphPictureBox.Image = image; GraphPictureBox.Update(); } catch (Exception exp) { throw exp; } }
private void LoadStatusBar(int openOrders) { CCommonConstants oConstants = ConfigManager.GetConfig<CCommonConstants>(); UserStatusLabel.Text = " Logged in as "+oConstants.UserInfo.UserName+" "; OpenOrdersLabel.Text = " "+openOrders + " Open Orders"; CPcInfoManager tempPcInfoManager = new CPcInfoManager(); IPHostEntry ipEntry = System.Net.Dns.GetHostByName(Dns.GetHostName()); CResult oResult = tempPcInfoManager.PcInfoByPcIP(ipEntry.AddressList[0].ToString()); CPcInfo tempPcInfo = new CPcInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempPcInfo = (CPcInfo)oResult.Data; } TerminalIDLabel.Text = " Terminal ID: " + tempPcInfo.Name+" "; RMSGlobal.Terminal_Id = tempPcInfo.PcID; }
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); } }