Ejemplo n.º 1
0
        public long GenerateMR(PRPDBatch objPRPD)
        {
            MR objMR = new MR();
            MRMaterialCollec      objMRMatCollec           = new MRMaterialCollec();
            MRFinishProductCollec objMRFinishProductCollec = new MRFinishProductCollec();
            MRBasicProductCollec  objMRBasicProductCollec  = new MRBasicProductCollec();
            BatchMR       objBatchMR      = new BatchMR();
            Department_DL objDepDL        = new Department_DL(ConnectionStringClass.GetConnection());
            MR_DL         objMRDL         = new MR_DL(ConnectionStringClass.GetConnection());
            MRMaterial_DL objMRMaterialDL = new MRMaterial_DL(ConnectionStringClass.GetConnection());
            Store_DL      objStoreDL      = new Store_DL(ConnectionStringClass.GetConnection());

            try
            {
                objMR.MRDate           = DateTime.Now;
                objMR.MRDepartmentFrom = objDepDL.GetByDepType("PRPD");
                objMR.MREnterdBy       = CurrentUser.EmployeeID;
                objMR.MRStatus         = MR.Status.Initial;

                objMR.MRStore    = objStore;
                objMR.MRType     = MR.Type.Material;
                objMR.MRRemarks  = "Material Requition(Materials) for PRPD Batch NO " + objPRPD.PRPDBatchID.ToString();
                objMR.OriginType = MR.Origin.ToBatch;

                MRMaterial obj = new MRMaterial();
                obj.Description = "PRPD Batch Material Requition";
                obj.Material    = objPRPD.PRPDBatchMaterial;
                obj.MRBINNo     = "";
                obj.ReqdQty     = objPRPD.PRPDBatchQty;


                long MRNO = objMRDL.Add_M(objMR);
                if (MRNO > 0)
                {
                    objMR.MRNO = MRNO;
                    obj.MR     = objMR;
                    objMRMaterialDL.Add(obj);
                }
                return(MRNO);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Ejemplo n.º 2
0
        public MRFinishProductCollec Get(long MRNO)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@MRNO", MRNO)
                };



                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_MRFinishProducts_ByMRNO", paramList);

                MRFinishProductCollec objMRFinishProductCollec = new MRFinishProductCollec();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MRFinishProduct objMRFinishProduct = new MRFinishProduct();
                    objMRFinishProduct.FinishProduct = objFinishProduct_DL.Get(Convert.ToString(dt.Rows[i]["MRFinishProductID"]));
                    objMRFinishProduct.Description   = Convert.ToString(dt.Rows[i]["MRDescription"]);
                    objMRFinishProduct.MR            = objMR_DL.Get(Convert.ToInt64(dt.Rows[i]["MRNO"]));
                    objMRFinishProduct.MRBINNo       = Convert.ToString(dt.Rows[i]["MRBINNo"]);
                    objMRFinishProduct.ReqdQty       = Convert.ToDecimal(dt.Rows[i]["ReqdQty"]);
                    objMRFinishProduct.IssuedQty     = Convert.ToDecimal(dt.Rows[i]["IssuedQty"]);
                    objMRFinishProduct.UnitCode      = "Nos";


                    if (dt.Rows[i]["MRUnitRate"] != DBNull.Value)
                    {
                        objMRFinishProduct.UniRate = Convert.ToDecimal(dt.Rows[i]["MRUnitRate"]);
                    }
                    else
                    {
                        objMRFinishProduct.UniRate = 0;
                    }

                    objMRFinishProductCollec.Add(objMRFinishProduct);
                }
                return(objMRFinishProductCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Ejemplo n.º 3
0
        public MRFinishProductCollec Get()
        {
            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_MRFinishProduct");

                MRFinishProductCollec objMRFinishProductCollec = new MRFinishProductCollec();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MRFinishProduct objMRFinishProduct = new MRFinishProduct();
                    objMRFinishProduct.FinishProduct = objFinishProduct_DL.Get(Convert.ToString(dt.Rows[i]["MRFinishProductID"]));
                    objMRFinishProduct.Description   = Convert.ToString(dt.Rows[i]["MRDescription"]);
                    objMRFinishProduct.MR            = objMR_DL.Get(Convert.ToInt64(dt.Rows[i]["MRIssuedQty"]));
                    objMRFinishProduct.MRBINNo       = Convert.ToString(dt.Rows[i]["MRIssuedQty"]);
                    objMRFinishProduct.ReqdQty       = Convert.ToDecimal(dt.Rows[i]["MRIssuedQty"]);
                    objMRFinishProduct.IssuedQty     = Convert.ToDecimal(dt.Rows[i]["MRIssuedQty"]);
                    //objMRFinishProduct.UniRate = Convert.ToDecimal(dr.MRUnitRate);

                    if (dt.Rows[i]["MRIssuedQty"] != null)
                    {
                        objMRFinishProduct.UniRate = Convert.ToDecimal(dt.Rows[i]["MRIssuedQty"]);
                    }
                    else
                    {
                        objMRFinishProduct.UniRate = 0;
                    }

                    objMRFinishProductCollec.Add(objMRFinishProduct);
                }
                return(objMRFinishProductCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }