Пример #1
0
 /// <summary>
 /// This method is used for Getting details for Supplier Return Request Receipt. - JJ
 /// </summary>
 /// <param name="Comment">Comment of the approver</param>
 /// <param name="SupplierReturnId">id of SupplierReturnDetail</param>
 /// <param name="userName">username of the currently logged in user</param>
 /// <returns>object of SupplierReturnReceiptAC</returns>
 public SupplierReturnReceiptAC PrintReceipt(string Comment, int SupplierReturnId, string userName)
 {
     try
     {
         var returnDetail = _supplierReturnDetailContext.Find(SupplierReturnId);
         var creditNote   = _supplierReturnCreditNoteContext.Fetch(x => x.SuppierReturnId == SupplierReturnId).FirstOrDefault();
         var returnItem   = _supplierReturnItemContext.Fetch(x => x.SupplierReturnId == SupplierReturnId).ToList();
         if (Comment == ".")
         {
             Comment = "";
         }
         var supplierReturnReceipt = new SupplierReturnReceiptAC
         {
             ApproverName         = userName,
             BranchAddress        = returnDetail.BranchDetail.Address,
             BranchName           = returnDetail.BranchDetail.Name,
             Date                 = DateTime.UtcNow,
             SupplierId           = returnDetail.SupplierId,
             SupplierMobileNo     = returnDetail.SupplierProfile.Phone,
             SupplierName         = returnDetail.SupplierProfile.NameEn,
             ReceiptNo            = returnDetail.RequestNo,
             CreditNoteAmount     = creditNote.CreditNoteDetail.Amount,
             CreditNoteNo         = creditNote.CreditNoteDetail.CreditNoteNo,
             SupplierReturnItemAC = ConvertToApplicationClass(returnItem)
         };
         supplierReturnReceipt.Invoice = InvoiceToHtml.get39(supplierReturnReceipt.ReceiptNo, 1, 20);
         return(supplierReturnReceipt);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public IHttpActionResult GetReturnBillReceipt(string returnBillNumber)
        {
            try
            {
                if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    ReturnBillReceiptAC returnBillReceiptAC = new ReturnBillReceiptAC();
                    POSReturnBill       posReturnBill       = new POSReturnBill();
                    posReturnBill = _iReturnBillRepository.GetPOSReturnBillByReturnBillNumber(returnBillNumber);
                    if (posReturnBill != null)
                    {
                        returnBillReceiptAC.Date                = posReturnBill.ReturningDate.ToString("dd-MM-yyyy hh:mm");
                        returnBillReceiptAC.InvoiceNo           = posReturnBill.POSBill.BillNo;
                        returnBillReceiptAC.Invoice             = InvoiceToHtml.get39(posReturnBill.POSBill.BillNo, 1.5, 20);
                        returnBillReceiptAC.MemberShipNumber    = posReturnBill.POSBill.Customer.MembershipCode;
                        returnBillReceiptAC.ReturnInvoiceNumber = posReturnBill.ReturnedBillNo;

                        List <ReturnBillList>    returnBillList    = new List <ReturnBillList>();
                        List <POSReturnBillItem> listOfPOSBillItem = new List <POSReturnBillItem>();
                        listOfPOSBillItem = _iReturnBillRepository.GetListOfPOSReturnBillItemByReturnBillId(posReturnBill.Id);
                        decimal totalQunatity = 0;
                        decimal totalPrice    = 0;
                        foreach (var posBill in listOfPOSBillItem)
                        {
                            ReturnBillList listOfReturnBill = new ReturnBillList();
                            listOfReturnBill.ItemName       = posBill.POSBillItem.ItemProfile.ItemNameEn;
                            listOfReturnBill.ItemNameArebic = posBill.POSBillItem.ItemProfile.ItemNameSl;
                            listOfReturnBill.Price          = posBill.POSBillItem.SellPrice;
                            listOfReturnBill.ReturnQuantity = posBill.ReturnedQuantity;
                            listOfReturnBill.Total          = (listOfReturnBill.Price * listOfReturnBill.ReturnQuantity);
                            returnBillList.Add(listOfReturnBill);
                            totalQunatity = totalQunatity + listOfReturnBill.ReturnQuantity;
                            totalPrice    = totalPrice + listOfReturnBill.Total;
                        }
                        returnBillReceiptAC.TotalQuantity         = totalQunatity;
                        returnBillReceiptAC.ReturnAmount          = posReturnBill.ReturnedCash;
                        returnBillReceiptAC.ReturnSubtituteAmount = posReturnBill.SubstituteItemsAmount;
                        returnBillReceiptAC.CompanyName           = posReturnBill.BranchDetail.Name;
                        returnBillReceiptAC.CompanyAddress        = posReturnBill.BranchDetail.Address;

                        returnBillReceiptAC.ListOfReturnBillList = returnBillList;
                    }
                    return(Ok(new { isResult = returnBillReceiptAC }));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
Пример #3
0
        /// <summary>
        /// This method is used for fetching purchase order details for printing receipt. - JJ
        /// </summary>
        /// <param name="RecordId">parent record id</param>
        /// <param name="Comment"></param>
        /// <param name="userName">currently logged in user's username</param>
        /// <param name="RoleName">logged in user's rolename</param>
        /// <param name="RoleId">logged in user's role id</param>
        /// <returns>object of SPOReceipt</returns>
        public SPOReceipt PrintSPOReceipt(string Comment, int RecordId, int RoleId, string RoleName, string userName)
        {
            var purchaseOrder = _supplierPOContext.Fetch(x => x.RecordId == RecordId).FirstOrDefault();

            if (purchaseOrder.IsApproved && !purchaseOrder.IsReceived && !purchaseOrder.IsVerified && !purchaseOrder.IsPaid)
            {
                var itemList   = new List <SupplierItemAC>();
                var poItemList = _purchaseOrderItemContext.Fetch(x => x.PurchaseOrderId == purchaseOrder.Id).ToList();
                foreach (var item in poItemList)
                {
                    var spoItem = new SupplierItemAC
                    {
                        FlavourEn       = item.ItemProfile.FlavourEn,
                        ItemNameEn      = item.ItemProfile.ItemNameEn,
                        Type            = item.ItemProfile.SystemParameter.ValueEn + "-" + item.ItemProfile.BaseUnit,
                        OrderCostPrice  = item.OrderCostPrice,
                        OrderQuantity   = item.OrderQuantity,
                        TotalOrderPrice = item.OrderQuantity * item.OrderCostPrice
                    };
                    itemList.Add(spoItem);
                }

                var spoReceipt = new SPOReceipt();
                spoReceipt.BranchAddress       = purchaseOrder.InitiatorBranch.Address;
                spoReceipt.BranchName          = purchaseOrder.InitiatorBranch.NameSl;
                spoReceipt.Comment             = Comment;
                spoReceipt.DueDate             = purchaseOrder.DueDate;
                spoReceipt.IssueDate           = purchaseOrder.CreatedDateTime;
                spoReceipt.MobileNo            = purchaseOrder.SupplierProfile.Phone;
                spoReceipt.POType              = purchaseOrder.SupplierProfile.SupplierType.ValueSl;
                spoReceipt.SPONumber           = purchaseOrder.PurchaseOrderNumber;
                spoReceipt.SupplierItem        = itemList;
                spoReceipt.SupplierName        = purchaseOrder.SupplierProfile.NameEn;
                spoReceipt.SupplierEmail       = purchaseOrder.SupplierProfile.Email;
                spoReceipt.Invoice             = InvoiceToHtml.get39(purchaseOrder.PurchaseOrderNumber, 1, 20);
                purchaseOrder.IsSend           = true;
                purchaseOrder.ModifiedDateTime = DateTime.UtcNow;
                _supplierPOContext.Update(purchaseOrder);
                _supplierPOContext.SaveChanges();

                SaveSupplierPurchaseOrderLog(StringConstants.Send, Comment, purchaseOrder.Id, RecordId, RoleName, "" + RoleName + " " + StringConstants.SendSPO, userName);
                return(spoReceipt);
            }
            else
            {
                return(null);
            }
        }
        public IHttpActionResult SaveBalanceAmount(CustomerProfileAc customerInfo)
        {
            try
            {
                _customerRepository.SaveBalanceAmount(customerInfo, MerchantContext.CompanyDetails.Id);
                var customerCollection = new List <CustomerProfileAc>();
                var paymentDetails     = new CustomerPaymentReciptAc();

                customerCollection.Add(customerInfo);
                paymentDetails.BranchDetail     = MerchantContext.UserDetails.Branch;
                paymentDetails.CurrentDate      = DateTime.UtcNow.ToString("dd-MM-yyyy");
                paymentDetails.Invoice          = InvoiceToHtml.get39(customerInfo.MembershipCode.ToString(), 1.5, 20);
                paymentDetails.MemberShipNumber = customerInfo.MembershipCode;
                paymentDetails.CustomerDetails  = customerCollection;

                return(Ok(paymentDetails));
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }