示例#1
0
        private void _testButton_Click(object sender, EventArgs e)
        {
            try
            {
                var receiptData = new ReceiptData();
                receiptData.Id          = string.Format(RM.GetString("RecieptTestOrderId"));
                receiptData.UserName    = string.Format(RM.GetString("RecieptTestCustomerName"));
                receiptData.UserPhone   = "1234567890";
                receiptData.BurnCd      = false;
                receiptData.OrderPhotos = true;
                receiptData.CropMode    = string.Format(RM.GetString("RecieptTestCropMode"));
                receiptData.PaperType   = string.Format(RM.GetString("RecieptTestPaperType"));
                receiptData.OrderDate   = DateTime.Now.ToString(CultureInfo.CurrentCulture);
                receiptData.PhotosCount = 10;
                receiptData.PrintsCount = 20;
                receiptData.OrderCost   = (receiptData.PrintsCount * 10).ToString("c", NumberFormatInfo.CurrentInfo);
                receiptData.Formats.Add(new FormatInfo("10x15", 10));
                receiptData.Formats.Add(new FormatInfo("20x30", 10));
                for (int i = 0; i < receiptData.PhotosCount; i++)
                {
                    receiptData.Photos.Add(new PhotoInfo("P000000" + i.ToString() + ".JPG", 1, "10x15"));
                    receiptData.Photos.Add(new PhotoInfo("P000000" + i.ToString() + ".JPG", 1, "20x30"));
                }
                receiptData.MorePhotos = false;

                var receipt = new Receipt(receiptData, Config.ReceiptTemplateFile.Value);
                receipt.Print(Config.ReceiptPrinterName.Value);
            }
            catch (Exception ex)
            {
                MainForm.ShowWarningMessage(string.Format(RM.GetString("PrintingError"), ex.Message));
            }
        }
        private ReceiptData SendGppPayment(ProcessOrderRequestData orderData)
        {
            CreatePaymentDraftData(orderData.OrderNumber, orderData.PayableAmount);

            //Do some other payment gateway specific actions here

            var url    = ConfigurationManager.AppSettings["GppGatewayUrl"];
            var result = GetPaymentGatewayResponse <ProcessOrderRequestData, PaymentGatewayResponseData>(orderData, url);

            if (result != null)
            {
                var receiptData = new ReceiptData
                {
                    ReceiptNumber = result.ReceiptNumber,
                    PaymentNumber = result.PaymentNumber,
                    AmountPaid    = result.AmountPaid,
                    DateProcessed = result.DateProcessed
                };

                UpdatePaymentDraftData(receiptData);
                return(receiptData);
            }

            return(null);
        }
示例#3
0
 public static void update(ReceiptData receipt)
 {
     lock (Lock)
     {
         context.recipts.Update(receipt);
         context.SaveChanges();
     }
 }
示例#4
0
 public static BasketInRecipt getBasket(int reciptID)
 {
     lock (Lock)
     {
         ReceiptData receipt = getReciept(reciptID);
         return(receipt.basket);
     }
 }
示例#5
0
        public ActionResult DeleteConfirmed(int id)
        {
            ReceiptData invoiceData = db.ReceiptData.Find(id);

            db.ReceiptData.Remove(invoiceData);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
 public ReceiptDataBuilder()
 {
     receiptData = new ReceiptData
     {
         ReceiptNumber = "RN203309",
         PaymentNumber = "PN276495",
         DateProcessed = DateTime.Now
     };
 }
示例#7
0
        public void Save(string uid)
        {
            try
            {
                if (String.IsNullOrEmpty(uid))
                {
                    throw new ArgumentNullException("User ID", "User ID is required to save receipt.");
                }
                Dictionary <string, string> ValErrors = Validate();
                if (ValErrors.Count > 0)
                {
                    throw new RequisitionNotValidException("Receipt is not valid.", ValErrors);
                }

                using (PurchasingContext Context = ContextHelper.GetDBContext())
                {
                    Enums.HistoryType ChangeType;
                    Receipt           Original = null;
                    ReceiptData       Data;

                    if (ReceiptID <= 0)
                    {
                        Data              = new ReceiptData();
                        Data.created_by   = uid;
                        Data.date_created = DateTime.Now;
                        ChangeType        = Enums.HistoryType.ADD;
                    }
                    else
                    {
                        Data       = Context.ReceiptDatas.FirstOrDefault(r => r.receipt_id == ReceiptID);
                        Original   = new Receipt(Data);
                        ChangeType = Enums.HistoryType.UPDATE;
                    }

                    Data.carrier_luid      = CarrierLUID;
                    Data.purchase_order_id = PurchaseOrderID;
                    Data.received_by_id    = ReceivedByID;
                    Data.date_received     = DateReceived;
                    Data.modified_by       = uid;
                    Data.date_modified     = DateTime.Now;
                    Data.active            = Active;

                    if (ReceiptID <= 0)
                    {
                        Context.ReceiptDatas.InsertOnSubmit(Data);
                    }

                    Context.SubmitChanges();
                    Load(Data);
                    SaveHistory(ChangeType, Original, uid);
                }
            }
            catch (Exception ex)
            {
                throw new RequisitionException("An error has occurred while saving receipt", ex);
            }
        }
示例#8
0
 public ActionResult Edit(ReceiptData receiptdata)
 {
     if (ModelState.IsValid)
     {
         db.Entry(receiptdata).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(receiptdata));
 }
示例#9
0
        //
        // GET: /ReceiptData/Edit/5
        public ActionResult Edit(Int32 id)
        {
            ReceiptData receiptdata = db.ReceiptDatas.Find(id);

            if (receiptdata == null)
            {
                return(HttpNotFound());
            }
            return(View(receiptdata));
        }
示例#10
0
 public ActionResult Edit([Bind(Include = "Id,Name,DonationType,Village,City,State,Pincode,MobileNo,AMount")] ReceiptData invoiceData)
 {
     if (ModelState.IsValid)
     {
         db.Entry(invoiceData).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(invoiceData));
 }
示例#11
0
 public static void Delete(ReceiptData receipt, bool propogate = false)
 {
     lock (Lock)
     {
         if (propogate)
         {
             Delete(receipt.basket, propogate);
         }
         context.recipts.Remove(receipt);
         context.SaveChanges();
     }
 }
示例#12
0
        // GET: InvoiceData/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ReceiptData invoiceData = db.ReceiptData.Find(id);

            if (invoiceData == null)
            {
                return(HttpNotFound());
            }
            return(View(invoiceData));
        }
示例#13
0
 public ActionResult Create([Bind(Include = "Id,Name,DonationType,Village,City,State,Pincode,MobileNo,AMount")] ReceiptData invoiceData)
 {
     if (ModelState.IsValid)
     {
         db.ReceiptData.Add(invoiceData);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //else
     //{
     //    invoiceData.DonationType = db.DonationTypes.ToList();
     //}
     return(View(invoiceData));
 }
示例#14
0
            internal string ToJsonString()
            {
                var rd = new ReceiptData
                {
                    receipt_data = Receipt,
                    price_value  = Price,
                    currency     = Currency,
                    quantity     = 1
                };

                var jsonStr = JsonConvert.SerializeObject(rd);

                return(jsonStr);
            }
示例#15
0
        public Receipt(ReceiptData receiptData)
        {
            this.receiptId = receiptData.receiptID;

            this.basket         = new ShoppingBasket(receiptData.basket);
            this.discount       = null;//new iPolicyDiscount(receiptData.discount);  //todo
            this.purchasePolicy = null;
            //this.actualProducts = new LinkedList<Product>();
            //foreach (ProductsInReceiptData pInR in ProductsInReceiptDAL.getProducts(this.receiptId))
            //this.actualProducts.Add(new Product(ProductInfo.getProductInfo(pInR.productID), pInR.amount, 0));
            // get products and fill in this.products
            this.price     = receiptData.price;
            this.date      = receiptData.date;
            this.receiptId = receiptData.receiptID;
        }
示例#16
0
 private void Load(ReceiptData data)
 {
     Init();
     if (data != null)
     {
         ReceiptID        = data.receipt_id;
         CarrierLUID      = data.carrier_luid;
         PurchaseOrderID  = data.purchase_order_id;
         ReceivedByID     = data.received_by_id;
         DateReceived     = data.date_received;
         CreatedByUserID  = data.created_by;
         ModifiedByUserID = data.modified_by;
         DateCreated      = data.date_created;
         DateModified     = data.date_modified;
         Active           = data.active;
     }
 }
示例#17
0
        public ReceiptData toDataObject()
        {
            BasketInRecipt bask = basket.toDataObjectRecipt(this.receiptId);

            ReceiptData ans = DataAccess.getReciept(this.receiptId); //= new ReceiptData(this.receiptId, bask, this.store.toDataObject(), this.user.toDataObject(), this.price, this.date, new iPolicyDiscountData(), new iPolicyData());//todo

            if (ans == null)
            {
                bask.recipt = ans;

                return(ans);
            }
            ans.price          = this.price;
            ans.date           = this.date;
            ans.purchasePolicy = this.purchasePolicy.toDataObject();
            ans.discount       = this.discount.toDataObject();
            return(ans);
        }
示例#18
0
        public string GetNextReceiptId(IPosTransaction transaction)
        {
            try
            {
                RetailTransaction retailTrans = transaction as RetailTransaction;
                if ((retailTrans != null) && (retailTrans.EntryStatus == PosTransaction.TransactionStatus.Voided))
                {
                    return(string.Empty);
                }


                if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
                {
                    return(FiscalPrinter.FiscalPrinter.Instance.GetNextReceiptId(transaction));
                }

                ReceiptTransactionType transType = GetReceiptTransType(transaction);
                string storeId    = LSRetailPosis.Settings.ApplicationSettings.Terminal.StoreId;
                string terminalId = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalId;
                string staffId    = transaction.OperatorId;

                // Get the template mask for this type of transaction
                string      mask;
                bool        isIndependent;
                string      funcProfileId = LSRetailPosis.Settings.FunctionalityProfiles.Functions.ProfileId;
                ReceiptData receiptData   = new ReceiptData(Application.Settings.Database.Connection, Application.Settings.Database.DataAreaID, funcProfileId);
                receiptData.GetReceiptMask((int)transType, out mask, out isIndependent);

                // Get the next receipt seed (sequential numeric) value
                NumberSequenceSeedType seedType = NumberSequenceSeedType.ReceiptDefault;
                if (isIndependent)
                {
                    seedType = GetSeedType(transType);
                }
                string seedValue = GetAndIncrementTerminalSeed(seedType).ToString();

                return(ReceiptMaskFiller.FillMask(mask, seedValue, storeId, terminalId, staffId));
            }
            catch (Exception ex)
            {
                LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), ex);
                throw;
            }
        }
