private void DoDeptList()
        {
            PLANT plant = (PLANT)SessionManager.EffLocation.Plant;

            LocalOrg().DeptList = SQMModelMgr.SelectDepartmentList(entities, (decimal)plant.COMPANY_ID, (decimal)plant.BUS_ORG_ID, plant.PLANT_ID);

            uclSubLists.BindDeptList(LocalOrg().DeptList);
        }
Exemple #2
0
        private void DoDeptList()
        {
            BUSINESS_ORG busOrg = (BUSINESS_ORG)SessionManager.EffLocation.BusinessOrg;

            LocalOrg().DeptList = SQMModelMgr.SelectDepartmentList(entities, SessionManager.EffLocation.Company.COMPANY_ID, busOrg.BUS_ORG_ID, 0);

            uclSubLists.BindDeptList(LocalOrg().DeptList);
        }
        public void BindIncident(decimal incidentID)
        {
            staticIncidentID = incidentID;
            try
            {
                COST_REPORT_ITEM    item   = costReport.CostReport.COST_REPORT_ITEM.Where(l => l.INCIDENT_ID == incidentID).FirstOrDefault();
                QualityIncidentData qiData = costReport.IncidentList.Where(l => l.Incident.INCIDENT_ID == item.INCIDENT_ID).FirstOrDefault();

                lblCRIncidentIDHdr.Text = WebSiteCommon.FormatID(qiData.Incident.INCIDENT_ID, 6);

                tbCRItemQtyActual.Text = item.NCM_ACT_QTY.ToString();
                tbCRItemQtyActual.Focus();
                tbCRItemQtyAvoid.Text   = item.NCM_POT_QTY.ToString();
                tbCRUnitCostActual.Text = item.UNIT_COST.ToString();
                tbCRUnitCostAvoid.Text  = item.UNIT_COST.ToString();
                tbCRItemCostActual.Text = item.NCM_ACT_COST.ToString();
                tbCRItemCostAvoid.Text  = item.NCM_POT_COST.ToString();
                tbCRItemNote.Text       = item.NCM_COMMENTS;

                List <PLANT_LINE> lineList = SQMModelMgr.SelectPlantLineList(this.entities, (decimal)qiData.Incident.DETECT_PLANT_ID);
                ddlCRPlantLineActual.DataSource     = lineList;
                ddlCRPlantLineActual.DataValueField = "PLANT_LINE_ID";
                ddlCRPlantLineActual.DataTextField  = "PLANT_LINE_NAME";
                ddlCRPlantLineActual.DataBind();
                ddlCRPlantLineActual.Items.Insert(0, new ListItem("", "0"));
                ddlCRPlantLineAvoid.DataSource     = lineList;
                ddlCRPlantLineAvoid.DataValueField = "PLANT_LINE_ID";
                ddlCRPlantLineAvoid.DataTextField  = "PLANT_LINE_NAME";
                ddlCRPlantLineAvoid.DataBind();
                ddlCRPlantLineAvoid.Items.Insert(0, new ListItem("", "0"));

                if (ddlCRPlantLineActual.Items.FindByValue(item.DWN_ACT_LINE_ID.ToString()) != null)
                {
                    ddlCRPlantLineActual.SelectedValue = item.DWN_ACT_LINE_ID.ToString();
                }
                tbCRDowntimeRateActual.Text = item.DWN_ACT_RATE.ToString();
                tbCRDowntimeRateAvoid.Text  = item.DWN_POT_RATE.ToString();
                tbCRDowntimeActual.Text     = item.DWN_ACT.ToString();
                if (ddlCRPlantLineAvoid.Items.FindByValue(item.DWN_POT_LINE_ID.ToString()) != null)
                {
                    ddlCRPlantLineAvoid.SelectedValue = item.DWN_POT_LINE_ID.ToString();
                }
                tbCRDowntimeAvoid.Text      = item.DWN_POT.ToString();
                tbCRDowntimeCostActual.Text = item.DWN_ACT_COST.ToString();
                tbCRDowntimeCostAvoid.Text  = item.DWN_POT_COST.ToString();
                tbCRDowntimeNote.Text       = item.DWN_COMMENTS;

                List <DEPARTMENT> deptList = SQMModelMgr.SelectDepartmentList(this.entities, (decimal)qiData.Incident.DETECT_COMPANY_ID, 0, (decimal)qiData.Incident.DETECT_PLANT_ID);
                ddlCRLaborDeptActual.DataSource     = deptList;
                ddlCRLaborDeptActual.DataValueField = "DEPT_ID";
                ddlCRLaborDeptActual.DataTextField  = "DEPT_NAME";
                ddlCRLaborDeptActual.DataBind();
                ddlCRLaborDeptActual.Items.Insert(0, new ListItem("", "0"));
                ddlCRLaborDeptAvoid.DataSource     = deptList;
                ddlCRLaborDeptAvoid.DataValueField = "DEPT_ID";
                ddlCRLaborDeptAvoid.DataTextField  = "DEPT_NAME";
                ddlCRLaborDeptAvoid.DataBind();
                ddlCRLaborDeptAvoid.Items.Insert(0, new ListItem("", "0"));

                List <LABOR_TYPE> laborList = SQMModelMgr.SelectLaborTypeList(this.entities, (decimal)qiData.Incident.DETECT_COMPANY_ID, 0, (decimal)qiData.Incident.DETECT_PLANT_ID);
                ddlCRLaborTypeActual.DataSource     = laborList;
                ddlCRLaborTypeActual.DataValueField = "LABOR_TYP_ID";
                ddlCRLaborTypeActual.DataTextField  = "LABOR_NAME";
                ddlCRLaborTypeActual.DataBind();
                ddlCRLaborTypeActual.Items.Insert(0, new ListItem("", "0"));
                ddlCRLaborTypeAvoid.DataSource     = laborList;
                ddlCRLaborTypeAvoid.DataValueField = "LABOR_TYP_ID";
                ddlCRLaborTypeAvoid.DataTextField  = "LABOR_NAME";
                ddlCRLaborTypeAvoid.DataBind();
                ddlCRLaborTypeAvoid.Items.Insert(0, new ListItem("", "0"));

                if (ddlCRLaborDeptActual.Items.FindByValue(item.LABOR_ACT_DEPT_ID.ToString()) != null)
                {
                    ddlCRLaborDeptActual.SelectedValue = item.LABOR_ACT_DEPT_ID.ToString();
                }
                if (ddlCRLaborTypeActual.Items.FindByValue(item.LABOR_ACT_TYPE_ID.ToString()) != null)
                {
                    ddlCRLaborTypeActual.SelectedValue = item.LABOR_ACT_TYPE_ID.ToString();
                }
                tbCRLaborRateActual.Text = item.LABOR_ACT_RATE.ToString();
                tbCRLaborRateAvoid.Text  = item.LABOR_POT_RATE.ToString();
                tbCRLaborActual.Text     = item.LABOR_ACT.ToString();
                if (ddlCRLaborDeptAvoid.Items.FindByValue(item.LABOR_POT_DEPT_ID.ToString()) != null)
                {
                    ddlCRLaborDeptAvoid.SelectedValue = item.LABOR_POT_DEPT_ID.ToString();
                }
                if (ddlCRLaborTypeAvoid.Items.FindByValue(item.LABOR_POT_TYPE_ID.ToString()) != null)
                {
                    ddlCRLaborTypeAvoid.SelectedValue = item.LABOR_POT_TYPE_ID.ToString();
                }
                tbCRLaborAvoid.Text      = item.LABOR_POT.ToString();
                tbCRLaborCostActual.Text = item.LABOR_ACT_COST.ToString();
                tbCRLaborCostAvoid.Text  = item.LABOR_POT_COST.ToString();
                tbCRLaborNote.Text       = item.LABOR_COMMENTS;

                tbCRShipDescActual.Text = item.SHIP_ACT_TYPE.ToString();
                tbCRShipDescAvoid.Text  = item.SHIP_POT_TYPE.ToString();
                tbCRShipCostActual.Text = item.SHIP_ACT_COST.ToString();
                tbCRShipCostAvoid.Text  = item.SHIP_POT_COST.ToString();
                tbCRShipNote.Text       = item.SHIP_COMMENTS;

                tbCRIncidentCostActual.Text    = FormatValue((decimal)item.TOTAL_ACT_COST, 2);
                tbCRIncidentCostAvoid.Text     = FormatValue((decimal)item.TOTAL_POT_COST, 2);
                tbCRIncidentCostActual.Enabled = tbCRIncidentCostAvoid.Enabled = false;
                btnCRCalculate.Enabled         = true;
                tbCRTotalNote.Text             = item.TOTAL_COMMENTS;

                // copy relevant incident data to the cost report when creating new
                if (costReport.IsNew || item.EntityState == System.Data.EntityState.Added || item.EntityState == System.Data.EntityState.Detached)
                {
                    QI_OCCUR_ITEM insp = qiData.QIIssue.QI_OCCUR_ITEM.FirstOrDefault();
                    tbCRItemQtyActual.Text  = FormatValue((decimal)insp.TOTAL_NC_QTY, 2);
                    tbCRUnitCostActual.Text = tbCRUnitCostAvoid.Text = "1.0";   // td
                    tbCRItemCostActual.Text = FormatValue((decimal)insp.TOTAL_NC_QTY, 2);
                    if (qiData.Incident.DETECT_PLANT_LINE_ID.HasValue && ddlCRPlantLineActual.Items.FindByValue(qiData.Incident.DETECT_PLANT_LINE_ID.ToString()) != null)
                    {
                        PLANT_LINE line = lineList.Where(l => l.PLANT_LINE_ID == qiData.Incident.DETECT_PLANT_LINE_ID).FirstOrDefault();
                        ddlCRPlantLineActual.SelectedValue = qiData.Incident.DETECT_PLANT_LINE_ID.ToString();
                        tbCRDowntimeRateActual.Text        = FormatValue((decimal)line.DOWNTIME_RATE, 2);
                    }
                }
            }
            catch
            {
            }
        }