Ejemplo 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());
            });
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }