Example #1
0
 public ActionResult ReceiveByCash(string phone, string cstmrId)
 {
     try
     {
         var identity = (LoginIdentity)Thread.CurrentPrincipal.Identity;
         PaymentInfoViewModel paymentInfoVm = new PaymentInfoViewModel();
         string  customerName  = "";
         decimal dueAmount     = 0m;
         decimal advanceAmount = 0m;
         if (!string.IsNullOrEmpty(phone))
         {
             _customerLedgerService.GetDueOrAdvanceAmountByCustomerPhoneWithCustomerIdName(phone, out cstmrId, out customerName, out dueAmount, out advanceAmount);
             if (dueAmount > 0)
             {
                 paymentInfoVm.DueAmount = dueAmount;
             }
             if (advanceAmount > 0)
             {
                 paymentInfoVm.AdvanceAmount = advanceAmount;
             }
             paymentInfoVm.TrackingNo      = _paymentInfoService.GenerateTrackingNo(identity.CompanyId, identity.BranchId, "PaymentInfo");
             paymentInfoVm.TransactionType = TransactionType.Cash.ToString();
             paymentInfoVm.CustomerId      = cstmrId;
             paymentInfoVm.CustomerName    = customerName;
             paymentInfoVm.CompanyId       = identity.CompanyId;
             paymentInfoVm.BranchId        = identity.BranchId;
         }
         if (!string.IsNullOrEmpty(cstmrId))
         {
             _customerLedgerService.GetDueOrAdvanceAmountByCustomerIdWithCustomerName(cstmrId, out customerName, out dueAmount, out advanceAmount);
             if (dueAmount > 0)
             {
                 paymentInfoVm.DueAmount = dueAmount;
             }
             if (advanceAmount > 0)
             {
                 paymentInfoVm.AdvanceAmount = advanceAmount;
             }
             paymentInfoVm.TrackingNo      = _paymentInfoService.GenerateTrackingNo(identity.CompanyId, identity.BranchId, "PaymentInfo");
             paymentInfoVm.TransactionType = TransactionType.Cash.ToString();
             paymentInfoVm.CustomerId      = cstmrId;
             paymentInfoVm.CustomerName    = customerName;
             paymentInfoVm.CompanyId       = identity.CompanyId;
             paymentInfoVm.BranchId        = identity.BranchId;
         }
         return(View(paymentInfoVm));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }
Example #2
0
 public ActionResult ReceiveByCash(string companyId, string branchId, string cstmrId, string phone)
 {
     try
     {
         PaymentInfoViewModel paymentInfoVm = new PaymentInfoViewModel();
         if (!string.IsNullOrEmpty(cstmrId))
         {
             _customerLedgerService.GetDueOrAdvanceAmountByCustomerIdWithCustomerName(cstmrId, out var customerName, out var dueAmount, out var advanceAmount);
             if (dueAmount > 0)
             {
                 paymentInfoVm.DueAmount = dueAmount;
             }
             if (advanceAmount > 0)
             {
                 paymentInfoVm.AdvanceAmount = advanceAmount;
             }
             paymentInfoVm.TrackingNo      = _paymentInfoService.GenerateTrackingNo(companyId, branchId, "PaymentInfo");
             paymentInfoVm.TransactionType = TransactionType.Cash.ToString();
             paymentInfoVm.CustomerId      = cstmrId;
             paymentInfoVm.CustomerName    = customerName;
             paymentInfoVm.CompanyId       = companyId;
             paymentInfoVm.BranchId        = branchId;
         }
         else if (!string.IsNullOrEmpty(phone))
         {
             _customerLedgerService.GetDueOrAdvanceAmountByCustomerPhoneWithCustomerIdName(phone, out cstmrId, out var customerName, out var dueAmount, out var advanceAmount);
             if (dueAmount > 0)
             {
                 paymentInfoVm.DueAmount = dueAmount;
             }
             if (advanceAmount > 0)
             {
                 paymentInfoVm.AdvanceAmount = advanceAmount;
             }
             paymentInfoVm.TrackingNo      = _paymentInfoService.GenerateTrackingNo(companyId, branchId, "PaymentInfo");
             paymentInfoVm.TransactionType = TransactionType.Cash.ToString();
             paymentInfoVm.CustomerId      = cstmrId;
             paymentInfoVm.CustomerName    = customerName;
             paymentInfoVm.CompanyId       = companyId;
             paymentInfoVm.BranchId        = branchId;
         }
         return(View(paymentInfoVm));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }