Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbActivity.SelectedValue == null)
                {
                    MessageBox.Show(this, "Please Fill All Fields", "Fill Records", MessageBoxButtons.OK);
                }
                else
                {
                    PRPDBatchActivityInstructions obj = new PRPDBatchActivityInstructions();

                    obj.Activity = objMainActivity_DL.Get(Convert.ToInt64(cmbActivity.SelectedValue));
                    if (cmbMachine.SelectedValue != null)
                    {
                        obj.Machine     = objMachine_DL.Get(cmbMachine.SelectedValue.ToString());
                        obj.MachineCode = obj.Machine.MachineCode;
                    }
                    else
                    {
                        obj.MachineCode = "No Machine";
                    }

                    obj.ParticleSize = "N/A";
                    if (txtInstruction.Text != "")
                    {
                        obj.InstructionDesc = txtInstruction.Text;
                    }
                    else
                    {
                        obj.InstructionDesc = "No";
                    }
                    obj.PRPDBatch = objPRPDBatch_DL.Get(txtPRPDBatch.Text);

                    objPRPDBatchActivityInstructions_DL.Add(obj);

                    dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text);

                    dgvActivityInstructions.AutoGenerateColumns = false;
                    dgvActivityInstructions.DataSource          = objSourceInstructions;
                    objSourceInstructions.DataSource            = dtPRPDBatchInstructions;
                    objSourceInstructions.ResetBindings(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
        private void dgvPRPDbatchByState_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    PRPDBatch obj = objPRPDBatch_DL.Get(dgvPRPDbatchByState.Rows[e.RowIndex].Cells["PRPDBatchID"].Value.ToString());

                    frmRptPRPDBatchCost objFrm = new  frmRptPRPDBatchCost(CurrentUser, obj.PRPDBatchID);
                    objFrm.ShowDialog(this);

                    Load_Batch_List();
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occurred while loading PRPD Batch details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Пример #4
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);
                }
            }
        }
Пример #5
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());
                }
            }
        }
Пример #6
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);
            }
        }