Example #1
0
        public dynamic Delete(ReceiptVoucher model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.ReceiptVoucher, Core.Constants.Constant.MenuGroupName.Transaction))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Delete Record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                var data = _receiptVoucherService.GetObjectById(model.Id);
                model = _receiptVoucherService.SoftDeleteObject(data, _receiptVoucherDetailService);
            }
            catch (Exception ex)
            {
                LOG.Error("Delete Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }
        public ActionResult AddReceipt(string key)
        {
            var msg   = new JsonMessage(false, "Thêm mới dữ liệu thành công.");
            var model = new ReceiptVoucher();

            try
            {
                if (key != Keyapi)
                {
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }
                UpdateModel(model);
                model.Note     = HttpUtility.UrlDecode(model.Note);
                model.IsDelete = false;
                model.IsActive = true;
                model.Code     = DateTime.Now.ToString("yyMMddHHmmss");
                var startDate = Request["DateReturn_"];
                model.DateReturn  = startDate.StringToDecimal();
                model.DateCreated = DateTime.Now.TotalSeconds();
                _da.Add(model);
                _da.Save();
            }
            catch (Exception ex)
            {
                msg.Erros   = true;
                msg.Message = "Dữ liệu chưa được thêm mới.";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
 public bool ValidUpdateObject(ReceiptVoucher receiptVoucher, IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                               IReceivableService _receivableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     receiptVoucher.Errors.Clear();
     VUpdateObject(receiptVoucher, _receiptVoucherService, _receiptVoucherDetailService, _receivableService, _contactService, _cashBankService);
     return(isValid(receiptVoucher));
 }
Example #4
0
        public dynamic Insert(ReceiptVoucher model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Create", Core.Constants.Constant.MenuName.ReceiptVoucher, Core.Constants.Constant.MenuGroupName.Transaction))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Add record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                model = _receiptVoucherService.CreateObject(model, _receiptVoucherDetailService, _receivableService
                                                            , _contactService, _cashBankService);
            }
            catch (Exception ex)
            {
                LOG.Error("Insert Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Example #5
0
        public ReceiptVoucher ReconcileObject(ReceiptVoucher receiptVoucher, DateTime ReconciliationDate,
                                              IReceiptVoucherDetailService _receiptVoucherDetailService, ICashMutationService _cashMutationService,
                                              ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            receiptVoucher.ReconciliationDate = ReconciliationDate;
            if (_validator.ValidReconcileObject(receiptVoucher))
            {
                _repository.ReconcileObject(receiptVoucher);

                CashBank     cashBank     = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                _cashMutationService.CashMutateObject(cashMutation, _cashBankService);

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount -= receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount == 0 && receivable.RemainingAmount == 0)
                    {
                        receivable.IsCompleted    = true;
                        receivable.CompletionDate = DateTime.Now;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
Example #6
0
        public ReceiptVoucher UnconfirmObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                              ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService)
        {
            if (_validator.ValidUnconfirmObject(receiptVoucher))
            {
                IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _receiptVoucherDetailService.UnconfirmObject(detail, this, _receivableService);
                }
                _repository.UnconfirmObject(receiptVoucher);

                if (!receiptVoucher.IsGBCH)
                {
                    CashBank             cashBank      = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                    IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                    foreach (var cashMutation in cashMutations)
                    {
                        _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                    }
                }
            }
            return(receiptVoucher);
        }
 public ReceiptVoucher VCreateObject(ReceiptVoucher receiptVoucher, IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                     IReceivableService _receivableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     VHasContact(receiptVoucher, _contactService);
     if (!isValid(receiptVoucher))
     {
         return(receiptVoucher);
     }
     VHasCashBank(receiptVoucher, _cashBankService);
     if (!isValid(receiptVoucher))
     {
         return(receiptVoucher);
     }
     VHasReceiptDate(receiptVoucher);
     if (!isValid(receiptVoucher))
     {
         return(receiptVoucher);
     }
     VIfGBCHThenIsBank(receiptVoucher, _cashBankService);
     if (!isValid(receiptVoucher))
     {
         return(receiptVoucher);
     }
     VIfGBCHThenHasDueDate(receiptVoucher);
     return(receiptVoucher);
 }
        public CashSalesInvoice PaidObject(CashSalesInvoice cashSalesInvoice, decimal AmountPaid, decimal Allowance, ICashBankService _cashBankService, IReceivableService _receivableService,
                                           IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                           IContactService _contactService, ICashMutationService _cashMutationService, ICashSalesReturnService _cashSalesReturnService,
                                           IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            cashSalesInvoice.AmountPaid = AmountPaid;
            cashSalesInvoice.Allowance  = Allowance;
            if (_validator.ValidPaidObject(cashSalesInvoice, _cashBankService, _receiptVoucherService, _cashSalesReturnService, _closingService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)cashSalesInvoice.CashBankId.GetValueOrDefault());
                cashSalesInvoice.IsBank = cashBank.IsBank;

                if (cashSalesInvoice.AmountPaid + cashSalesInvoice.Allowance == cashSalesInvoice.Total)
                {
                    cashSalesInvoice.IsFullPayment = true;
                }
                Receivable receivable = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.CashSalesInvoice, cashSalesInvoice.Id);
                receivable.AllowanceAmount = Allowance;
                receivable.RemainingAmount = receivable.Amount - receivable.AllowanceAmount;
                _receivableService.UpdateObject(receivable);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)cashSalesInvoice.CashBankId.GetValueOrDefault(), receivable.ContactId, DateTime.Now, cashSalesInvoice.AmountPaid.GetValueOrDefault() /*receivable.RemainingAmount*/,
                                                                                    false, (DateTime)cashSalesInvoice.DueDate.GetValueOrDefault(), cashSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, cashSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                cashSalesInvoice = _repository.PaidObject(cashSalesInvoice);
                _generalLedgerJournalService.CreatePaidJournalForCashSalesInvoice(cashSalesInvoice, _accountService);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)cashSalesInvoice.ConfirmationDate.GetValueOrDefault(), _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(cashSalesInvoice);
        }
Example #9
0
 public ReceiptVoucher CreateObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                    IReceivableService _receivableService, IContactService _contactService, ICashBankService _cashBankService)
 {
     receiptVoucher.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(receiptVoucher, this, _receiptVoucherDetailService, _receivableService, _contactService, _cashBankService) ?
            _repository.CreateObject(receiptVoucher) : receiptVoucher);
 }
Example #10
0
        public ReceiptVoucher UnreconcileObject(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                                ICashMutationService _cashMutationService, ICashBankService _cashBankService, IReceivableService _receivableService)
        {
            if (_validator.ValidUnreconcileObject(receiptVoucher))
            {
                _repository.UnreconcileObject(receiptVoucher);

                CashBank             cashBank      = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                IList <CashMutation> cashMutations = _cashMutationService.SoftDeleteCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                foreach (var cashMutation in cashMutations)
                {
                    _cashMutationService.ReverseCashMutateObject(cashMutation, _cashBankService);
                }

                IList <ReceiptVoucherDetail> receiptVoucherDetails = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var receiptVoucherDetail in receiptVoucherDetails)
                {
                    Receivable receivable = _receivableService.GetObjectById(receiptVoucherDetail.ReceivableId);
                    receivable.PendingClearanceAmount += receiptVoucherDetail.Amount;
                    if (receivable.PendingClearanceAmount != 0 || receivable.RemainingAmount != 0)
                    {
                        receivable.IsCompleted    = false;
                        receivable.CompletionDate = null;
                    }
                    _receivableService.UpdateObject(receivable);
                }
            }
            return(receiptVoucher);
        }
Example #11
0
        public ReceiptVoucher ConfirmObject(ReceiptVoucher receiptVoucher, DateTime ConfirmationDate, IReceiptVoucherDetailService _receiptVoucherDetailService,
                                            ICashBankService _cashBankService, IReceivableService _receivableService, ICashMutationService _cashMutationService,
                                            IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            receiptVoucher.ConfirmationDate = ConfirmationDate;
            if (_validator.ValidConfirmObject(receiptVoucher, this, _receiptVoucherDetailService, _cashBankService, _receivableService, _closingService))
            {
                IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);
                foreach (var detail in details)
                {
                    detail.Errors = new Dictionary <string, string>();
                    _receiptVoucherDetailService.ConfirmObject(detail, ConfirmationDate, this, _receivableService);
                }
                _repository.ConfirmObject(receiptVoucher);

                if (!receiptVoucher.IsGBCH)
                {
                    CashBank     cashBank     = _cashBankService.GetObjectById(receiptVoucher.CashBankId);
                    CashMutation cashMutation = _cashMutationService.CreateCashMutationForReceiptVoucher(receiptVoucher, cashBank);
                    _cashMutationService.CashMutateObject(cashMutation, _cashBankService);
                    _generalLedgerJournalService.CreateConfirmationJournalForReceiptVoucher(receiptVoucher, cashBank, _accountService);
                }
            }
            return(receiptVoucher);
        }
Example #12
0
        public RetailSalesInvoice PaidObject(RetailSalesInvoice retailSalesInvoice, decimal AmountPaid, ICashBankService _cashBankService, IReceivableService _receivableService,
                                             IReceiptVoucherService _receiptVoucherService, IReceiptVoucherDetailService _receiptVoucherDetailService, IContactService _contactService,
                                             ICashMutationService _cashMutationService, IGeneralLedgerJournalService _generalLedgerJournalService, IAccountService _accountService, IClosingService _closingService)
        {
            retailSalesInvoice.AmountPaid = AmountPaid;
            if (_validator.ValidPaidObject(retailSalesInvoice, _cashBankService, _receiptVoucherService))
            {
                CashBank cashBank = _cashBankService.GetObjectById((int)retailSalesInvoice.CashBankId.GetValueOrDefault());
                retailSalesInvoice.IsBank = cashBank.IsBank;

                if (!retailSalesInvoice.IsGBCH)
                {
                    retailSalesInvoice.GBCH_No     = null;
                    retailSalesInvoice.Description = null;
                }
                if (retailSalesInvoice.AmountPaid == retailSalesInvoice.Total)
                {
                    retailSalesInvoice.IsFullPayment = true;
                }
                Receivable     receivable     = _receivableService.GetObjectBySource(Core.Constants.Constant.ReceivableSource.RetailSalesInvoice, retailSalesInvoice.Id);
                ReceiptVoucher receiptVoucher = _receiptVoucherService.CreateObject((int)retailSalesInvoice.CashBankId.GetValueOrDefault(), retailSalesInvoice.ContactId, DateTime.Now, retailSalesInvoice.Total,
                                                                                    retailSalesInvoice.IsGBCH, (DateTime)retailSalesInvoice.DueDate.GetValueOrDefault(), retailSalesInvoice.IsBank, _receiptVoucherDetailService,
                                                                                    _receivableService, _contactService, _cashBankService);
                ReceiptVoucherDetail receiptVoucherDetail = _receiptVoucherDetailService.CreateObject(receiptVoucher.Id, receivable.Id, (decimal)retailSalesInvoice.AmountPaid.GetValueOrDefault(),
                                                                                                      "Automatic Payment", _receiptVoucherService, _cashBankService, _receivableService);
                retailSalesInvoice = _repository.PaidObject(retailSalesInvoice);
                _receiptVoucherService.ConfirmObject(receiptVoucher, (DateTime)retailSalesInvoice.ConfirmationDate, _receiptVoucherDetailService, _cashBankService,
                                                     _receivableService, _cashMutationService, _generalLedgerJournalService, _accountService, _closingService);
            }
            return(retailSalesInvoice);
        }
 public ReceiptVoucher VHasNotBeenDeleted(ReceiptVoucher receiptVoucher)
 {
     if (receiptVoucher.IsDeleted)
     {
         receiptVoucher.Errors.Add("Generic", "Tidak boleh sudah di deleted");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasBeenConfirmed(ReceiptVoucher receiptVoucher)
 {
     if (!receiptVoucher.IsConfirmed)
     {
         receiptVoucher.Errors.Add("Generic", "Harus sudah dikonfirmasi");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasReceiptDate(ReceiptVoucher receiptVoucher)
 {
     if (receiptVoucher.ReceiptDate == null)
     {
         receiptVoucher.Errors.Add("ReceiptDate", "Tidak boleh kosong");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasConfirmationDate(ReceiptVoucher obj)
 {
     if (obj.ConfirmationDate == null)
     {
         obj.Errors.Add("ConfirmationDate", "Tidak boleh kosong");
     }
     return(obj);
 }
 public ReceiptVoucher VHasReconciliationDate(ReceiptVoucher receiptVoucher)
 {
     if (receiptVoucher.ReconciliationDate == null)
     {
         receiptVoucher.Errors.Add("ReconciliationDate", "Harus memiliki reconciliation date");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasNotBeenReconciled(ReceiptVoucher receiptVoucher)
 {
     if (receiptVoucher.IsReconciled)
     {
         receiptVoucher.Errors.Add("Generic", "Sudah di reconcile");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasBeenReconciled(ReceiptVoucher receiptVoucher)
 {
     if (!receiptVoucher.IsReconciled)
     {
         receiptVoucher.Errors.Add("Generic", "Belum di reconcile");
     }
     return(receiptVoucher);
 }
 public ReceiptVoucher VHasNotBeenConfirmed(ReceiptVoucher receiptVoucher)
 {
     if (receiptVoucher.IsConfirmed)
     {
         receiptVoucher.Errors.Add("Generic", "Tidak boleh sudah dikonfirmasi");
     }
     return(receiptVoucher);
 }
Example #21
0
        public async Task SaveVoucher(ReceiptVoucher newRRVoucher)
        {
            newVoucherVisibility = "Hidden";
            popUpVisibility      = "Visible";
            savingPrgs           = 10;
            int thisVoucherID = newRRVoucher.RRVoucherID;

            for (int i = 0; i < WareHouse.Count; i++)
            {
                if (newRRVoucher.warehouse == WareHouse[i].wareHouseName)
                {
                    newRRVoucher.wareHouseID = WareHouse[i].wareHouseID;
                }
            }
            string     urlt      = "https://api.shikkhanobish.com/api/Silicon/SetRRVoucher";
            HttpClient clientt   = new HttpClient();
            string     jsonDataT = JsonConvert.SerializeObject(new
            {
                RRDate      = newRRVoucher.RRDate,
                RRVoucherID = newRRVoucher.RRVoucherID,
                wordOrderNo = newRRVoucher.wordOrderNo,
                deliveredTo = newRRVoucher.deliveredTo,
                contructor  = newRRVoucher.contructor,
                checkedby   = newRRVoucher.checkedby,
                condition   = newRRVoucher.condition,
                challan     = newRRVoucher.challan,
                supplier    = newRRVoucher.supplier,
                allocNumber = newRRVoucher.allocNumber,
                warehouse   = newRRVoucher.warehouse,
                itemNumber  = newRRVoucher.itemNumber,
                description = newRRVoucher.description,
                RCVQuantity = newRRVoucher.RCVQuantity,
                alolocDate  = newRRVoucher.alolocDate,
                wareHouseID = newRRVoucher.wareHouseID
            });
            StringContent       contentT  = new StringContent(jsonDataT, Encoding.UTF8, "application/json");
            HttpResponseMessage responset = await clientt.PostAsync(urlt, contentT).ConfigureAwait(true);

            savingPrgs = 50;
            string resultt = await responset.Content.ReadAsStringAsync();

            var r = JsonConvert.DeserializeObject <Response>(resultt);

            await RestInfo().ConfigureAwait(false);

            getMaxVoucher();
            savingPrgs = 100;
            ShowThisVocuher(thisVoucherID);
            nextTickedNumber = maxVoucherNumber + 1;
            nextrrNumberlbl  = "Ticket Number: " + nextTickedNumber;
            nextBtnEnabled   = true;
            popUpVisibility  = "Hidden";
            blncTxbx         = "";
            amountTxbx       = "";
            itemBxEnabled    = false;
            FilterForSearch();
        }
 public bool ValidConfirmObject(ReceiptVoucher receiptVoucher, IReceiptVoucherService _receiptVoucherService,
                                IReceiptVoucherDetailService _receiptVoucherDetailService, ICashBankService _cashBankService,
                                IReceivableService _receivableService, IClosingService _closingService)
 {
     receiptVoucher.Errors.Clear();
     VConfirmObject(receiptVoucher, _receiptVoucherService, _receiptVoucherDetailService,
                    _cashBankService, _receivableService, _closingService);
     return(isValid(receiptVoucher));
 }
        public ReceiptVoucher VHasContact(ReceiptVoucher receiptVoucher, IContactService _contactService)
        {
            Contact contact = _contactService.GetObjectById(receiptVoucher.ContactId);

            if (contact == null)
            {
                receiptVoucher.Errors.Add("ContactId", "Tidak boleh tidak ada");
            }
            return(receiptVoucher);
        }
        public ReceiptVoucher VHasCashBank(ReceiptVoucher receiptVoucher, ICashBankService _cashBankService)
        {
            CashBank cashBank = _cashBankService.GetObjectById(receiptVoucher.CashBankId);

            if (cashBank == null)
            {
                receiptVoucher.Errors.Add("CashBankId", "Tidak boleh tidak ada");
            }
            return(receiptVoucher);
        }
        public ReceiptVoucher VHasNoReceiptVoucherDetail(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService)
        {
            IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);

            if (details.Any())
            {
                receiptVoucher.Errors.Add("Generic", "Tidak boleh ada receipt voucher details");
            }
            return(receiptVoucher);
        }
        public ReceiptVoucherDetail VHasReceiptVoucher(ReceiptVoucherDetail receiptVoucherDetail, IReceiptVoucherService _receiptVoucherService)
        {
            ReceiptVoucher receiptVoucher = _receiptVoucherService.GetObjectById(receiptVoucherDetail.ReceiptVoucherId);

            if (receiptVoucher == null)
            {
                receiptVoucherDetail.Errors.Add("ReceiptVoucher", "Tidak boleh tidak ada");
            }
            return(receiptVoucherDetail);
        }
        public IList <CashMutation> SoftDeleteCashMutationForReceiptVoucher(ReceiptVoucher receiptVoucher, CashBank cashBank)
        {
            IList <CashMutation> cashMutations = _repository.GetObjectsBySourceDocument(cashBank.Id, MasterConstant.SourceDocumentType.ReceiptVoucher, receiptVoucher.Id);

            foreach (var cashMutation in cashMutations)
            {
                _repository.Delete(cashMutation);
            }
            return(cashMutations);
        }
        public ReceiptVoucher VHasReceiptVoucherDetails(ReceiptVoucher receiptVoucher, IReceiptVoucherDetailService _receiptVoucherDetailService)
        {
            IList <ReceiptVoucherDetail> details = _receiptVoucherDetailService.GetObjectsByReceiptVoucherId(receiptVoucher.Id);

            if (!details.Any())
            {
                receiptVoucher.Errors.Add("Generic", "Harus memiliki receipt voucher details");
            }
            return(receiptVoucher);
        }
 public ReceiptVoucher VUnreconcileObject(ReceiptVoucher receiptVoucher)
 {
     VHasBeenConfirmed(receiptVoucher);
     if (!isValid(receiptVoucher))
     {
         return(receiptVoucher);
     }
     VHasBeenReconciled(receiptVoucher);
     return(receiptVoucher);
 }
Example #30
0
        public async Task DeleteVoucher(string itemNumber)
        {
            savingPrgs = 20;
            int thisVoucher = ShowingVoucher[0].RRVoucherID;

            if (ShowingVoucher.Count > 1)
            {
                popUpVisibility = "Visible";
                for (int i = 0; i < WareHouse.Count; i++)
                {
                    if (ShowingVoucher[0].warehouse == WareHouse[i].wareHouseName)
                    {
                        ShowingVoucher[0].wareHouseID = WareHouse[i].wareHouseID;
                    }
                }
                ReceiptVoucher thisVchr = new ReceiptVoucher();
                for (int i = 0; i < ShowingVoucher.Count; i++)
                {
                    if (ShowingVoucher[i].itemNumber == itemNumber)
                    {
                        thisVchr = ShowingVoucher[i];
                    }
                }
                savingPrgs = 40;
                string     urlt      = "https://api.shikkhanobish.com/api/Silicon/DeleteRRVoucherItem";
                HttpClient clientt   = new HttpClient();
                string     jsonDataT = JsonConvert.SerializeObject(new
                {
                    RRVoucherID = ShowingVoucher[0].RRVoucherID,
                    itemNumber  = itemNumber,
                    RCVQuantity = thisVchr.RCVQuantity,
                    wareHouseID = ShowingVoucher[0].wareHouseID,
                });
                StringContent       contentT  = new StringContent(jsonDataT, Encoding.UTF8, "application/json");
                HttpResponseMessage responset = await clientt.PostAsync(urlt, contentT).ConfigureAwait(true);

                string resultt = await responset.Content.ReadAsStringAsync();

                var r = JsonConvert.DeserializeObject <Response>(resultt);
                await RestInfo().ConfigureAwait(false);

                getMaxVoucher();
                ShowThisVocuher(thisVoucher);
                savingPrgs      = 100;
                popUpVisibility = "Hidden";
                FilterForSearch();
                blncTxbx   = "";
                amountTxbx = "";
            }
            else
            {
                sendMsg("Voucher must have atleast one item", 1);
            }
        }