Example #1
0
        private void Load_MRItem()
        {
            if (gvMRList.SelectedRows.Count > 0)
            {
                try
                {
                    //if (e.RowIndex >= 0)
                    {
                        bindItemList.DataSource = null;
                        long MRNO      = Convert.ToInt64(gvMRList.SelectedRows[0].Cells["MRNO"].Value);
                        MR   objMRTemp = objMRDL.Get(MRNO);

                        objMR = new MR();
                        objMR = objMRTemp;

                        DataTable dt = new DataTable();

                        if (objMRTemp.MRType == MR.Type.Material)
                        {
                            dt = objMRMaterialDL.GetDataView(objMRTemp.MRNO);
                        }
                        if (objMRTemp.MRType == MR.Type.BasicProduct)
                        {
                            dt = objMRBasicProduct_DL.GetBasicProductList(objMRTemp.MRNO);
                        }

                        if (objMRTemp.MRType == MR.Type.FinishProduct)
                        {
                            dt = objMRFinishProduct_DL.GetData_View(objMRTemp.MRNO);
                        }


                        if (dt.Rows.Count > 0)
                        {
                            bindItemList.DataSource = dt;

                            gvItemList.AutoGenerateColumns = false;
                            gvItemList.DataSource          = bindItemList;
                            bindItemList.ResetBindings(true);
                        }
                        else
                        {
                            bindItemList.DataSource = null;

                            gvItemList.AutoGenerateColumns = false;
                            gvItemList.DataSource          = bindItemList;
                            bindItemList.ResetBindings(true);
                        }

                        txtDepartment.Text = objMR.MRDepartmentFrom.DepName;

                        ItemSelect = true;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        private void btnSendMR_Click(object sender, EventArgs e)
        {
            try
            {
                int NewMRNO = 0;

                if (rdbMaterial.Checked == true)
                {
                    NewMRNO = objMRDL.Add_BatchMR_Partial(cmbPart.Text, cmbBatchNo.SelectedValue.ToString(), objStore.StoreID, CurrentUser.EmployeeID, DepID, "MR For Batch No  " + cmbBatchNo.SelectedValue.ToString(), MR.Status.Initial, MR.Type.Material, (int)MR.Origin.ToBatch);
                }
                else
                {
                    NewMRNO = objMRDL.Add_BatchMR_Partial(cmbPart.Text, cmbBatchNo.SelectedValue.ToString(), objStore.StoreID, CurrentUser.EmployeeID, DepID, "MR For Batch No  " + cmbBatchNo.SelectedValue.ToString(), MR.Status.Initial, MR.Type.BasicProduct, (int)MR.Origin.ToBatch);
                }
                if (rdbMaterial.Checked == true)
                {
                    foreach (MRMaterial obj in objMRMaterialCollec)
                    {
                        obj.MR = objMRDL.Get(NewMRNO);

                        objMRMaterialDL.Add(obj);
                    }

                    objMRMaterialCollec.Clear();
                }

                if (rdbSemiFinished.Checked == true)
                {
                    foreach (MRBasicProduct obj in objMRBasicProductCollec)
                    {
                        obj.MR = objMRDL.Get(NewMRNO);

                        objMRBasicProductDL.Add(obj);
                    }

                    objMRBasicProductCollec.Clear();
                }

                if (NewMRNO > 0)
                {
                    MessageBox.Show(this, "MR is sent to RPD Stores. MRNO is : " + NewMRNO.ToString(), "Successful", MessageBoxButtons.OK);

                    if (rdbMaterial.Checked == true)
                    {
                        LoadMaterialList();
                    }
                    else
                    {
                        LoadSemiFinishedList();
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Example #3
0
        private void gvMRList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    bindItemList.DataSource = null;
                    long MRNO      = Convert.ToInt64(gvMRList.Rows[e.RowIndex].Cells[0].Value);
                    MR   objMRTemp = objMRDL.Get(MRNO);

                    objMR              = new MR();
                    objMR              = objMRTemp;
                    txtDate.Text       = objMRTemp.MRDate.ToShortDateString();
                    txtDepartment.Text = objMRTemp.MRDepartmentFrom.DepName;
                    txtMRNo.Text       = objMRTemp.MRNO.ToString();
                    txtRemarks.Text    = objMRTemp.MRRemarks;
                    txtReqestBy.Text   = objMRTemp.MREnterdBy;
                    txtType.Text       = objMRTemp.MRType.ToString();

                    if (objMR.MRType == MR.Type.Material)
                    {
                        bindItemList.DataSource = objMRMaterialDL.GetDataView(objMRTemp.MRNO);
                    }
                    else
                    {
                        bindItemList.DataSource = objMRBasicProductDL.GetDataView(objMRTemp.MRNO);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        private void gvMRList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    bindItemList.DataSource = null;
                    long MRNO      = Convert.ToInt64(gvMRList.Rows[e.RowIndex].Cells[0].Value);
                    MR   objMRTemp = objMRDL.Get(MRNO);

                    objMR = new MR();
                    objMR = objMRTemp;

                    //   objMRTemp.MRType = MR.Type.Material;

                    if (objMRTemp.MRType == MR.Type.Material)
                    {
                        bindItemList.DataSource = objMRMaterialDL.Get(objMRTemp.MRNO);
                    }

                    if (objMRTemp.MRType == MR.Type.BasicProduct)
                    {
                        bindItemList.DataSource = objMRBasicProduct_DL.Get(objMRTemp.MRNO);
                    }

                    if (objMRTemp.MRType == MR.Type.FinishProduct)
                    {
                        bindItemList.DataSource = objMRFinishProductDL.Get(objMRTemp.MRNO);
                    }

                    txtapprovedBy.Text    = objMR.MRApprovedBy;
                    txtApprovedDate.Text  = objMR.MRApprovedDate.ToShortDateString();
                    txtDate.Text          = objMR.MRDate.ToShortDateString();
                    txtDepartment.Text    = objMR.MRDepartmentFrom.DepName;
                    txtMRNO.Text          = objMR.MRNO.ToString();
                    txtRemarks.Text       = objMR.MRRemarks;
                    txtRequestedBy.Text   = objMR.MREnterdBy;
                    txtRequestedDate.Text = objMR.MRDate.ToShortDateString();

                    ItemSelect = true;

                    if (objMR.Print == true)
                    {
                        btnPrint.Enabled = false;
                    }
                    else
                    {
                        btnPrint.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private void frmViewPRPDBatch_Load(object sender, EventArgs e)
        {
            try
            {
                Load_Activity();
                Load_QC();
                Load_Instructions();
                //bool IsStart = false;
                if (objPRPDBatch.Type == PRPDBatch.PRPDType.Rework)
                {
                    lblTitle.Text = "Rework - " + objPRPDBatch.PRPDBatchID;

                    MTN obj = objMTN_DL.Get(objPRPDBatch.PRPDBatchMTNIN);
                    txtNote.Text = obj.MTNNo.ToString() + " - " + obj.MTNStatus.ToString();
                    lblNote.Text = "MTN NO";
                }
                else if (objPRPDBatch.Type == PRPDBatch.PRPDType.PrimaryOutsource)
                {
                    lblTitle.Text = "Primary Outsource - " + objPRPDBatch.PRPDBatchID;
                    MTN obj = objMTN_DL.Get(objPRPDBatch.PRPDBatchMTNIN);


                    txtNote.Text = obj.MTNNo.ToString() + " - " + obj.MTNStatus.ToString();
                    lblNote.Text = "MTN NO";
                }
                else if (objPRPDBatch.Type == PRPDBatch.PRPDType.PrimaryPreperation)
                {
                    lblTitle.Text = "Preperation - " + objPRPDBatch.PRPDBatchID;

                    MR obj = objMR_DL.Get(objPRPDBatch.MRIN);
                    txtNote.Text = obj.MRNO.ToString() + " - " + obj.MRStatus.ToString();
                    lblNote.Text = "MR NO";
                }



                dtMainActtivity_PRPD = objMainActivity_DL.Get_Data_PRPD_Activity(objPRPDBatch.PRPDBatchID);


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


                txtMaterial.Text     = objPRPDBatch.PRPDBatchMaterialName;
                txtInstructedBy.Text = objPRPDBatch.PRPDBatchInstructedBy.EmployeeName;
                txtQuantity.Text     = objPRPDBatch.PRPDBatchQty.ToString();

                //Load Instructions

                dtPRPDBatchActivityInstructions     = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(objPRPDBatch.PRPDBatchID);
                objSourceActInstructions.DataSource = dtPRPDBatchActivityInstructions;
                objSourceActInstructions.ResetBindings(true);
                txtBatchState.Text   = Enum.GetName(typeof(PRPDBatch.PRPDBatchStatus), objPRPDBatch.Status).ToString();
                lblUnit.Text         = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                lblUnit1.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                lblUnit2.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                lblUnit3.Text        = objPRPDBatch.PRPDBatchMaterial.MatUnit.UnitCode;
                txtDate.Text         = objPRPDBatch.PRPDBatchStartDate.ToShortDateString();
                txtBatchNo.Text      = objPRPDBatch.PRPDBatchID;
                txtCreateDate.Text   = objPRPDBatch.PRPDBatchInstructedDate.ToShortDateString();
                txtSupervisedBy.Text = objPRPDBatch.PRPDBatchSuperviser.EmployeeNameID;
                txtHandedOver.Text   = objPRPDBatch.PRPDBatchHandOverBy.EmployeeNameID;
                txtInspected.Text    = objPRPDBatch.PRPDBatchInspectedBy.EmployeeNameID;
                txtFinalQty.Text     = objPRPDBatch.PRPDBatchFinalQty.ToString();
                txtImpurities.Text   = objPRPDBatch.PRPDBatchTotalImpurities.ToString();
                txtSampleSize.Text   = objPRPDBatch.PRPDSampleSize.ToString();

                if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Finished || objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Transfered)
                {
                    btnCost.Enabled = true;
                }
                else
                {
                    btnCost.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #6
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);
                }
            }
        }
Example #7
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());
            }
        }