private static void ChooseInvoiceLanguage(IPosTransaction posTransaction, bool copyReceipt, SqlConnection connection, int iFromShowJour) { Microsoft.Dynamics.Retail.Pos.BlankOperations.WinFormsTouch.frmLanguageForInvoice objLI = new BlankOperations.WinFormsTouch.frmLanguageForInvoice(); objLI.ShowDialog(); int iLanguage = 0; if (objLI.isEnglish == true) { iLanguage = 1; } else if (objLI.isArabic == true) { iLanguage = 2; } else if (objLI.isBoth == true) { iLanguage = 3; } frmSaleInv reportfrm = new frmSaleInv(posTransaction, connection, copyReceipt, 0, iLanguage, iFromShowJour); reportfrm.ShowDialog(); frmSaleInvAccountsCopy reportfrmAcc = new frmSaleInvAccountsCopy(posTransaction, connection, copyReceipt, 0, iLanguage, iFromShowJour); reportfrmAcc.ShowDialog(); if (iFromShowJour == 1) { frmSaleInvControlCopy reportfrmCon = new frmSaleInvControlCopy(posTransaction, connection, copyReceipt, 0, iLanguage, iFromShowJour); reportfrmCon.ShowDialog(); } }
/// <summary> /// Print the standard slip, returns false if printing should be aborted altogether. /// </summary> /// <param name="formType"></param> /// <param name="posTransaction"></param> /// <param name="copyReceipt"></param> /// <returns></returns> public bool PrintReceipt(FormType formType, IPosTransaction posTransaction, bool copyReceipt) { bool result = false; if (formType == FormType.Receipt) { //SqlConnection SqlCon = new SqlConnection(ApplicationSettings.Database.LocalConnectionString); SqlConnection connection = new SqlConnection(); if (application != null) { connection = application.Settings.Database.Connection; } else { connection = ApplicationSettings.Database.LocalConnection; } //Start :02/07/2014 if (posTransaction is IRetailTransaction) { RetailTransaction retailTransaction = (RetailTransaction)posTransaction; SaleLineItem item = retailTransaction.SaleItems.Last.Value; if (item.Description == "Add to gift card") { //==== if (application != null) { connection = application.Settings.Database.Connection; } else { connection = ApplicationSettings.Database.LocalConnection; } string sTransactionId = retailTransaction.TransactionId; string sTerminalId = retailTransaction.TerminalId; string sCardNo = string.Empty; decimal sAmt = 0; DataTable dt = GetGiftCardAmountInfo(connection, sTransactionId, sTerminalId); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i <= dt.Rows.Count - 1; i++) { if (string.IsNullOrEmpty(sCardNo)) { sAmt = Convert.ToDecimal(dt.Rows[i]["AMOUNT"]); sCardNo = Convert.ToString(dt.Rows[i]["COMMENT"]); sCardNo = new String('x', Convert.ToInt16(sCardNo.Length) - 4) + sCardNo.Substring(Convert.ToInt16(sCardNo.Length) - 4); } else { sCardNo = sCardNo + " / " + new String('x', Convert.ToInt16(Convert.ToString(dt.Rows[i]["COMMENT"]).Length) - 4) + Convert.ToString(dt.Rows[i]["COMMENT"]).Substring(Convert.ToInt16(Convert.ToString(dt.Rows[i]["COMMENT"]).Length) - 4); sAmt = sAmt + Convert.ToDecimal(dt.Rows[i]["AMOUNT"]); } } } frmR_ProductAdvanceReceipt objProdAdv = new frmR_ProductAdvanceReceipt(posTransaction, connection, sTransactionId, Convert.ToString(sAmt), sTerminalId, item.Description, sCardNo); objProdAdv.ShowDialog(); } else { if (retailTransaction.RefundReceiptId == "1") { string sTransactionId = retailTransaction.TransactionId; string sTerminalId = retailTransaction.TerminalId; string sCardNo = string.Empty; decimal sAmt = 0; DataTable dt = GetGiftCardAmountInfo(connection, sTransactionId, sTerminalId); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i <= dt.Rows.Count - 1; i++) { if (string.IsNullOrEmpty(sCardNo)) { sAmt = Convert.ToDecimal(dt.Rows[i]["AMOUNT"]); sCardNo = Convert.ToString(dt.Rows[i]["COMMENT"]); sCardNo = new String('x', Convert.ToInt16(sCardNo.Length) - 4) + sCardNo.Substring(Convert.ToInt16(sCardNo.Length) - 4); } else { sCardNo = sCardNo + " / " + new String('x', Convert.ToInt16(Convert.ToString(dt.Rows[i]["COMMENT"]).Length) - 4) + Convert.ToString(dt.Rows[i]["COMMENT"]).Substring(Convert.ToInt16(Convert.ToString(dt.Rows[i]["COMMENT"]).Length) - 4); sAmt = sAmt + Convert.ToDecimal(dt.Rows[i]["AMOUNT"]); } } } frmR_ProductAdvanceReceipt objProdAdv = new frmR_ProductAdvanceReceipt(posTransaction, connection, sTransactionId, Convert.ToString(sAmt), sTerminalId, item.Description, sCardNo, 1); objProdAdv.ShowDialog(); } else { if (retailTransaction.SaleIsReturnSale) { frmSaleInv reportfrm = new frmSaleInv(posTransaction, connection, copyReceipt, 0, 0, iPrintFromShowJournal); reportfrm.ShowDialog(); frmSaleInvAccountsCopy reportfrmAcc = new frmSaleInvAccountsCopy(posTransaction, connection, copyReceipt, 0, 0, iPrintFromShowJournal); reportfrmAcc.ShowDialog(); //frmSaleInvControlCopy reportfrmCon = new frmSaleInvControlCopy(posTransaction, connection, copyReceipt, 0, 0, iPrintFromShowJournal); //reportfrmCon.ShowDialog();// commented on 080819/ req by Soudip paul } else { //Microsoft.Dynamics.Retail.Pos.BlankOperations.WinFormsTouch.frmLanguageForInvoice // objLI = new BlankOperations.WinFormsTouch.frmLanguageForInvoice(); //objLI.ShowDialog(); //int iLanguage = 0; //if (objLI.isEnglish == true) // iLanguage = 1; //else if (objLI.isArabic == true) // iLanguage = 2; //else if (objLI.isBoth == true) // iLanguage = 3; if (iPrintFromShowJournal == 1) { using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Is this a gift invoice?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog); if (Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "YES") { frmSaleInv reportfrm = new frmSaleInv(posTransaction, connection, copyReceipt, 1, 0, iPrintFromShowJournal);//Default English for Sales Return reportfrm.ShowDialog(); frmSaleInv reportfrm1 = new frmSaleInv(posTransaction, connection, copyReceipt, 0, 1, iPrintFromShowJournal); reportfrm1.ShowDialog(); } else { ChooseInvoiceLanguage(posTransaction, copyReceipt, connection, iPrintFromShowJournal); } } iPrintFromShowJournal = 0; } else { ChooseInvoiceLanguage(posTransaction, copyReceipt, connection, iPrintFromShowJournal); } } } } //retailTransaction } //End : 02/07/2014 } else if (formType == FormType.CustomerAccountDeposit) { RetailTransaction retailTransaction = posTransaction as RetailTransaction; string sGSSNo = string.Empty; if (retailTransaction != null) { SqlConnection connection = new SqlConnection(); if (application != null) { connection = application.Settings.Database.Connection; } else { connection = ApplicationSettings.Database.LocalConnection; } string sTransactionId = retailTransaction.TransactionId; // string sTerminalId = ApplicationSettings.Terminal.TerminalId; string sTerminalId = retailTransaction.TerminalId; DataTable dtAdv = GetAdvanceInfo(connection, sTransactionId, sTerminalId); if (dtAdv != null && dtAdv.Rows.Count > 0) { sGSSNo = Convert.ToString(dtAdv.Rows[0]["GSSNUMBER"]); if (sGSSNo != string.Empty) { frmR_GSSInstalmentReceipt objRGSS = new frmR_GSSInstalmentReceipt(posTransaction, connection, sTransactionId, Convert.ToString(dtAdv.Rows[0]["AMOUNT"]), sGSSNo, sTerminalId); objRGSS.ShowDialog(); } else { Microsoft.Dynamics.Retail.Pos.BlankOperations.WinFormsTouch.frmLanguageForInvoice objLI = new BlankOperations.WinFormsTouch.frmLanguageForInvoice(); objLI.ShowDialog(); int iLanguage = 0; if (objLI.isEnglish == true) { iLanguage = 1; } else if (objLI.isArabic == true) { iLanguage = 2; } else if (objLI.isBoth == true) { iLanguage = 3; } frmR_ProductAdvanceReceipt objProdAdv = new frmR_ProductAdvanceReceipt(posTransaction, connection, sTransactionId, Convert.ToString(dtAdv.Rows[0]["AMOUNT"]), sTerminalId, "", "", 0, iLanguage); objProdAdv.ShowDialog(); } } } } else { if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { return(FiscalPrinter.FiscalPrinter.Instance.PrintReceipt(formType, posTransaction, copyReceipt)); } FormModulation formMod = new FormModulation(Application.Settings.Database.Connection); IList <PrinterAssociation> printerMapping = PrintingActions.GetActivePrinters(formMod, formType, copyReceipt); // bool result = false; foreach (PrinterAssociation printerMap in printerMapping) { bool printResult = PrintingActions.PrintFormTransaction(printerMap, formMod, formType, posTransaction, copyReceipt); result = result || printResult; } } return(result); }