コード例 #1
0
        /// <summary>
        /// edit invoice detail.
        /// </summary>
        /// <param name="invoiceDetId"></param>
        /// <returns></returns>
        public async Task <IActionResult> EditInvoiceDetail(int invoiceDetId)
        {
            ViewBag.UnitOfMeasurementList = await _unitOfMeasurement.GetUnitOfMeasurementSelectList();

            SalesInvoiceDetailModel salesInvoiceDetailModel = await _salesInvoiceDetail.GetSalesInvoiceDetailById(invoiceDetId);

            return(await Task.Run(() =>
            {
                return PartialView("_AddInvoiceDetail", salesInvoiceDetailModel);
            }));
        }
コード例 #2
0
        public async Task <int> CreateSalesInvoiceDetailTax(SalesInvoiceDetailTaxModel salesInvoiceDetailTaxModel)
        {
            int salesInvoiceDetailTaxId = 0;
            int multiplier = 1;

            SalesInvoiceDetailModel salesInvoiceDetailModel = null;

            salesInvoiceDetailModel = await salesInvoiceDetail.GetSalesInvoiceDetailById((int)salesInvoiceDetailTaxModel.InvoiceDetId);

            // assign values.
            Salesinvoicedetailtax salesInvoiceDetailTax = new Salesinvoicedetailtax();

            salesInvoiceDetailTax.InvoiceDetId          = salesInvoiceDetailTaxModel.InvoiceDetId;
            salesInvoiceDetailTax.SrNo                  = salesInvoiceDetailTaxModel.SrNo;
            salesInvoiceDetailTax.TaxLedgerId           = salesInvoiceDetailTaxModel.TaxLedgerId;
            salesInvoiceDetailTax.TaxPercentageOrAmount = salesInvoiceDetailTaxModel.TaxPercentageOrAmount;
            salesInvoiceDetailTax.TaxPerOrAmountFc      = salesInvoiceDetailTaxModel.TaxPerOrAmountFc;

            if (DiscountType.Percentage.ToString() == salesInvoiceDetailTaxModel.TaxPercentageOrAmount)
            {
                salesInvoiceDetailTaxModel.TaxAmountFc = (salesInvoiceDetailModel.GrossAmountFc * salesInvoiceDetailTaxModel.TaxPerOrAmountFc) / 100;
            }
            else
            {
                salesInvoiceDetailTaxModel.TaxAmountFc = salesInvoiceDetailTaxModel.TaxPerOrAmountFc;
            }

            if (TaxAddOrDeduct.Deduct.ToString() == salesInvoiceDetailTaxModel.TaxAddOrDeduct)
            {
                multiplier = -1;
            }

            salesInvoiceDetailTax.TaxAddOrDeduct = salesInvoiceDetailTaxModel.TaxAddOrDeduct;
            salesInvoiceDetailTax.TaxAmountFc    = multiplier * salesInvoiceDetailTaxModel.TaxAmountFc;
            salesInvoiceDetailTax.TaxAmount      = multiplier * salesInvoiceDetailTaxModel.TaxAmount;
            salesInvoiceDetailTax.Remark         = salesInvoiceDetailTaxModel.Remark;
            await Create(salesInvoiceDetailTax);

            salesInvoiceDetailTaxId = salesInvoiceDetailTax.InvoiceDetTaxId;
            if (salesInvoiceDetailTaxId != 0)
            {
                await salesInvoiceDetail.UpdateSalesInvoiceDetailAmount(salesInvoiceDetailTax.InvoiceDetId);

                salesInvoiceDetailTax = await GetByIdAsync(w => w.InvoiceDetTaxId == salesInvoiceDetailTaxModel.InvoiceDetTaxId);

                await salesInvoice.UpdateSalesInvoiceMasterAmount(salesInvoiceDetailTax.InvoiceDet.InvoiceId);
            }

            return(salesInvoiceDetailTaxId); // returns.
        }