예제 #1
0
        public TblStockTransferDetail GetStockTransferDetailsSection(string branchCode, string productCode)
        {
            try
            {
                var _product = GetProducts(productCode);
                if (_product == null)
                {
                    return(null);
                }
                var _stockTransferDetail = new TblStockTransferDetail
                {
                    ProductId        = _product.ProductId,
                    ProductCode      = _product.ProductCode,
                    ProductName      = _product.ProductName,
                    HsnNo            = Convert.ToDecimal(_product.HsnNo ?? 0),
                    Rate             = GetProductRate(branchCode, productCode),
                    ProductGroupId   = Convert.ToDecimal(_product.ProductGroupId ?? 0),
                    ProductGroupCode = Convert.ToDecimal(_product.ProductGroupCode ?? 0),
                    UnitId           = Convert.ToDecimal(_product.UnitId ?? 0),
                    UnitName         = _product.UnitName,
                    AvailStock       = Convert.ToDecimal(GetProductQty(branchCode, productCode) ?? 0)
                };


                return(_stockTransferDetail);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        private TblStockTransferDetail AddStockTransferDetail(ERPContext context, TblStockTransferDetail stockTransferDetail, TblStockTransferMaster stockTransferMaster)
        {
            try
            {
                stockTransferDetail.StockTransferDetailId    = null;
                stockTransferDetail.StockTransferMasterId    = stockTransferMaster.StockTransferMasterId;
                stockTransferDetail.StockTransferDetailsDate = stockTransferMaster.StockTransferDate;
                context.TblStockTransferDetail.Add(stockTransferDetail);
                if (context.SaveChanges() > 0)
                {
                    return(stockTransferDetail);
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        private TblStockInformation AddStockInformation(ERPContext context, TblStockTransferDetail stockTransferDetail, TblStockTransferMaster stockTransfertMaster, string branchCode, bool isFromBranch, decimal?voucherTypeID = 29)
        {
            try
            {
                TblStockInformation stockInformation = new TblStockInformation();
                try { stockInformation.BranchId = Convert.ToDecimal(branchCode ?? "0"); } catch { };
                stockInformation.BranchCode      = branchCode;
                stockInformation.UserId          = stockTransfertMaster.UserId;
                stockInformation.ShiftId         = stockTransfertMaster.ShiftId;
                stockInformation.TransactionDate = stockTransfertMaster.StockTransferDate;
                stockInformation.VoucherNo       = string.Empty;
                stockInformation.VoucherTypeId   = voucherTypeID;
                stockInformation.InvoiceNo       = stockTransfertMaster.StockTransferNo;
                stockInformation.ProductId       = stockTransferDetail.ProductId;
                stockInformation.ProductCode     = stockTransferDetail.ProductCode;
                stockInformation.Rate            = stockTransferDetail.Rate;
                if (isFromBranch)
                {
                    stockInformation.OutwardQty = stockTransferDetail.FQty > 0 ? stockTransferDetail.FQty : stockTransferDetail.Qty;
                }
                else
                {
                    stockInformation.InwardQty = stockTransferDetail.FQty > 0 ? stockTransferDetail.FQty : stockTransferDetail.Qty;
                }

                stockInformation.OutwardQty = stockInformation.OutwardQty ?? 0;
                stockInformation.InwardQty  = stockInformation.InwardQty ?? 0;

                context.TblStockInformation.Add(stockInformation);
                if (context.SaveChanges() > 0)
                {
                    return(stockInformation);
                }

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