示例#19
0
        public JsonResult GetReceiptData(string kptn)
        {
            if (string.IsNullOrEmpty(kptn))
            {
                return(Json(new { status = false, errorcode = "0", msg = "Something went wrong with your parameter" }, JsonRequestBehavior.AllowGet));
            }

            string[] values = User.Identity.Name.Split('|');

            ML.OFW.Contracts.Models.billsPayModel.reprintingpartners smodel = new OFW.Contracts.Models.billsPayModel.reprintingpartners();
            smodel.kptnno     = kptn.Trim();
            smodel.walletuser = values[0].Trim();
            smodel.walletno   = values[1].Trim();

            ML.OFW.Services.OFW service = new OFW.Services.OFW();
            var respVal = service.reprintBillspay(smodel);

            if (respVal.respCode != "0")
            {
                var model = new ReceiptData();

                model.acctName   = respVal.accountName;
                model.address    = respVal.address;
                model.BPrefNo    = respVal.refNo;
                model.branch     = respVal.branchName;
                model.contactNo  = respVal.contactNo;
                model.date       = respVal.transDate;
                model.Name       = respVal.name;
                model.PaidAmt    = string.Format("{0:#,##0.00}", Convert.ToDecimal(respVal.principalAmount));
                model.PaidCharge = string.Format("{0:#,##0.00}", Convert.ToDecimal(respVal.charge));
                model.paymentTo  = respVal.paymentTo;
                model.totalPaid  = string.Format("{0:#,##0.00}", Convert.ToDecimal(respVal.totalAmountPaid));


                return(Json(new { status = true, errorcode = "1", msg = respVal.respMsg, receiptData = model }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { status = false, errorcode = "0", msg = respVal.respMsg }, JsonRequestBehavior.AllowGet));
        }
        protected void rgReceiptList_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                Label        lbl;
                if (e.Item is GridDataItem)
                {
                    ReceiptData data = (ReceiptData)e.Item.DataItem;

                    LinkButton lnk = (LinkButton)e.Item.FindControl("lbIssueID");
                    if (data.IssueList != null && data.IssueList[0] != null)
                    {
                        lnk.Text            = WebSiteCommon.FormatID(data.IssueList[0].INCIDENT_ID, 6);
                        lnk.CommandArgument = lnk.Text;
                    }
                    else
                    {
                        lnk.Visible = false;
                    }
                }
            }
        }
示例#21
0
        public void SwitchToThankYou()
        {
            ExecutionEngine.EventLogger.Write("ProcessOrderStage:SwitchToThankYou");
            LastVisitedPage = _thankYouScreen;

            if (ExecutionEngine.Config.EnableReceiptPrinter.Value && ExecutionEngine.Instance.PrimaryAction != PrimaryActionType.ProcessOrder)
            {
                try
                {
                    var receiptData = new ReceiptData();
                    receiptData.Id          = CurrentOrder.OrderId;
                    receiptData.UserName    = CurrentOrder.UserName;
                    receiptData.UserPhone   = CurrentOrder.UserPhone;
                    receiptData.OrderPhotos = true;
                    receiptData.BurnCd      = false;

                    if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.BurnCd)
                    {
                        receiptData.Service     = ExecutionEngine.Instance.Resource[Constants.OrderInfoControlCdBurningTextKey].ToString();
                        receiptData.OrderPhotos = false;
                        receiptData.BurnCd      = true;
                    }

                    receiptData.CropMode = Constants.CropToFillModeName == CurrentOrder.CropMode ?
                                           ExecutionEngine.Instance.Resource[Constants.CropToFillTextKey].ToString() :
                                           ExecutionEngine.Instance.Resource[Constants.ResizeToFitTextKey].ToString();
                    receiptData.PaperType   = CurrentOrder.OrderPaperType.Name;
                    receiptData.OrderDate   = DateTime.Now.ToString(CultureInfo.CurrentCulture);
                    receiptData.PhotosCount = CurrentOrder.OrderItems.Count;
                    receiptData.PrintsCount = CurrentOrder.GetItemCount();
                    receiptData.OrderCost   = CurrentOrder.GetTotalCost().ToString("c", NumberFormatInfo.CurrentInfo);
                    if (ExecutionEngine.PriceManager.SalesTaxPercent.Value > 0)
                    {
                        string taxString = string.Format("{0} ({1}%)", (CurrentOrder.GetTotalCost() * ExecutionEngine.PriceManager.SalesTaxPercent.Value).ToString("c", CultureInfo.CurrentCulture), ExecutionEngine.PriceManager.SalesTaxPercent.Value * 100);
                        if (!string.IsNullOrEmpty(ExecutionEngine.PriceManager.SalesTaxComment.Value))
                        {
                            taxString += " " + ExecutionEngine.PriceManager.SalesTaxComment.Value;
                        }
                        receiptData.SalesTax  = taxString;
                        receiptData.TotalCost = (CurrentOrder.GetTotalCost() * (1 + ExecutionEngine.PriceManager.SalesTaxPercent.Value)).ToString("c", NumberFormatInfo.CurrentInfo);
                    }

                    foreach (PaperFormat format in ExecutionEngine.Instance.PaperFormats)
                    {
                        if (CurrentOrder.GetItemCount(format) > 0)
                        {
                            receiptData.Formats.Add(new FormatInfo(format.Name, CurrentOrder.GetItemCount(format)));
                        }
                    }

                    int maxPhotosCount = Math.Min(CurrentOrder.OrderItems.Count, ExecutionEngine.Config.PhotosInReceipt.Value);
                    for (int i = 0; i < maxPhotosCount; i++)
                    {
                        foreach (PaperFormat format in ExecutionEngine.Instance.PaperFormats)
                        {
                            if (CurrentOrder.OrderItems[i].GetCount(format) > 0)
                            {
                                receiptData.Photos.Add(new PhotoInfo(CurrentOrder.OrderItems[i].OrderStoreFileName, CurrentOrder.OrderItems[i].GetCount(format), format.Name));
                            }
                        }
                    }
                    receiptData.MorePhotos = (maxPhotosCount < CurrentOrder.OrderItems.Count);

                    if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.OrderPhotos)
                    {
                        foreach (Service service in CurrentOrder.Services)
                        {
                            string servicePrice;

                            if (service.IsPriceFixed)
                            {
                                servicePrice = service.GetPriceString();
                            }
                            else
                            {
                                servicePrice = (CurrentOrder.GetTotalCost() * service.Price / 100.0f).ToString("c", CultureInfo.CurrentCulture) + " (" + service.GetPriceString() + ")";
                            }

                            receiptData.Services.Add(new ServiceInfo(service.Name, servicePrice));
                        }
                    }

                    var receipt = new Receipt(receiptData, ExecutionEngine.Config.ReceiptTemplateFile.Value);
                    receipt.Print(ExecutionEngine.Config.ReceiptPrinterName.Value);
                }
                catch (System.Exception e)
                {
                    ExecutionEngine.ErrorLogger.WriteExceptionInfo(e);
                    MessageDialog.Show(StringResources.GetString("MessageReceiptPrinterError"));
                }
            }

            if (ExecutionEngine.Instance.PrimaryAction == PrimaryActionType.OrderPhotos)
            {
                ExecutionEngine.Instance.OrderManager.AddOrder(_orderStoreManager.CurrentOrderPath);
            }

            EnableTimeout();
            Engine.ExecuteCommand(new SwitchToScreenCommand(_thankYouScreen));
        }
 private void UpdateOrderDraftData(ReceiptData receipt)
 {
     //Do some business logic here after receiving response from payment gateway,
     //for example, update order data change status to "Paid", etc
 }
 private void UpdatePaymentDraftData(ReceiptData receiptData)
 {
     //Do business logic here, for example,
     //update payment draft data in database (change status, set received values), etc.
 }
示例#24
0
        public ActionResult Print(int id)
        {
            ReceiptData invoiceData = db.ReceiptData.Find(id);

            return(View(invoiceData));
        }
示例#25
0
 private void SetupMock(ProcessOrderRequestData orderData, ReceiptData receiptData)
 {
     paymentGatewayServiceMock
     .Setup(s => s.ProcessPaymentData(orderData))
     .Returns(receiptData);
 }
            internal string ToJsonString()
            {
                var rd = new ReceiptData
                {
                    receipt_data = Receipt,
                    price_value = Price,
                    currency = Currency,
                    quantity = 1
                };

                var jsonStr = JsonConvert.SerializeObject(rd);

                return jsonStr;
            }
示例#27
0
 public Receipt(ReceiptData data)
 {
     Load(data);
 }