Esempio n. 1
0
        /// <summary>
        /// Print Tender Removal Receipt
        /// </summary>
        /// <param name="posTransaction">RemoveTenderTransaction</param>
        public void PrintRemoveTenderReceipt(IPosTransaction posTransaction)
        {
            if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
            {
                FiscalPrinter.FiscalPrinter.Instance.PrintRemoveTender(posTransaction);
                return;
            }

            bool copyReceipt = false;

            PrintingActions.Print(FormType.RemoveTender, copyReceipt, false, delegate(FormModulation formMod, FormInfo formInfo)
            {
                StringBuilder reportLayout = new StringBuilder();
                PrintingActions.PrepareReceiptHeader(reportLayout, posTransaction, 10063, copyReceipt);
                reportLayout.AppendLine(PrintingActions.SingleLine);

                reportLayout.AppendLine();
                RemoveTenderTransaction asRemoveTenderTransaction = (RemoveTenderTransaction)posTransaction;
                reportLayout.AppendLine(PrintingActions.FormatTenderLine(ApplicationLocalizer.Language.Translate(10064),
                                                                         Printing.InternalApplication.Services.Rounding.Round(asRemoveTenderTransaction.Amount, true)));
                reportLayout.AppendLine(asRemoveTenderTransaction.Description.ToString());
                reportLayout.AppendLine();
                reportLayout.AppendLine(PrintingActions.DoubleLine);

                formMod  = new FormModulation(Application.Settings.Database.Connection);
                formInfo = formMod.GetInfoForForm(FormType.FloatEntry, copyReceipt, LSRetailPosis.Settings.HardwareProfiles.Printer.ReceiptProfileId);

                return(reportLayout.ToString());
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Returns true if print preview ids shown.
        /// </summary>
        /// <param name="formType"></param>
        /// <param name="posTransaction"></param>
        /// <returns></returns>
        public bool ShowPrintPreview(FormType formType, IPosTransaction posTransaction)
        {
            if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
            {
                return(FiscalPrinter.FiscalPrinter.Instance.ShowPrintPreview(formType, posTransaction));
            }

            FormModulation    formMod           = new FormModulation(Application.Settings.Database.Connection);
            RetailTransaction retailTransaction = (RetailTransaction)posTransaction;

            FormInfo formInfo = formMod.GetInfoForForm(formType, false, LSRetailPosis.Settings.HardwareProfiles.Printer.ReceiptProfileId);

            formMod.GetTransformedTransaction(formInfo, retailTransaction);
            string textForPreview = formInfo.Header;

            textForPreview += formInfo.Details;
            textForPreview += formInfo.Footer;
            textForPreview  = textForPreview.Replace("|1C", string.Empty);
            textForPreview  = textForPreview.Replace("|2C", string.Empty);

            ICollection <Point> signaturePoints = null;

            if (retailTransaction.TenderLines != null &&
                retailTransaction.TenderLines.Count > 0 &&
                retailTransaction.TenderLines.First.Value != null)
            {
                signaturePoints = retailTransaction.TenderLines.First.Value.SignatureData;
            }

            using (frmReportList preview = new frmReportList(textForPreview, signaturePoints))
            {
                this.Application.ApplicationFramework.POSShowForm(preview);
                if (preview.DialogResult == DialogResult.OK)
                {
                    if (LSRetailPosis.Settings.HardwareProfiles.Printer.DeviceType == LSRetailPosis.Settings.HardwareProfiles.DeviceTypes.None)
                    {
                        this.Application.Services.Dialog.ShowMessage(ApplicationLocalizer.Language.Translate(10060), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return(false);
                    }
                    iPrintFromShowJournal = 1;
                    return(true);
                }
            }
            iPrintFromShowJournal = 1;
            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Prints to printer.
        /// </summary>
        /// <param name="printerMap">The printer map.</param>
        /// <param name="formMod">The form mod.</param>
        /// <param name="formType">Type of the form.</param>
        /// <param name="posTransaction">The pos transaction.</param>
        /// <param name="copyReceipt">if set to <c>true</c> [copy receipt].</param>
        /// <returns></returns>
        internal static bool PrintFormTransaction(
            PrinterAssociation printerMap,
            FormModulation formMod,
            FormType formType,
            IPosTransaction posTransaction,
            bool copyReceipt)
        {
            FormInfo formInfo = printerMap.PrinterFormInfo;
            bool     result   = false;

            // Checking for header only.
            if (formInfo.HeaderTemplate == null)
            {
                // Note: This is allowed now that we have multiple printers...
                result = false;
            }
            else if (PrintingActions.ShouldWePrint(formInfo, formType, copyReceipt, printerMap))
            {
                result = true;
                try
                {
                    formMod.GetTransformedTransaction(formInfo, (RetailTransaction)posTransaction);

                    if (formInfo.PrintAsSlip)
                    {
                        printerMap.Printer.PrintSlip(formInfo.Header, formInfo.Details, formInfo.Footer);
                    }
                    else
                    {
                        // Note: In this API Errors are handled in the printer and exceptions do not bubble up.
                        printerMap.Printer.PrintReceipt(formInfo.Header + formInfo.Details + formInfo.Footer);
                    }
                }
                catch (Exception ex)
                {
                    NetTracer.Warning("Printing [Printing] - Exception while printing receipt");

                    POSFormsManager.ShowPOSErrorDialog(new PosisException(1003, ex));
                    result = false;
                }
            }

            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Print form layout with specified content
        /// </summary>
        /// <param name="formType">Form type.</param>
        /// <param name="copyReceipt">Flag to identify if this is a copy.</param>
        /// <param name="getPrintTextHandler">Handler that is called to construct text for printing.</param>
        internal static void Print(
            FormType formType,
            bool copyReceipt,
            bool formInfoTemplateRequired,
            GetTextHandler getPrintTextHandler)
        {
            if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled() &&
                (formType == FormType.GiftCertificate || formType == FormType.TenderDeclaration))
            {
                FiscalPrinter.FiscalPrinter.Instance.PrintReceipt(getPrintTextHandler(null, null));
            }

            FormModulation             formMod        = new FormModulation(Printing.InternalApplication.Settings.Database.Connection);
            IList <PrinterAssociation> printerMapping = PrintingActions.GetActivePrinters(formMod, formType, copyReceipt);

            foreach (PrinterAssociation printerMap in printerMapping)
            {
                PrintFormLayout(printerMap, formMod, formType, copyReceipt, formInfoTemplateRequired, getPrintTextHandler);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Print form layout with specified content.
        /// </summary>
        /// <param name="formMod">Form modulation.</param>
        /// <param name="formInfo">Form info.</param>
        /// <param name="formType">Form type.</param>
        /// <param name="copyReceipt">Flag to identify if this is a copy.</param>
        /// <param name="getPrintTextHandler">Handler that is called to construct text for printing.</param>
        private static void PrintFormLayout(
            PrinterAssociation printerMap,
            FormModulation formMod,
            FormType formType,
            bool copyReceipt,
            bool formInfoTemplateRequired,
            GetTextHandler getPrintTextHandler)
        {
            FormInfo formInfo = printerMap.PrinterFormInfo;

            // Checking if formType requires template.
            if (formInfoTemplateRequired && (formInfo.HeaderTemplate == null))
            {   // 13038: Could not print the receipt because the receipt format could not be found.
                Printing.InternalApplication.Services.Dialog.ShowMessage(13038, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (PrintingActions.ShouldWePrint(formInfo, formType, copyReceipt, printerMap))
            {
                try
                {
                    string textToPrint = getPrintTextHandler(formMod, formInfo);

                    if (formInfo.PrintAsSlip)
                    {
                        printerMap.Printer.PrintSlip(textToPrint);
                    }
                    else
                    {
                        printerMap.Printer.PrintReceipt(textToPrint);
                    }
                }
                catch (Exception ex)
                {
                    NetTracer.Warning("Printing [Print] - Exception while printing receipt");
                    POSFormsManager.ShowPOSErrorDialog(new PosisException(1003, ex));
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Print invoice receipt.
        /// </summary>
        /// <param name="posTransaction">The pos transaction.</param>
        /// <param name="copyInvoice">if set to <c>true</c> [copy invoice].</param>
        /// <param name="printPreview">Not supported.</param>
        /// <returns></returns>
        public bool PrintInvoice(IPosTransaction posTransaction, bool copyInvoice, bool printPreview)
        {
            if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
            {
                FiscalPrinter.FiscalPrinter.Instance.PrintInvoice(posTransaction, copyInvoice, printPreview);
                return(true);
            }

            FormModulation formMod = new FormModulation(Application.Settings.Database.Connection);

            bool noPrinterDefined = true; // Initilize as error

            IList <PrinterAssociation> printerMapping = PrintingActions.GetActivePrinters(formMod, FormType.Invoice, copyInvoice);

            bool result = true;

            foreach (PrinterAssociation printerMap in printerMapping)
            {
                noPrinterDefined = noPrinterDefined && (printerMap.Type == DeviceTypes.None);

                if ((printerMap.Type == DeviceTypes.OPOS) || (printerMap.Type == DeviceTypes.Windows))
                {
                    bool printResult = PrintingActions.PrintFormTransaction(printerMap, formMod, FormType.Invoice, posTransaction, copyInvoice);

                    result = result && printResult;
                }
            }

            if (noPrinterDefined)
            {
                // 10060 - No printer type has been defined.
                this.Application.Services.Dialog.ShowMessage(ApplicationLocalizer.Language.Translate(10060), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                result = false;
            }

            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the printers.
        /// </summary>
        /// <param name="formMod">The form mod.</param>
        /// <param name="formType">Type of the form.</param>
        /// <param name="copyReceipt">if set to <c>true</c> [copy receipt].</param>
        /// <returns>
        /// list of all available printers with associated data
        /// </returns>
        internal static IList <PrinterAssociation> GetActivePrinters(FormModulation formMod, FormType formType, bool copyReceipt)
        {
            IList <PrinterAssociation> list = new List <PrinterAssociation>(2);
            FormInfo    formInfo;
            DeviceTypes type;

            if (Printing.InternalApplication.Services.Peripherals.Printer.IsActive)
            {   // Add printer #1
                formInfo = formMod.GetInfoForForm(formType, copyReceipt, LSRetailPosis.Settings.HardwareProfiles.Printer.ReceiptProfileId);
                type     = LSRetailPosis.Settings.HardwareProfiles.Printer.DeviceType;

                list.Add(new PrinterAssociation(Printing.InternalApplication.Services.Peripherals.Printer, formInfo, type));
            }

            if (Printing.InternalApplication.Services.Peripherals.Printer2.IsActive)
            {   // Add printer #2
                formInfo = formMod.GetInfoForForm(formType, copyReceipt, LSRetailPosis.Settings.HardwareProfiles.Printer2.ReceiptProfileId);
                type     = LSRetailPosis.Settings.HardwareProfiles.Printer2.DeviceType;

                list.Add(new PrinterAssociation(Printing.InternalApplication.Services.Peripherals.Printer2, formInfo, type));
            }

            return(list);
        }
Esempio n. 8
0
        public void PostSuspendTransaction(IPosTransaction posTransaction)
        {
            decimal dNetWt = 0;

            #region
            RetailTransaction retailTrans = posTransaction as RetailTransaction;
            if (retailTrans != null)
            {
                DataTable dtDetail     = new DataTable("Detail");
                DataTable dtIngredient = new DataTable("Ingredient");
                DataRow   drDtl;
                DataRow   drIngrd;

                dtDetail.Columns.Add("ITEMID", typeof(string));
                dtDetail.Columns.Add("LINENUM", typeof(int));
                dtDetail.Columns.Add("MAKINGAMOUNT", typeof(decimal));
                dtDetail.Columns.Add("MakingDisc", typeof(decimal));
                dtDetail.Columns.Add("WastageAmount", typeof(decimal));
                dtDetail.AcceptChanges();

                dtIngredient.Columns.Add("SKUNUMBER", typeof(string));
                dtIngredient.Columns.Add("ITEMID", typeof(string));
                dtIngredient.Columns.Add("LINENUM", typeof(int));
                dtIngredient.Columns.Add("REFLINENUM", typeof(int));

                dtIngredient.Columns.Add("InventSizeID", typeof(string));
                dtIngredient.Columns.Add("InventColorID", typeof(string));
                dtIngredient.Columns.Add("ConfigID", typeof(string));

                dtIngredient.Columns.Add("UnitID", typeof(string));
                dtIngredient.Columns.Add("METALTYPE", typeof(int));

                dtIngredient.Columns.Add("QTY", typeof(decimal));
                dtIngredient.Columns.Add("PCS", typeof(decimal));
                dtIngredient.Columns.Add("CRATE", typeof(decimal));
                dtIngredient.Columns.Add("CVALUE", typeof(decimal));
                dtIngredient.Columns.Add("INGRDDISCAMT", typeof(decimal));
                dtIngredient.AcceptChanges();

                int i = 1;
                foreach (SaleLineItem saleLineItem in retailTrans.SaleItems)
                {
                    DataSet dsIngredients = new DataSet();
                    if (!string.IsNullOrEmpty(Convert.ToString(saleLineItem.PartnerData.Ingredients)) && Convert.ToString(saleLineItem.PartnerData.Ingredients) != "0")
                    {
                        StringReader reader = new StringReader(Convert.ToString(saleLineItem.PartnerData.Ingredients));
                        dsIngredients.ReadXml(reader);
                    }
                    else
                    {
                        dsIngredients = null;
                    }

                    drDtl = dtDetail.NewRow();

                    drDtl["ITEMID"]        = saleLineItem.ItemId;
                    drDtl["LINENUM"]       = i;
                    drDtl["MAKINGAMOUNT"]  = decimal.Round(Convert.ToDecimal(saleLineItem.PartnerData.MakingAmount), 2, MidpointRounding.AwayFromZero);
                    drDtl["MakingDisc"]    = decimal.Round(Convert.ToDecimal(saleLineItem.PartnerData.MakingTotalDiscount), 2, MidpointRounding.AwayFromZero);
                    drDtl["WastageAmount"] = decimal.Round(Convert.ToDecimal(saleLineItem.PartnerData.WastageAmount), 2, MidpointRounding.AwayFromZero);

                    dtDetail.Rows.Add(drDtl);
                    dtDetail.AcceptChanges();

                    if (dsIngredients != null && dsIngredients.Tables[0].Rows.Count > 0)
                    {
                        int iGrd = 1;

                        foreach (DataRow dr in dsIngredients.Tables[0].Rows)
                        {
                            drIngrd = dtIngredient.NewRow();

                            drIngrd["SKUNUMBER"] = Convert.ToString(dr["SKUNUMBER"]);
                            drIngrd["ITEMID"]    = Convert.ToString(dr["ITEMID"]);
                            drIngrd["LINENUM"]   = iGrd;

                            drIngrd["REFLINENUM"]    = i;
                            drIngrd["InventSizeID"]  = Convert.ToString(dr["InventSizeID"]);
                            drIngrd["InventColorID"] = Convert.ToString(dr["InventColorID"]);
                            drIngrd["ConfigID"]      = Convert.ToString(dr["ConfigID"]);

                            drIngrd["UnitID"]    = Convert.ToString(dr["UnitID"]);
                            drIngrd["METALTYPE"] = Convert.ToInt32(dr["METALTYPE"]);

                            if (iGrd == 1)
                            {
                                dNetWt = decimal.Round(Convert.ToDecimal(dr["QTY"]), 3, MidpointRounding.AwayFromZero); // added on 24/03/2014 R.Hossain
                            }
                            drIngrd["QTY"]   = decimal.Round(Convert.ToDecimal(dr["QTY"]), 3, MidpointRounding.AwayFromZero);
                            drIngrd["PCS"]   = decimal.Round(Convert.ToDecimal(dr["PCS"]), 3, MidpointRounding.AwayFromZero);
                            drIngrd["CRATE"] = decimal.Round(Convert.ToDecimal(dr["RATE"]), 2, MidpointRounding.AwayFromZero);
                            if (Convert.ToBoolean(saleLineItem.PartnerData.isMRP) == true) // added on 31/03/2014 and mod on 25/04/14
                            {
                                if (iGrd == 1)                                             // added on 08/07/2014-- for esteemate of mrp item-- bom value should not come
                                {
                                    drIngrd["CVALUE"] = decimal.Round(Convert.ToDecimal(retailTrans.NetAmountWithNoTax), 2, MidpointRounding.AwayFromZero);
                                }
                                else
                                {
                                    drIngrd["CVALUE"] = decimal.Round(Convert.ToDecimal(dr["CVALUE"]), 2, MidpointRounding.AwayFromZero);
                                }
                            }
                            drIngrd["INGRDDISCAMT"] = decimal.Round(Convert.ToDecimal(dr["IngrdDiscTotAmt"]), 2, MidpointRounding.AwayFromZero);

                            dtIngredient.Rows.Add(drIngrd);
                            dtIngredient.AcceptChanges();

                            iGrd++;
                        }
                    }

                    i++;
                }

                if ((dtDetail != null && dtDetail.Rows.Count > 0) &&
                    (dtIngredient != null && dtIngredient.Rows.Count > 0))
                {
                    DataRow drLIngrd;

                    foreach (DataRow dr in dtDetail.Rows)
                    {
                        drLIngrd = dtIngredient.NewRow();
                        drLIngrd["SKUNUMBER"] = Convert.ToString(dr["ITEMID"]);
                        drLIngrd["ITEMID"]    = "Labour";
                        drLIngrd["LINENUM"]   = dtIngredient.Rows.Count + 1;

                        drLIngrd["REFLINENUM"]    = Convert.ToInt32(dr["LINENUM"]);
                        drLIngrd["InventSizeID"]  = string.Empty;
                        drLIngrd["InventColorID"] = string.Empty;
                        drLIngrd["ConfigID"]      = string.Empty;

                        drLIngrd["UnitID"]    = string.Empty;
                        drLIngrd["METALTYPE"] = 0;

                        drLIngrd["QTY"]          = 0;
                        drLIngrd["PCS"]          = 0;
                        drLIngrd["CRATE"]        = Convert.ToString(decimal.Round((Convert.ToDecimal(dr["MAKINGAMOUNT"]) + Convert.ToDecimal(dr["WastageAmount"])) / Convert.ToDecimal(dNetWt), 2, MidpointRounding.AwayFromZero));
                        drLIngrd["CVALUE"]       = Convert.ToDecimal(dr["MAKINGAMOUNT"]) + Convert.ToDecimal(dr["WastageAmount"]);
                        drLIngrd["INGRDDISCAMT"] = Convert.ToDecimal(dr["MakingDisc"]);
                        dtIngredient.Rows.Add(drLIngrd);
                        dtIngredient.AcceptChanges();
                    }
                }

                if ((dtDetail != null && dtDetail.Rows.Count > 0) &&
                    (dtIngredient != null && dtIngredient.Rows.Count > 0))
                {
                    frmEstimationReport objEstimationReport = new frmEstimationReport(posTransaction, dtDetail, dtIngredient);
                    objEstimationReport.ShowDialog();
                }
                else
                {
                    #region Nimbus
                    FormModulation    formMod           = new FormModulation(ApplicationSettings.Database.LocalConnection);
                    RetailTransaction retailTransaction = posTransaction as RetailTransaction;
                    if (retailTransaction != null)
                    {
                        ICollection <Point> signaturePoints = null;
                        if (retailTransaction.TenderLines != null &&
                            retailTransaction.TenderLines.Count > 0 &&
                            retailTransaction.TenderLines.First.Value != null)
                        {
                            signaturePoints = retailTransaction.TenderLines.First.Value.SignatureData;
                        }
                        FormInfo formInfo = formMod.GetInfoForForm(Microsoft.Dynamics.Retail.Pos.Contracts.Services.FormType.QuotationReceipt, false, LSRetailPosis.Settings.HardwareProfiles.Printer.ReceiptProfileId);
                        formMod.GetTransformedTransaction(formInfo, retailTransaction);

                        string textForPreview = formInfo.Header;
                        textForPreview += formInfo.Details;
                        textForPreview += formInfo.Footer;
                        textForPreview  = textForPreview.Replace("|1C", string.Empty);
                        textForPreview  = textForPreview.Replace("|2C", string.Empty);
                        frmReportList preview = new frmReportList(textForPreview, signaturePoints);
                        LSRetailPosis.POSControls.POSFormsManager.ShowPOSForm(preview);
                    }
                    #endregion
                }
            }

            #endregion


            LSRetailPosis.ApplicationLog.Log("SuspendTriggers.PostSuspendTransaction", "After the suspension of a transaction...", LSRetailPosis.LogTraceLevel.Trace);
        }
Esempio n. 9
0
        /// <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);
        }