Exemplo n.º 1
0
        public String AddPP(PRPDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchMaterialCode", obj.PRPDBatchMaterial.MaterialCode),
                    new SqlParameter("@PRPDBatchQty", obj.PRPDBatchQty),
                    new SqlParameter("@PRPDBatchInstructedBy", obj.PRPDBatchInstructedBy.EmployeeID),
                    new SqlParameter("@PRPDBatchInstructedDate", obj.PRPDBatchInstructedDate),
                    new SqlParameter("@PRPDBatchStatus", (int)obj.Status),
                    new SqlParameter("@MRIN", obj.MRIN),
                    new SqlParameter("@Comments", obj.PRPDBatchComments),
                    new SqlParameter("@BatchType", (int)obj.Type),
                    new SqlParameter("@outParam", SqlDbType.VarChar, 50)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_Output_String(Connection, "SPADD_PRPDBatch_Initial_PROrPP", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        private void btnApprove_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult theResult = new System.Windows.Forms.DialogResult();
                theResult = MessageBox.Show(this, "Do you want to Approve this Costing File?", "Confirmation", MessageBoxButtons.YesNo);

                if (theResult == System.Windows.Forms.DialogResult.Yes)
                {
                    PRPDBatch objPRPDBatch = new PRPDBatch();
                    if (dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value != null)
                    {
                        objPRPDBatch = objPRPDBatch_DL.Get(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());

                        objPRPDBatch_DL.Update_BatchCost(objPRPDBatch.PRPDBatchID, CurrentUser.EmployeeID, (int)objPRPDBatch.Type);

                        objPRPDBatch.Status = PRPDBatch.PRPDBatchStatus.Cost;

                        objPRPDBatch_DL.UpdateStatus(objPRPDBatch);

                        Load_Batch_List();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occurred while loading PRPD Batch details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 3
0
 public frmAddPRPDActivity(User objuser, PRPDBatch objPRPDBatch)
 {
     this.objPRPDBatch = objPRPDBatch;
     CurrentUser       = objuser;
     objPRPDBatchActivity.PRPDBatchActivityID = 0;
     InitializeComponent();
 }
Exemplo n.º 4
0
        private void btnGRN_Click(object sender, EventArgs e)
        {
            try
            {
                objMTN = objMTNDL.Get(objMTN.MTNNo);

                if (objMTN.MTNStatus == MTN.Status.Cost)
                {
                    if ((objMTN != null) && (objStore != null))
                    {
                        if (objMTN.MTNItemType == MTN.ItemType.Material)
                        {
                            PRPDBatch_DL objPRPDBatch_DL = new PRPDBatch_DL(ConnectionStringClass.GetConnection());

                            PRPDBatch objPRPDBatch = objPRPDBatch_DL.Get(gvMTNList.CurrentRow.Cells["BatchID"].Value.ToString());
                            if (objPRPDBatch.Type == PRPDBatch.PRPDType.Rework)
                            {
                                objStore = objStoreDL.Get("RM_Main");
                                long GRNNO = objMTNDL.AddGRN(objMTN.MTNNo, MTN.Status.ReceviedGRN, CurrentUser.EmployeeID, objStore.StoreID, GRN.Type.Material, GRN.Status.Initial);
                                MessageBox.Show(this, "Successfully Raised a GRN. The GRNNO is : " + GRNNO.ToString(), "Successful", MessageBoxButtons.OK);
                            }
                            else
                            {
                                long GRNNO = objMTNDL.AddGRN(objMTN.MTNNo, MTN.Status.ReceviedGRN, CurrentUser.EmployeeID, objStore.StoreID, GRN.Type.Material, GRN.Status.Initial);
                                MessageBox.Show(this, "Successfully Raised a GRN. The GRNNO is : " + GRNNO.ToString(), "Successful", MessageBoxButtons.OK);
                            }
                        }
                        else if (objMTN.MTNItemType == MTN.ItemType.Basic_Product)
                        {
                            long GRNNO = objMTNDL.AddGRN(objMTN.MTNNo, MTN.Status.ReceviedGRN, CurrentUser.EmployeeID, objStore.StoreID, GRN.Type.BasicProduct, GRN.Status.Initial);
                            MessageBox.Show(this, "Successfully Raised a GRN. The GRNNO is : " + GRNNO.ToString(), "Successful", MessageBoxButtons.OK);
                        }
                        else if (objMTN.MTNItemType == MTN.ItemType.Finish_Product)
                        {
                            long GRNNO = objMTNDL.AddGRN(objMTN.MTNNo, MTN.Status.ReceviedGRN, CurrentUser.EmployeeID, objStore.StoreID, GRN.Type.FinishProduct, GRN.Status.Initial);
                            MessageBox.Show(this, "Successfully Raised a GRN. The GRNNO is : " + GRNNO.ToString(), "Successful", MessageBoxButtons.OK);
                        }


                        bindMTNList.DataSource = objMTNDL.Get_From_PRPD_Batches(Convert.ToInt64(MTN.Type.PRPD), Convert.ToInt32(MTN.Status.Cost));

                        if (gvMTNList.Rows.Count > 0)
                        {
                            DataGridViewCellEventArgs dr = new DataGridViewCellEventArgs(1, 0);

                            gvMTNList_CellClick(sender, dr);
                        }
                        else
                        {
                            bindItemList.DataSource = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
 public frmAddPRPDActivity(User objuser, PRPDBatch objPRPDBatch, PRPDBatchActivity objPRPDBatchAct)
 {
     this.objPRPDBatch    = objPRPDBatch;
     CurrentUser          = objuser;
     objPRPDBatchActivity = objPRPDBatchAct;
     InitializeComponent();
     txtComment.Text = objPRPDBatchActivity.Comments;
     //cmbSupervisedBy.SelectedValue = objPRPDBatchActivity.SupervisedBy;
 }
Exemplo n.º 6
0
        //public Decimal BatchCost(String PRPDBatchID)
        //{
        //    try
        //    {
        //        daPRPDBatchTable.Connection = Connection;

        //        return Convert.ToDecimal(daPRPDBatchTable.SPGET_PRPDBatchCost(PRPDBatchID));
        //    }

        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message, ex);
        //    }

        //    finally
        //    {
        //        daPRPDBatchTable.Dispose();

        //    }
        //}

        public PRPDBatchCollec Get()
        {
            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_PRPDBatch");

                PRPDBatchCollec objCollec = new PRPDBatchCollec();
                PRPDBatch       obj       = new PRPDBatch();

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        obj.PRPDBatchID             = Convert.ToString(dt.Rows[i]["PRPDBatchID"]);
                        obj.PRPDBatchSuperviser     = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchSuperviserID"]));
                        obj.PRPDBatchMaterial       = objMaterial_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchMaterialCode"]));
                        obj.PRPDBatchQty            = Convert.ToDecimal(dt.Rows[i]["PRPDBatchQty"]);
                        obj.PRPDBatchInstructedBy   = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchInstructedBy"]));
                        obj.PRPDBatchInstructedDate = Convert.ToDateTime(dt.Rows[i]["PRPDBatchInstructedDate"]);
                        obj.PRPDBatchStartedBy      = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchStartedBy"]));
                        obj.PRPDBatchStartDate      = Convert.ToDateTime(dt.Rows[i]["PRPDBatchStartDate"]);
                        obj.PRPDBatchApprovedBy     = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchApprovedBy"]));
                        obj.PRPDBatchApprovedDate   = Convert.ToDateTime(dt.Rows[i]["PRPDBatchApprovedDate"]);
                        obj.PRPDBatchEndBy          = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["PRPDBatchEndBy"]));
                        obj.PRPDBatchEndDate        = Convert.ToDateTime(dt.Rows[i]["PRPDBatchEndDate"]);
                        obj.Status                 = (PRPDBatch.PRPDBatchStatus)Enum.Parse(typeof(PRPDBatch.PRPDBatchStatus), Convert.ToString(dt.Rows[i]["PRPDBatchStatus"]));
                        obj.PRPDBatchMTNIN         = Convert.ToInt64(dt.Rows[i]["MTNIN"]);
                        obj.PRPDBatchMTNOUT        = objMTN_DL.Get(Convert.ToInt32(dt.Rows[i]["MTNOUT"]));
                        obj.UnitCost               = Convert.ToDecimal(dt.Rows[i]["UnitCost"]);
                        obj.PRPDBatchInspectedBy   = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["InspectedBy"]));
                        obj.PRPDBatchInspectedDate = Convert.ToDateTime(dt.Rows[i]["InspectedDate"]);
                        obj.PRPDBatchHandOverBy    = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["HandOverBy"]));
                        obj.PRPDBatchHandOverDate  = Convert.ToDateTime(dt.Rows[i]["HandOverDate"]);
                        obj.PRPDBatchFinalQty      = Convert.ToDecimal(dt.Rows[i]["FinalQty"]);
                        obj.PRPDSampleSize         = Convert.ToString(dt.Rows[i]["SampleSize"]);
                        obj.PRPDBatchComments      = Convert.ToString(dt.Rows[i]["Comments"]);
                        obj.Type = (PRPDBatch.PRPDType)Convert.ToInt64(dt.Rows[i]["BatchType"]);
                        obj.PRPDBatchTotalImpurities = Convert.ToDecimal(dt.Rows[i]["TotalImpurities"]);
                        obj.PRPDCAPID = Convert.ToDecimal(dt.Rows[i]["PRPDCAPID"]);
                        obj.MRIN      = Convert.ToInt64(dt.Rows[i]["MRIN"]);
                        if (dt.Rows[i]["OutSourceQty"] != DBNull.Value)
                        {
                            obj.OutSourceQty = Convert.ToDecimal(dt.Rows[i]["OutSourceQty"]);
                        }

                        objCollec.Add(obj);
                    }
                }

                return(objCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 7
0
        private void btnApprove_Click_1(object sender, EventArgs e)
        {
            try
            {
                DialogResult Result = new DialogResult();

                Result = MessageBox.Show(this, "Are You Sure You Want to Approve the Batch", "Approve Batch", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (Result == DialogResult.Yes)
                {
                    if (objPRPDBatch != null)
                    {
                        PRPDBatch obj = objPRPDBatch;
                        //obj = objPRPDBatch_DL.Get(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());


                        long res = GenerateMR(objPRPDBatch);
                        int  x   = 0;
                        if (res > 0)
                        {
                            obj.MRIN = res;
                            x        = objPRPDBatch_DL.UpdateMR(obj.PRPDBatchID, res);
                        }

                        obj.Status = PRPDBatch.PRPDBatchStatus.Approved;
                        obj.PRPDBatchApprovedBy = CurrentUser.UserEmp;
                        int res1 = objPRPDBatch_DL.Update_Apprve(obj);
                        if (x >= 0)
                        {
                            MessageBox.Show(this, "PRPD batch approved. MR sent to " + objStore.StoreName + "\nMR No :- " + obj.MRIN.ToString(), "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }


                        dtPRPDBatches = objPRPDBatch_DL.GetDataByState_Type((PRPDBatch.PRPDBatchStatus)Enum.Parse(typeof(PRPDBatch.PRPDBatchStatus), cmbPRPDBatchStatus.SelectedValue.ToString()), PRPDBatch.PRPDType.PrimaryPreperation);
                        dgvPRPDbatchByState.AutoGenerateColumns = false;
                        dgvPRPDbatchByState.DataSource          = objSourcePRPDBatches;
                        objSourcePRPDBatches.DataSource         = null;
                        objSourcePRPDBatches.ResetBindings(false);
                        objSourceInstructions.DataSource = null;
                        objSourceInstructions.ResetBindings(false);
                        objPRPDBatch           = null;
                        btnApprove.Enabled     = false;
                        btnBatchDelete.Enabled = false;



                        this.cmbPRPDBatchStatus_SelectedIndexChanged(sender, e);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Error occured while Approving", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 8
0
        private void btnBatchDelete_Click(object sender, EventArgs e)
        {
            try
            {
                PRPDBatch obj = objPRPDBatch;
                //obj = objPRPDBatch_DL.Get(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());
                if (obj != null)
                {
                    DialogResult dr = MessageBox.Show(this, "Are you sure you want to delete selected PRPD Batch\n\nClick Yes to delete", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

                    if (dr == DialogResult.Yes)
                    {
                        //MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection());
                        //MR objMR = objMRDL.Get(obj.MRIN);
                        //if (objMR.MRNO <= 0 || objMR.MRStatus == MR.Status.Initial || objMR.MRStatus == MR.Status.Reject)
                        {
                            int res = objPRPDBatch_DL.Delete(obj.PRPDBatchID);
                            //if (objMR.MRStatus == MR.Status.Initial)
                            //{
                            //    objMR.MRStatus = MR.Status.Reject;
                            //    objMR.MRApprovedBy = CurrentUser.UserEmp;
                            //    int x = objMRDL.Update(objMR);

                            //}

                            if (res > 0)
                            {
                                dtPRPDBatches = objPRPDBatch_DL.GetDataByState_Type((PRPDBatch.PRPDBatchStatus)Enum.Parse(typeof(PRPDBatch.PRPDBatchStatus), cmbPRPDBatchStatus.SelectedValue.ToString()), PRPDBatch.PRPDType.PrimaryPreperation);

                                dgvPRPDbatchByState.AutoGenerateColumns = false;
                                dgvPRPDbatchByState.DataSource          = objSourcePRPDBatches;
                                objSourcePRPDBatches.DataSource         = dtPRPDBatches;
                                objSourcePRPDBatches.ResetBindings(true);


                                objSourceInstructions.DataSource = null;
                                objSourceInstructions.ResetBindings(false);
                                objPRPDBatch           = null;
                                btnApprove.Enabled     = false;
                                btnBatchDelete.Enabled = false;
                            }
                        }
                        //else
                        //{
                        //    MessageBox.Show(this, "MR Approved,You cant delete this Batch Files. Please contact the system administrator", "Delete Fail", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        //}
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while deleting", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 9
0
        public int Update(PRPDBatch obj, string Original_PRPDBatchID)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchID", Original_PRPDBatchID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatch_Status", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 10
0
        private void dgvPRPDbatchByState_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    PRPDBatch obj = objPRPDBatch_DL.Get(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());

                    PRPD.frmViewPRPDBatch objFrm = new frmViewPRPDBatch(CurrentUser, obj);
                    objFrm.ShowDialog(this);
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occurred while loading PRPD Batch details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemplo n.º 11
0
        public int Update_Apprve(PRPDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchStatus", obj.Status),
                    new SqlParameter("@PRPDBatchApprovedBy", obj.PRPDBatchApprovedBy.EmployeeID),
                    new SqlParameter("@PRPDBatchID", obj.PRPDBatchID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatch_Aprrove", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 12
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);
            }
        }
Exemplo n.º 13
0
        public int UpdateStartingDetails(PRPDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchSuperviserID", obj.PRPDBatchSuperviser.EmployeeID),
                    new SqlParameter("@PRPDBatchStartedBy", obj.PRPDBatchStartedBy.EmployeeID),
                    new SqlParameter("@PRPDBatchStartDate", obj.PRPDBatchStartDate),
                    new SqlParameter("@PRPDBatchStatus", obj.Status),
                    new SqlParameter("@PRPDBatchID", obj.PRPDBatchID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatch_StartingDetails", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 14
0
        public int Update_Transfer(PRPDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@HandOverBy", obj.PRPDBatchHandOverBy.EmployeeID),
                    new SqlParameter("@MTNOUT", obj.PRPDBatchMTNOUT.MTNNo),
                    new SqlParameter("@UnitCost", obj.UnitCost),
                    new SqlParameter("@PRPDBatchStatus", (int)obj.Status),
                    new SqlParameter("@PRPDBatchID", obj.PRPDBatchID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatch_Transfer", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 15
0
        public int Update_Finish(PRPDBatch obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchEndBy", obj.PRPDBatchEndBy.EmployeeID),
                    new SqlParameter("@FinalQty", obj.PRPDBatchFinalQty),
                    new SqlParameter("@TotalImpurities", obj.PRPDBatchTotalImpurities),
                    new SqlParameter("@SampleSize", obj.PRPDSampleSize),
                    new SqlParameter("@PRPDBatchStatus", obj.Status),
                    new SqlParameter("@PRPDBatchID", obj.PRPDBatchID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PRPDBatch_Finish", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemplo n.º 16
0
 public frmPRPDQCReport(PRPDBatch obj)
 {
     InitializeComponent();
     objPRPDBatch = obj;
 }
Exemplo n.º 17
0
        private void cmbPRPDBatchID_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbPRPDBatchID.Items.Count != 0)
            {
                try
                {
                    bool IsStart = false;

                    objPRPDBatch = objPRPDBatch_DL.Get(cmbPRPDBatchID.SelectedValue.ToString());

                    gvActivity.AutoGenerateColumns = false;
                    bindActivities.DataSource      = objPRPDBatchActivity_DL.GetView(objPRPDBatch.PRPDBatchID);
                    gvActivity.DataSource          = bindActivities;
                    bindActivities.ResetBindings(true);

                    txtMaterial.Text = objPRPDBatch.PRPDBatchMaterial.MaterialCode + " - " + objPRPDBatch.PRPDBatchMaterial.MaterialDescription;

                    MR obj = new MR();
                    obj = objMR_DL.Get(objPRPDBatch.MRIN);

                    if (obj.MRStatus == MR.Status.Recevied)
                    {
                        IsStart = true;
                    }


                    MRMaterial_DL objMRMaterialDL = new MRMaterial_DL(ConnectionStringClass.GetConnection());
                    MRMaterial    objMRMat        = objMRMaterialDL.Get(objPRPDBatch.MRIN, objPRPDBatch.PRPDBatchMaterial.MaterialCode);

                    if (objMRMat.IssuedQty <= 0)
                    {
                        IsStart = false;
                    }


                    if (objPRPDBatch.Type == PRPDBatch.PRPDType.Rework)
                    {
                        lblTitle.Text       = "Rework - " + objPRPDBatch.PRPDBatchID;
                        txtNote.Text        = obj.MRNO.ToString() + " - " + obj.MRStatus.ToString();
                        txtReceivedQty.Text = objMRMaterialDL.Get(obj.MRNO, objPRPDBatch.PRPDBatchMaterial.MaterialCode).IssuedQty.ToString();
                        lblNote.Text        = "MRNO";
                        lblUnit4.Text       = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    }
                    else if (objPRPDBatch.Type == PRPDBatch.PRPDType.PrimaryOutsource)
                    {
                        lblTitle.Text       = "Primary Outsource - " + objPRPDBatch.PRPDBatchID;
                        txtNote.Text        = obj.MRNO.ToString() + " - " + obj.MRStatus.ToString();
                        txtReceivedQty.Text = objMRMaterialDL.Get(obj.MRNO, objPRPDBatch.PRPDBatchMaterial.MaterialCode).IssuedQty.ToString();
                        lblNote.Text        = "MRNO";
                        lblUnit4.Text       = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    }
                    else if (objPRPDBatch.Type == PRPDBatch.PRPDType.PrimaryPreperation)
                    {
                        lblTitle.Text = "Preperation - " + objPRPDBatch.PRPDBatchID;

                        txtNote.Text        = obj.MRNO.ToString() + " - " + obj.MRStatus.ToString();
                        txtReceivedQty.Text = objMRMaterialDL.Get(obj.MRNO, objPRPDBatch.PRPDBatchMaterial.MaterialCode).IssuedQty.ToString();
                        lblNote.Text        = "MRNO";
                        lblUnit4.Text       = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    }

                    if (IsStart)
                    {
                        btnStartBatch.Enabled          = true;
                        tbcPRPDBatchProduction.Enabled = true;

                        if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Started)
                        {
                            tbcPRPDBatchProduction.Enabled = true;
                            btnStartBatch.Enabled          = false;

                            cmbSupervisedBy.Enabled = false;
                        }
                        else if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Approved)
                        {
                            tbcPRPDBatchProduction.Enabled = false;
                            btnStartBatch.Enabled          = true;
                        }
                    }
                    else
                    {
                        btnStartBatch.Enabled          = false;
                        tbcPRPDBatchProduction.Enabled = false;
                    }



                    dtMainActtivity_PRPD = objMainActivity_DL.Get_Data_PRPD_Activity(objPRPDBatch.PRPDBatchID);

                    cmbActivity.DataSource = dtMainActtivity_PRPD;

                    if (dtMainActtivity_PRPD.Rows.Count != 0)
                    {
                        cmbActivity.SelectedIndex = 0;
                    }

                    objPRPDBatch = objPRPDBatch_DL.Get(cmbPRPDBatchID.SelectedValue.ToString());


                    txtMaterial.Text = objPRPDBatch.PRPDBatchMaterial.MaterialCode + " - " + objPRPDBatch.PRPDBatchMaterial.MaterialDescription;

                    txtInstructedBy.Text = objPRPDBatch.PRPDBatchInstructedBy.EmployeeName;
                    txtQuantity.Text     = objPRPDBatch.PRPDBatchQty.ToString();
                    dtpCreatedDate.Value = objPRPDBatch.PRPDBatchInstructedDate;

                    //Load Instructions

                    dtPRPDBatchActivityInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(cmbPRPDBatchID.SelectedValue.ToString());

                    objSourceActInstructions.DataSource = dtPRPDBatchActivityInstructions;

                    dgvActivityInstructions.AutoGenerateColumns = false;
                    dgvActivityInstructions.DataSource          = objSourceActInstructions;
                    objSourceActInstructions.ResetBindings(true);


                    txtBatchState.Text     = Enum.GetName(typeof(PRPDBatch.PRPDBatchStatus), objPRPDBatch.Status).ToString();
                    lblUnit.Text           = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    bindReports.DataSource = objQCReport_DL.GetView_PRPD(objPRPDBatch.PRPDBatchID);
                    if (objQCReport_DL.IsPRPDBatchAccept(objPRPDBatch.PRPDBatchID, (int)QCReport.ReportStatus.Accept))
                    {
                        grpFinalizeDetails.Enabled = true;
                    }
                    else
                    {
                        grpFinalizeDetails.Enabled = false;
                    }

                    lblUnit1.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    lblUnit2.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    lblUnit3.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    lblUnitSample.Text   = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    txtOutsourceQty.Text = "0";


                    //Load Reports

                    Load_Reports();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Exemplo n.º 18
0
        private void dgvPRPDbatchByState_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    objSourceInstructions.DataSource = null;
                    txtPRPDBatch.Text = dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString();
                    objPRPDBatch      = objPRPDBatch_DL.Get(txtPRPDBatch.Text);

                    dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text);

                    dgvActivityInstructions.AutoGenerateColumns = false;
                    dgvActivityInstructions.DataSource          = objSourceInstructions;
                    objSourceInstructions.DataSource            = dtPRPDBatchInstructions;
                    objSourceInstructions.ResetBindings(true);

                    MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection());

                    if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Approved)
                    {
                        if (objMRDL.Get(objPRPDBatch.MRIN).MRStatus == MR.Status.Reject)
                        {
                            btnSendMR.Enabled      = true;
                            btnSendMR.Visible      = true;
                            btnBatchDelete.Enabled = true;
                            btnApprove.Enabled     = false;
                        }
                        else
                        {
                            btnSendMR.Enabled      = false;
                            btnBatchDelete.Enabled = false;
                            btnApprove.Enabled     = false;
                        }
                    }
                    else if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Created)
                    {
                        btnSendMR.Enabled      = false;
                        btnSendMR.Visible      = false;
                        btnBatchDelete.Enabled = true;
                        btnApprove.Enabled     = true;
                    }
                    else
                    {
                        btnSendMR.Enabled      = false;
                        btnSendMR.Visible      = false;
                        btnBatchDelete.Enabled = false;
                        btnApprove.Enabled     = false;
                    }

                    if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Started)
                    {
                        if (dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value != null)
                        {
                            objQCReport = objQCReport_DL.Get_PRPD_Quality_Passed(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());
                            if (objQCReport == null)
                            {
                                btnEditMode.Enabled = true;
                            }
                            else
                            {
                                btnEditMode.Enabled = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            PRPDBatch objPRPDBatch = new PRPDBatch();

            DialogResult dr = MessageBox.Show(this, "Are you sure you want to Create a PRPD Batch?\n\nThis will Create a new PRPD Batch and send to approval\nClick Yes to Create", "Confirmation ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (dr == DialogResult.Yes)
            {
                if (cmbMaterial.SelectedValue == null)
                {
                    MessageBox.Show(this, "Please select a material", "Empty Fields", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (txtNewBatchQuantity.Text.Equals(""))
                {
                    MessageBox.Show(this, "Please enter a Quantity", "Empty Fields", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (Convert.ToDecimal(txtNewBatchQuantity.Text) <= 0)
                {
                    MessageBox.Show(this, "Please enter a valid Quantity", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    try
                    {
                        objPRPDBatch.PRPDBatchInstructedBy   = CurrentUser.UserEmp;
                        objPRPDBatch.PRPDBatchInstructedDate = DateTime.Today;
                        objPRPDBatch.PRPDBatchMaterial       = objMaterial_DL.Get(cmbMaterial.SelectedValue.ToString());
                        objPRPDBatch.PRPDBatchQty            = Convert.ToDecimal(txtNewBatchQuantity.Text);
                        objPRPDBatch.MRIN   = 0;
                        objPRPDBatch.Status = PRPDBatch.PRPDBatchStatus.Created;
                        if (rdbPP.Checked == true)
                        {
                            objPRPDBatch.Type = PRPDBatch.PRPDType.PrimaryPreperation;
                        }
                        else if (rdbPPOutsource.Checked == true)
                        {
                            objPRPDBatch.Type = PRPDBatch.PRPDType.PrimaryOutsource;
                        }
                        else
                        {
                            objPRPDBatch.Type = PRPDBatch.PRPDType.Rework;
                        }
                        objPRPDBatch.PRPDBatchComments = "N/A";

                        String PRPDID = objPRPDBatch_DL.AddPP(objPRPDBatch);


                        if (PRPDID != null)
                        {
                            objPRPDBatch.PRPDBatchID = PRPDID;
                            foreach (PRPDBatchActivityInstructions _obj in objPRPDBatchActivityInstructionsCollec)
                            {
                                _obj.PRPDBatch = objPRPDBatch;

                                objPRPDBatchActivityInstructions_DL.Add(_obj);
                            }

                            //long res = GenerateMR(objPRPDBatch);
                            //int x = 0;
                            //if (res > 0)
                            //{
                            //    objPRPDBatch.MRIN = res;
                            //    x = objPRPDBatch_DL.UpdateMR(objPRPDBatch.PRPDBatchID, res);

                            //}
                            //if (x > 0)
                            //{
                            MessageBox.Show(this, "Successfully Created a PRPD Batch \n\nPRPD Batch ID :- " + PRPDID, "Successfull Created", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            frmPRPDBatchCreatePreperation objFrm = new frmPRPDBatchCreatePreperation(CurrentUser);
                            objFrm.MdiParent = this.MdiParent;

                            this.Close();
                            objFrm.Show();



                            //}
                            //else
                            //{
                            //    objPRPDBatch_DL.Delete(PRPDID);
                            //    MessageBox.Show(this, "Error occuerd while saving, PRPD batch does not save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            //}
                        }
                        else
                        {
                            MessageBox.Show(this, "Error occuerd while saving, PRPD batch does not save", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, "Error occuerd while saving,Please check the enterd data", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Exemplo n.º 20
0
        private void cmbPRPDBatch_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbPRPDBatch.SelectedValue != null)
            {
                try
                {
                    objPRPDBatch = objPRPDBatch_DL.Get(cmbPRPDBatch.SelectedValue.ToString());


                    dtPRPDBatchActivity = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(cmbPRPDBatch.SelectedValue.ToString());

                    dgvActivities.AutoGenerateColumns     = false;
                    dgvActivities.DataSource              = objSourcePRPDBatchActivity;
                    objSourcePRPDBatchActivity.DataSource = dtPRPDBatchActivity;
                    objSourcePRPDBatchActivity.ResetBindings(true);
                    txtAddedUnitCost.Text = objPRPDBatch_DL.UnitPrice(objPRPDBatch.PRPDBatchID).ToString();


                    txtBatchState.Text = Enum.GetName(typeof(PRPDBatch.PRPDBatchStatus), objPRPDBatch.Status);

                    txtMRNo.Text         = objPRPDBatch.MRIN.ToString();
                    txtUnitPrice.Text    = objMRMaterial_DL.Get(objPRPDBatch.MRIN, objPRPDBatch.PRPDBatchMaterial.MaterialCode).UniRate.ToString();
                    txtMaterialCode.Text = objPRPDBatch.PRPDBatchMaterial.MaterialCode;
                    txtMaterialName.Text = objPRPDBatch.PRPDBatchMaterial.MaterialNameCode;

                    txtStartDate.Text = objPRPDBatch.PRPDBatchInstructedDate.ToShortDateString();

                    txtStopDate.Text       = objPRPDBatch.PRPDBatchEndDate.ToShortDateString();
                    txtPRPDBatchQty.Text   = objPRPDBatch.PRPDBatchFinalQty.ToString();
                    txtInstructedBy.Text   = objPRPDBatch.PRPDBatchInstructedBy.EmployeeName;
                    txtAfterReworkQty.Text = objPRPDBatch.PRPDBatchFinalQty.ToString();
                    txtDescription.Text    = objPRPDBatch.PRPDBatchComments;
                    lblUnit.Text           = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                    lblUnit1.Text          = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;


                    if (objPRPDBatch.Type == PRPDBatch.PRPDType.Rework)
                    {
                        objProcessed     = objMaterial_DL.GetDryMaterial(objPRPDBatch.PRPDBatchMaterial.MaterialCode);
                        txtMaterial.Text = objProcessed.MaterialCode + " - " + objProcessed.MaterialDescription;
                    }
                    else
                    {
                        objProcessed     = objMaterial_DL.GetProcessdMaterial(objPRPDBatch.PRPDBatchMaterial.MaterialCode);
                        txtMaterial.Text = objProcessed.MaterialCode + " - " + objProcessed.MaterialDescription;
                    }

                    if (objProcessed.MaterialCode == null)
                    {
                        btnTransfer.Enabled = false;
                    }
                    else
                    {
                        btnTransfer.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }
Exemplo n.º 21
0
 public frmViewPRPDBatch(User objUser, PRPDBatch objPRPDBatch)
 {
     this.objPRPDBatch = objPRPDBatch;
     InitializeComponent();
     CurrentUser = objUser;
 }
Exemplo n.º 22
0
        private void frmQC_Load(object sender, EventArgs e)
        {
            try
            {
                if (objQCReport != null)
                {
                    cmbTestBy.DataSource      = objEmployee_DL.Get_By_DepType("LAB", true);
                    cmbRDQAOfficer.DataSource = objEmployee_DL.Get_By_DepType("LAB", true);
                    cmbAnalizedBy.DataSource  = objEmployee_DL.Get_By_DepType("LAB", true);
                    cmbParameter.DataSource   = objTestParameter_DL.GetView(objQCReport.ReportType);
                    bindDetails.DataSource    = objQCReportDetails_DL.GetView(objQCReport.QCReportID);

                    if (objQCReport.ReportType.Equals("RPD"))
                    {
                        txtBatch.Text          = objQCReport.RPDBatchID;
                        objRPDBatch            = objRPDBatch_DL.Get(objQCReport.RPDBatchID);
                        cmbMaterial.DataSource = objMaterial_DL.GetDataViewIntermediates(objRPDBatch.RPDBatchMaterial.MaterialCode);
                        //cmbMaterial.DataSource = objMaterial_DL.Get_RPD_DataView(objQCReport.RPDBatchID);
                        txtBatch.Text = objRPDBatch.RPDBatchID;
                    }
                    else if (objQCReport.ReportType.Equals("PRPD"))
                    {
                        txtBatch.Text          = objQCReport.RPDBatchID;
                        objPRPDBatch           = objPRPDBatch_DL.Get(objQCReport.PRPDBatchID);
                        cmbMaterial.DataSource = objMaterial_DL.GetDataViewIntermediates(objPRPDBatch.PRPDBatchMaterial.MaterialCode);
                        txtBatch.Text          = objPRPDBatch.PRPDBatchID;
                    }

                    else if (objQCReport.ReportType.Equals("PRODUCTION"))
                    {
                        txtBatch.Text = objQCReport.ProductionBatchID;
                        objBatch      = objBatch_DL.Get(objQCReport.ProductionBatchID);
                        //cmbMaterial.DataSource = objMaterial_DL.GetDataViewIntermediates("", "", objPRPDBatch.PRPDBatchMaterial.MaterialCode);
                        lblItem.Text = "Product";
                        BasicProductCollec objCollec = new BasicProductCollec();
                        objCollec.Add(objBatch.StandardBatch.STDBatchBasicProduct);


                        cmbMaterial.DataSource    = objCollec;
                        cmbMaterial.DisplayMember = "Code";
                        cmbMaterial.ValueMember   = "BasicProductCode";
                    }
                    txtReportID.Text   = objQCReport.QCReportID.ToString();
                    txtReportType.Text = objQCReport.ReportType;
                    txtSampleSize.Text = objQCReport.SampleSize;
                    txtSendBy.Text     = objEmployee_DL.Get(objQCReport.SendBy).EmployeeNameID;
                    txtSendDate.Text   = objQCReport.SendDate.Value.ToShortDateString();
                    if (objQCReport.RDQAOfficer != null)
                    {
                        cmbRDQAOfficer.SelectedValue = objQCReport.RDQAOfficer;
                    }

                    if (objQCReport.AnalyzedBy != null)
                    {
                        cmbAnalizedBy.SelectedValue = objQCReport.AnalyzedBy;
                    }

                    if (objQCReport.TestBy != null)
                    {
                        cmbTestBy.SelectedValue = objQCReport.TestBy;
                    }
                    txtRemarks.Text = objQCReport.Remarks;

                    if (objQCReport.Status != Convert.ToInt32(QCReport.ReportStatus.Initial))
                    {
                        grpDetails.Enabled = false;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }