public IHttpActionResult CheckSupplierPO(string PONumber)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var status = _spoPaymentContext.CheckSPO(PONumber);
             if (status == "ok")
             {
                 var poItemList = _supplierPOWorkListContext.GetSupplierPOItemList(null, PONumber);
                 return(Ok(new { poItemList = poItemList }));
             }
             else
             {
                 return(Ok(new { status = status }));
             }
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Пример #2
0
 public IHttpActionResult GetSupplierPO(int id)
 {
     if (HttpContext.Current.User.Identity.IsAuthenticated)
     {
         var spo = _supplierPOContext.GetSupplierPO(id);
         if (spo != null)
         {
             spo.SupplierItem = _supplierPOWorkListContext.GetSupplierPOItemList(id, spo.PurchaseOrderNumber);
         }
         return(Ok(spo));
     }
     else
     {
         return(BadRequest());
     }
 }
Пример #3
0
 /// <summary>
 /// This method is used for fetching supplier purchase order from database. - JJ
 /// </summary>
 /// <param name="POID">ID OF PO</param>
 /// <returns>object of SPOReceivingAC</returns>
 public SPOReceivingAC GetSupplierPO(int POId)
 {
     try
     {
         if (_supplierPOContext.Fetch(x => x.Id == POId).Any())
         {
             var supplierPurchaseOrder = _supplierPOContext.Find(POId);
             var isCashPO          = false;
             var SupplierDaysLimit = new List <DiscountDaysAC>();
             if (supplierPurchaseOrder.SupplierProfile.SupplierType.ValueEn == "Cash")
             {
                 isCashPO = true;
             }
             else
             {
                 var daysLimit = _supplierDaysLimitContext.Fetch(x => x.SupplierId == supplierPurchaseOrder.SupplierId).ToList();
                 foreach (var day in daysLimit)
                 {
                     var dayAC = new DiscountDaysAC
                     {
                         CreatedDateTime = day.CreatedDateTime,
                         Days            = day.Days,
                         Discount        = day.Discount,
                         SupplierId      = day.SupplierId
                     };
                     SupplierDaysLimit.Add(dayAC);
                 }
             }
             var          itemList   = _supplierPOWorkListRepository.GetSupplierPOItemList(supplierPurchaseOrder.Id, supplierPurchaseOrder.PurchaseOrderNumber);
             var          branchList = _supplierPOWorkListRepository.GetSPOBranchList(supplierPurchaseOrder.Id);
             SupplierPOAC supplierPO = new SupplierPOAC();
             supplierPO.Id                  = supplierPurchaseOrder.Id;
             supplierPO.DueDate             = supplierPurchaseOrder.DueDate;
             supplierPO.IsApproved          = supplierPurchaseOrder.IsApproved;
             supplierPO.IsCashPO            = isCashPO;
             supplierPO.IsConfirmed         = supplierPurchaseOrder.IsConfirmed;
             supplierPO.IsRejected          = supplierPurchaseOrder.IsRejected;
             supplierPO.IsCanceled          = supplierPurchaseOrder.IsCanceled;
             supplierPO.IsSend              = supplierPurchaseOrder.IsSend;
             supplierPO.IsPartiallyReceived = supplierPurchaseOrder.IsPartiallyReceived;
             supplierPO.IsCancelApproved    = supplierPurchaseOrder.IsCancelApproved;
             supplierPO.PurchaseOrderNumber = supplierPurchaseOrder.PurchaseOrderNumber;
             supplierPO.IssueDate           = supplierPurchaseOrder.CreatedDateTime;
             supplierPO.SupplierId          = supplierPurchaseOrder.SupplierId;
             supplierPO.SupplierName        = supplierPurchaseOrder.SupplierProfile.NameEn;
             supplierPO.SupplierCode        = supplierPurchaseOrder.SupplierProfile.Code;
             supplierPO.SPOBranch           = branchList;
             supplierPO.ParentRecordId      = supplierPurchaseOrder.RecordId;
             if (SupplierDaysLimit.Count > 0)
             {
                 supplierPO.TotalDaysLimit = supplierPurchaseOrder.SupplierProfile.TotalDaysLimit;
                 supplierPO.DiscountDays   = SupplierDaysLimit;
             }
             var spoReceiving = new SPOReceivingAC
             {
                 POItem       = itemList,
                 SupplierPOAC = supplierPO,
                 SPOBill      = GetSPOBill(POId)
             };
             return(spoReceiving);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }