protected virtual async Task Create(CreateOrEditCustomerInvoiceDetailDto input)
        {
            var customerInvoiceDetail = ObjectMapper.Map <CustomerInvoiceDetail>(input);


            if (AbpSession.TenantId != null)
            {
                customerInvoiceDetail.TenantId = (int?)AbpSession.TenantId;
            }


            await _customerInvoiceDetailRepository.InsertAsync(customerInvoiceDetail);
        }
        public async Task CreateOrEdit(CreateOrEditCustomerInvoiceDetailDto input)
        {
            decimal discountPrice = 0, taxPrice = 0;

            decimal markUp    = input.Net;
            decimal unitPrice = input.UnitPrice;
            decimal quantity  = input.Quantity;
            decimal tax       = input.Tax ?? 0;
            decimal discount  = input.Discount ?? 0;
            decimal costPrice = unitPrice * quantity;

            if (markUp > 0)
            {
                costPrice += costPrice * (markUp / 100);
            }

            if (discount > 0)
            {
                discountPrice = costPrice * (discount / 100);
            }

            if (tax > 0)
            {
                taxPrice = (costPrice - discountPrice) * (tax / 100);
            }

            input.Gross  = costPrice;
            input.Charge = (costPrice - discountPrice) + taxPrice;

            if (input.Id == null)
            {
                await Create(input);
            }
            else
            {
                await Update(input);
            }
        }
        protected virtual async Task Update(CreateOrEditCustomerInvoiceDetailDto input)
        {
            var customerInvoiceDetail = await _customerInvoiceDetailRepository.FirstOrDefaultAsync((int)input.Id);

            ObjectMapper.Map(input, customerInvoiceDetail);
        }