Beispiel #1
0
 private void BindCPRGrid(DataTable cprData)
 {
     ds = FixCPRData(cprData);
     CPRGridView.DataSource = cprData;
     CPRGridView.DataBind();
     ATotalsGridView.DataSource = ds.Tables[0];
     ATotalsGridView.DataBind();
 }
Beispiel #2
0
    protected void BindPage()
    {
        Pager1.InitPager(ItemGrid, pagesize);
        string    CurItem = ItemGrid.Items[0].Cells[0].Text.Split(new Char[] { ' ' })[1].ToString();
        DataTable cprData = new DataTable();

        if (VMIRun.Value != "True")
        {
            // Process standard page
            VMIPanel.Visible    = false;
            ItemPanel.Visible   = true;
            VendorPanel.Visible = true;
            cprData             = cpr.GetGPRGridData(CurItem, (decimal)Session["CPRFactor"], HiddenIncludeSummQtys.Value.ToString()).Tables[0];
            if (cprData.Rows.Count > 0)
            {
                lastRow            = cprData.Rows.Count - 1;
                ItemDescLabel.Text = cprData.Rows[lastRow]["Description"].ToString();
                QtyUOMLabel.Text   = string.Format("{0:N0}", cprData.Rows[lastRow]["UOM_Qty"]) + " / " + string.Format("{0:N0}", cprData.Rows[lastRow]["UOM"]);
                UOMWghtLabel.Text  = string.Format("{0:N1}", cprData.Rows[lastRow]["Net_Wgt"]) + " Lbs";
                SuperEqLabel.Text  = "<b>" + string.Format("{0:N0}", cprData.Rows[lastRow]["SupEqv_Qty"]) + " / "
                                     + string.Format("{0:N0}", cprData.Rows[lastRow]["SupEqv_UOM"]) + "</b>";
                SuperEqPcsLabel.Text = "<b>" + string.Format("{0:N0}", cprData.Rows[lastRow]["SupEqv_Pcs"]) + "</b> Pcs";
                LowPalletLabel.Text  = "<b>" + string.Format("{0:N0}", cprData.Rows[lastRow]["LowPalletQty"]) + " / "
                                       + string.Format("{0:N0}", cprData.Rows[lastRow]["LowPalletPcs"]) + "</b>";
                //YrWgtUseLabel.Text = string.Format("{0:N1}", cprData.Rows[lastRow]["Item_Use_CY_Wgt"]) + " Lbs";
                Wgt100Label.Text = string.Format("{0:N2}", cprData.Rows[lastRow]["Wgt100"]);
                //HarmCodeLabel.Text = cprData.Rows[lastRow]["PPI"].ToString();
                if (HiddenFactor.Value.ToString() == "-1")
                {
                    FactorLabel.Text = cprData.Rows[lastRow]["CVFactor"].ToString();
                }
                else
                {
                    FactorLabel.Text = HiddenFactor.Value;
                }
                LLTagLabel.Text = cprData.Rows[lastRow]["LLTag"].ToString();
                CFVLabel.Text   = "CFV: <b>" + cprData.Rows[lastRow]["CorpFixedVelCode"].ToString() + "</b>";
                CFVLabel.Text  += "&nbsp;&nbsp;PVC: <b>" + cprData.Rows[lastRow]["PackageVelocityCd"].ToString() + "</b>";
                //LastCostLabel.Text = string.Format("{0:N3}", cprData.Rows[lastRow]["Last_CostM"]);
                //UnitCostLabel.Text = string.Format("{0:N3}", cprData.Rows[lastRow]["Avg_CostM"]);
                BindCPRGrid(cprData);
                VendorGridView.DataSource = cpr.GetVendorData(CurItem).Tables[0];
                VendorGridView.DataBind();
            }
            else
            {
                ItemDescLabel.Text   = "No CPR Data On File";
                QtyUOMLabel.Text     = "";
                UOMWghtLabel.Text    = "";
                SuperEqLabel.Text    = "";
                SuperEqPcsLabel.Text = "";
                LowPalletLabel.Text  = "";
                //YrWgtUseLabel.Text = "";
                Wgt100Label.Text = "";
                //HarmCodeLabel.Text = "";
                CFVLabel.Text = "";
                //LastCostLabel.Text = "";
                //UnitCostLabel.Text = "";
                CPRGridView.DataBind();
                VendorGridView.DataBind();
                ATotalsGridView.DataBind();
            }
        }
        else
        {
            // process VMI page
            VMIPanel.Visible    = true;
            ItemPanel.Visible   = false;
            VendorPanel.Visible = false;
            System.Data.DataTable vmiData = new System.Data.DataTable();
            vmiData                  = cpr.GetVMIContractItem(VMIChain.Value, VMIContract.Value, CurItem).Tables[0];
            VMIChainLabel.Text       = VMIChain.Value;
            VMIContractLabel.Text    = VMIContract.Value;
            VMIBegLabel.Text         = string.Format("{0:dd/MM/yy}", vmiData.Rows[0]["StartDate"]);
            VMIEndLabel.Text         = string.Format("{0:dd/MM/yy}", vmiData.Rows[0]["EndDate"]);
            VMICustPOLabel.Text      = vmiData.Rows[0]["CustomerPO"].ToString();
            VMIXRefLabel.Text        = vmiData.Rows[0]["CrossRef"].ToString();
            VMIDescLabel.Text        = vmiData.Rows[0]["ItemDesc"].ToString();
            VMISubItemLabel.Text     = vmiData.Rows[0]["SubItemNo"].ToString();
            VMISalesPersonLabel.Text = vmiData.Rows[0]["Salesperson"].ToString();
            VMIUsageLabel.Text       = string.Format("{0:N0}", vmiData.Rows[0]["EAU_Qty"]);
            VMIContactLabel.Text     = vmiData.Rows[0]["Contact"].ToString() + " / " + vmiData.Rows[0]["ContactPhone"].ToString();
            VMIGPLabel.Text          = string.Format("{0:N1}", vmiData.Rows[0]["E_Profit_Pct"]);
            VMIOrderMethodLabel.Text = vmiData.Rows[0]["OrderMethod"].ToString();
            VMIVendorLabel.Text      = vmiData.Rows[0]["Vendor"].ToString();
            VMIFactorLabel.Text      = string.Format("{0:N1}", vmiData.Rows[0]["MonthFactor"]);
            decimal MonthFactor = Decimal.Parse(vmiData.Rows[0]["MonthFactor"].ToString());
            cprData           = cpr.GetGPRGridData(CurItem, MonthFactor, HiddenIncludeSummQtys.Value.ToString()).Tables[0];
            CPRDataLabel.Text = "";
            if (cprData.Rows.Count > 0)
            {
                lastRow = cprData.Rows.Count - 1;
                cprData.Rows[lastRow]["LocationCode"] = "Total";
                //LastCostLabel.Text = string.Format("{0:N3}", cprData.Rows[lastRow]["Last_CostM"]);
                //UnitCostLabel.Text = string.Format("{0:N3}", cprData.Rows[lastRow]["Avg_CostM"]);
                VendorGridView.DataSource = cpr.GetVendorData(CurItem).Tables[0];
                VendorGridView.DataBind();
                BindCPRGrid(cprData);
            }
            else
            {
                CPRDataLabel.Text = "No CPR Data on File.";
                VendorGridView.DataBind();
                CPRGridView.DataBind();
                ATotalsGridView.DataBind();
            }
        }
    }