Exemplo n.º 1
0
        public void fillDataForm()
        {
            if (dr != null)
            {
                this.mplDocNum.Text  = Global.cBL.CurNumDoc.ToString();
                this.mplArticle.Text = dr["code_wares"].ToString();
                this.mplCode.Text    = dr["bar_code"].ToString();
                this.mplName.Text    = "                      " + dr["name_wares"].ToString();
                this.mptbAddQty.Text = "";

                if (dr["quantity"] != DBNull.Value)
                {
                    this.mplQtyNow.Text = decimal.Round(Proto.ToDecimal(dr["quantity"].ToString()), 3).ToString("0.000");
                }
                else
                {
                    this.mplQtyNow.Text = string.Empty;
                }

                if (dr["price"] != DBNull.Value)
                {
                    this.mptbAddPrice.Text = Proto.DeleteZeroEnds(dr["price"].ToString());
                }
                else
                {
                    this.mptbAddPrice.Text = Proto.DeleteZeroEnds(dr["price_temp"].ToString());
                }

                if (dr["quantity_temp"] != DBNull.Value)
                {
                    if (Global.getViewQtyTemplDoc())
                    {
                        this.mplQtyTempl.Text = decimal.Round(Proto.ToDecimal(dr["quantity_temp"].ToString()), 3).ToString("0.000");
                    }
                    else
                    {
                        mplQtyTempl.Text = string.Empty;
                    }
                    //if (Global.cBL.CurTypeDoc == TypeDoc.SupplyLogistic || Global.cBL.CurTypeDoc == TypeDoc.Inventories)
                    //{
                    //    mplQtyTempl.Text = string.Empty;
                    //}
                    //else this.mplQtyTempl.Text = decimal.Round(Proto.ToDecimal(dr["quantity_temp"].ToString()), 3).ToString("0.000");
                }
                else
                {
                    mplQtyTempl.Text = string.Empty;
                }

                if (dr["term"] != DBNull.Value)
                {
                    decimal d    = Convert.ToDecimal(dr["term"]);
                    int     prom = (int)d;
                    prom = prom * 2 / 3;
                    //DateTime dd = Convert.ToDateTime(Global.TimeSync).Date;  // замінити на дату знп?
                    DateTime dd = Convert.ToDateTime(Global.cBL.CurDoc["date_doc"]).Date;
                    dd = dd.AddDays(prom);
                    mplDateReal.Text      = dd.Date.ToString();
                    mplDateReal.BackColor = System.Drawing.Color.YellowGreen;
                }
                else
                {
                    mplDateReal.Text      = DateTime.Now.Date.ToString();
                    mplDateReal.BackColor = System.Drawing.Color.YellowGreen;
                }
                if (dr["abr_unit"] != DBNull.Value)
                {
                    this.mplAUTempl.Text = dr["abr_unit"].ToString();
                }
                if (dr["coef_bar_code"] != DBNull.Value && Convert.ToDecimal(dr["coef_bar_code"]) != 1)
                {
                    this.mplCoef.Text      = "X" + dr["coef_bar_code"].ToString();
                    this.mplCoef.BackColor = System.Drawing.Color.LimeGreen;
                }
                else
                {
                    this.mplCoef.Text    = String.Empty;
                    this.mplCoef.Visible = false;
                }

                this.mptbAddQty.Focus();

                // TMPPPPPP Витерти!!!!
                //this.mplQtyTempl.Text = decimal.Round(Proto.ToDecimal(dr["quantity_temp"].ToString()), 3).ToString("0.000");
            }
            else
            {
                this.mplDocNum.Text    = Global.cBL.CurNumDoc.ToString();
                this.mplArticle.Text   = string.Empty;
                this.mplCode.Text      = string.Empty;
                this.mplName.Text      = string.Empty;
                this.mptbAddQty.Text   = string.Empty;
                this.mplQtyNow.Text    = string.Empty;
                this.mptbAddPrice.Text = string.Empty;
                this.mplQtyTempl.Text  = string.Empty;
                this.mplAUTempl.Text   = string.Empty;

                this.mplDateReal.Text      = string.Empty;
                this.mplDateReal.BackColor = System.Drawing.Color.Gainsboro;

                this.mplCoef.Text    = String.Empty;
                this.mplCoef.Visible = false;
            }
        }