Exemple #1
0
        public TblPurchaseInvoiceDetail GetProductDeatilsSectionRcd(string branchCode, string productCode)
        {
            try
            {
                var _invoiceHelper = new InvoiceHelper();
                var _product       = _invoiceHelper.GetProducts(productCode).FirstOrDefault();

                // var invoceDetails = new TblInvoiceDetail();
                var purchaseDetail = new TblPurchaseInvoiceDetail();

                purchaseDetail.UnitId   = Convert.ToDecimal(_product.UnitId ?? 0);
                purchaseDetail.UnitName = _product.UnitName;

                purchaseDetail.TaxStructureCode = Convert.ToDecimal(_product.TaxStructureCode ?? 0);
                purchaseDetail.TaxStructureId   = Convert.ToDecimal(_product.TaxStructureId ?? 0);
                purchaseDetail.TaxGroupCode     = _product.TaxGroupCode;
                purchaseDetail.TaxGroupId       = Convert.ToDecimal(_product.TaxGroupId ?? 0);
                //purchaseDetail.TaxGroupName = _product.TaxGroupName;
                if (_product.TaxStructureCode != null)
                {
                    var taxStructure = _invoiceHelper.GetTaxStructure(Convert.ToDecimal(_product.TaxStructureCode));
                    purchaseDetail.Sgst     = taxStructure.Sgst;
                    purchaseDetail.Cgst     = taxStructure.Sgst;
                    purchaseDetail.Igst     = taxStructure.Igst;
                    purchaseDetail.TotalGst = taxStructure.TotalGst;

                    purchaseDetail.ServerDateTime = DateTime.Now;
                }

                purchaseDetail.Rate = _invoiceHelper.GetProductRate(branchCode, productCode);

                purchaseDetail.HsnNo = Convert.ToDecimal(_product.HsnNo ?? 0);
                // purchaseDetail.AvailStock = Convert.ToDecimal(_invoiceHelper.GetProductQty(branchCode, productCode) ?? 0);
                // purchaseDetail.ProductCode = _product.ProductCode;
                // purchaseDetail.ProductGroupCode = Convert.ToDecimal(_product.ProductGroupCode ?? 0);
                // purchaseDetail.ProductGroupId = Convert.ToDecimal(_product.ProductGroupId ?? 0);
                purchaseDetail.ProductId   = _product.ProductId;
                purchaseDetail.ProductCode = _product.ProductCode;
                purchaseDetail.ProductName = _product.ProductName;

                return(purchaseDetail);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }