コード例 #1
0
ファイル: PurchaseRequestFlow.cs プロジェクト: SoftSuite/ABB
 public bool CopyPDRequest(string userID, double loidSource)
 {
     PurchaseRequestData data = GetData(loidSource);
     DataTable itemList = GetPRItem(data.LOID);
     ArrayList arr = new ArrayList();
     foreach (DataRow dRow in itemList.Rows)
     {
         PRItemData idata = new PRItemData();
         idata.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
         idata.QTY = Convert.ToDouble(dRow["QTY"]);
         idata.UNIT = Convert.ToDouble(dRow["UNIT"]);
         idata.MINSTOCK = Convert.ToDouble(dRow["MINSTOCK"]);
         idata.MAXSTOCK = Convert.ToDouble(dRow["MAXSTOCK"]);
         idata.STOCK = Convert.ToDouble(dRow["STOCK"]);
         idata.OLDPRICE = Convert.ToDouble(dRow["OLDPRICE"]);
         idata.CURPRICE = Convert.ToDouble(dRow["CURPRICE"]);
         idata.MINPRICE = Convert.ToDouble(dRow["MINPRICE"]);
         idata.LAST3MON = Convert.ToDouble(dRow["LAST3MON"]);
         idata.LASTYEAR = Convert.ToDouble(dRow["LASTYEAR"]);
         idata.ACTIVE = Constz.ActiveStatus.Active;
         idata.DUEDATE = Convert.ToDateTime(dRow["DUEDATE"]);
         arr.Add(idata);
     }
     data.ITEM = arr;
     DALObj.OnDB = false;
     data.LOID = 0;
     data.CODE = "";
     data.STATUS = Constz.Requisition.Status.Waiting.Code;
     data.ACTIVE = Constz.ActiveStatus.Active;
     data.ORDERTYPE = Constz.OrderType.PO.Code;
     return UpdateData(userID, data);
 }
コード例 #2
0
ファイル: PRItem.cs プロジェクト: SoftSuite/ABB
    public bool UpdatePRItem(decimal LOID, decimal PRODUCT, decimal QTY, decimal UNIT, decimal MINSTOCK, decimal MAXSTOCK, decimal STOCK, decimal OLDPRICE, decimal CURPRICE, decimal MINPRICE, decimal LAST3MON, decimal LASTYEAR, decimal RANK, string BARCODE, DateTime DUEDATE, string URGENT, string ISMATERIAL, string PRODUCTNAME)
    {
        PRItemData data = new PRItemData();
        data.LOID = Convert.ToDouble(LOID);
        data.PRODUCT = Convert.ToDouble(PRODUCT);
        data.QTY = Convert.ToDouble(QTY);
        data.CURPRICE = Convert.ToDouble(CURPRICE);
        data.DUEDATE = DUEDATE;

        bool ret = true;
        ret = VerifyData(data);

        if (ret)
        {
            DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
            if (dt != null)
            {
                DataRow[] dRows = dt.Select("LOID = " + LOID.ToString());
                DataRow dRow = dRows[0];
                dRow["PRODUCT"] = Convert.ToDouble(PRODUCT);
                dRow["QTY"] = Convert.ToDouble(QTY);
                dRow["UNIT"] = Convert.ToDouble(UNIT);
                dRow["MINSTOCK"] = Convert.ToDouble(MINSTOCK);
                dRow["MAXSTOCK"] = Convert.ToDouble(MAXSTOCK);
                dRow["STOCK"] = Convert.ToDouble(STOCK);
                dRow["OLDPRICE"] = Convert.ToDouble(OLDPRICE);
                dRow["CURPRICE"] = Convert.ToDouble(CURPRICE);
                dRow["MINPRICE"] = Convert.ToDouble(MINPRICE);
                dRow["LAST3MON"] = Convert.ToDouble(LAST3MON);
                dRow["LASTYEAR"] = Convert.ToDouble(LASTYEAR);
                dRow["DUEDATE"] = DUEDATE;
                ProductSearchData product = FlowObj.GetProductData(Convert.ToDouble(PRODUCT));
                dRow["BARCODE"] = product.BARCODE;
                dRow["PRODUCTNAME"] = product.NAME;
                dRow["UNITNAME"] = FlowObj.GetUnitData(Convert.ToDouble(UNIT)).NAME;
                dRow["URGENT"] = URGENT;
                dRow["ISMATERIAL"] = ISMATERIAL;
                ReOrder(dt);
                System.Web.HttpContext.Current.Session[sessionName] = dt;
            }
        }
        else throw new ApplicationException(_error);
        return ret;
    }
コード例 #3
0
ファイル: PurchaseRequestFlow.cs プロジェクト: SoftSuite/ABB
 private PRItemData SetRecentPRItem(DataTable table)
 {
     PRItemData data = new PRItemData();
     if (table.Rows.Count != 0)
     {
         DataRow oneRow = table.Rows[0];
         data.PRODUCT = Convert.ToDouble(oneRow["LOID"]);
         data.BARCODE = oneRow["CODE"].ToString();
         data.PRODUCTNAME = oneRow["PDNAME"].ToString();
         data.UNIT = Convert.ToDouble(oneRow["UNIT"]);
         data.UNITNAME = oneRow["UNAME"].ToString();
         data.OLDPRICE = Convert.ToDouble(oneRow["LASTPRICE"]);
         data.MINPRICE = Convert.ToDouble(oneRow["MINPRICE"]);
         data.MINSTOCK = Convert.ToDouble(oneRow["MIN"]);
         data.MAXSTOCK = Convert.ToDouble(oneRow["MAX"]);
         data.STOCK = Convert.ToDouble(oneRow["STOCK"]);
         data.LAST3MON = Convert.ToDouble(oneRow["USED3MONTH"]);
         data.LASTYEAR = Convert.ToDouble(oneRow["USED12MONTH"]);
         data.DUEDATE = Convert.ToDateTime(oneRow["DUEDATE"]);
     }
     return data;
 }
コード例 #4
0
ファイル: PRItem.cs プロジェクト: SoftSuite/ABB
 public ArrayList GetRecentItemList()
 {
     DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
     ArrayList arr = new ArrayList();
     if (dt != null)
     {
         foreach (DataRow dRow in dt.Rows)
         {
             PRItemData data = new PRItemData();
             data.LOID = Convert.ToDouble(dRow["LOID"]);
             data.PRODUCT = Convert.ToDouble(dRow["PRODUCT"]);
             PRItemData RecentData = FlowObj.GetRecentPRItem(data.PRODUCT);
             data.QTY = Convert.ToDouble(dRow["QTY"]);
             data.UNIT = Convert.ToDouble(dRow["UNIT"]);
             data.MINSTOCK = RecentData.MINSTOCK;
             data.MAXSTOCK = RecentData.MAXSTOCK;
             data.STOCK = RecentData.STOCK;
             data.OLDPRICE = RecentData.OLDPRICE;
             data.CURPRICE = Convert.ToDouble(dRow["CURPRICE"]);
             data.MINPRICE = RecentData.MINPRICE;
             data.LAST3MON = RecentData.LAST3MON;
             data.LASTYEAR = RecentData.LASTYEAR;
             data.DUEDATE = Convert.ToDateTime(dRow["DUEDATE"]);
             data.ACTIVE = Constz.ActiveStatus.Active;
             data.URGENT = dRow["URGENT"].ToString();
             data.ISMATERIAL = dRow["ISMATERIAL"].ToString();
             
             arr.Add(data);
         }
     }
     return arr;
 }
コード例 #5
0
ファイル: PRItem.cs プロジェクト: SoftSuite/ABB
 //0 LOID, 0 PRODUCT, 0 QTY, 0 UNIT, 0 MINSTOCK, 0 MAXSTOCK, 0 STOCK, 0 OLDPRICE, 0 CURPRICE, 0 MINPRICE, 0 LAST3MON, 0 LASTYEAR, ''DUEDATE, '' BARCODE, '' UNITNAME, '' URGENT, '' ISMATERIAL
 public bool InsertPRItem(PRItemData data)
 {
     bool ret = true;
     ret = VerifyData(data);
     if (ret)
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         if (dt != null)
         {
             ReOrder(dt);
             DataRow dRow = dt.NewRow();
             dRow["LOID"] = Convert.ToDouble(dt.Rows.Count) + 1;
             dRow["RANK"] = Convert.ToDouble(dRow["LOID"]);
             dRow["PRODUCT"] = Convert.ToDouble(data.PRODUCT);
             dRow["QTY"] = Convert.ToDouble(data.QTY);
             dRow["UNIT"] = Convert.ToDouble(data.UNIT);
             dRow["MINSTOCK"] = Convert.ToDouble(data.MINSTOCK);
             dRow["MAXSTOCK"] = Convert.ToDouble(data.MAXSTOCK);
             dRow["STOCK"] = Convert.ToDouble(data.STOCK);
             dRow["OLDPRICE"] = Convert.ToDouble(data.OLDPRICE);
             dRow["CURPRICE"] = Convert.ToDouble(data.CURPRICE);
             dRow["MINPRICE"] = Convert.ToDouble(data.MINPRICE);
             dRow["LAST3MON"] = Convert.ToDouble(data.LAST3MON);
             dRow["LASTYEAR"] = Convert.ToDouble(data.LASTYEAR);
             dRow["DUEDATE"] = data.DUEDATE;
           //  ProductSearchData product = FlowObj.GetProductData(data.PRODUCT);
             dRow["PRODUCTNAME"] = data.PRODUCTNAME;
             dRow["BARCODE"] = data.BARCODE;
             dRow["UNITNAME"] = FlowObj.GetUnitData(data.UNIT).NAME;
             dRow["URGENT"] = data.URGENT;
             dRow["ISMATERIAL"] = data.ISMATERIAL;
             dt.Rows.Add(dRow);
             System.Web.HttpContext.Current.Session[sessionName] = dt;
         }
     }
     return ret;
 }
コード例 #6
0
ファイル: PRItem.cs プロジェクト: SoftSuite/ABB
 private bool VerifyData(PRItemData data)
 {
     bool ret = true;
     if (data.PRODUCT == 0)
     {
         ret = false;
         _error = "¡ÃسÒàÅ×Í¡ÊÔ¹¤éÒ";
     }
     else if (data.QTY == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкبӹǹ";
     }
     //else if (data.CURPRICE == 0)
     //{
     //    ret = false;
     //    _error = "¡ÃسÒÃкØÃҤһѨ¨ØºÑ¹";
     //}
     else if (data.DUEDATE.Year == 1)
     {
         ret = false;
         _error = "¡ÃسÒÃкءÓ˹´Êè§";
     }
     else
     {
         DataTable dt = (DataTable)System.Web.HttpContext.Current.Session[sessionName];
         foreach (DataRow dRow in dt.Rows)
         {
             if (Convert.ToDouble(dRow["PRODUCT"]) == data.PRODUCT && Convert.ToDouble(dRow["LOID"]) != data.LOID)
             {
                 _error = "ÃÒ¡ÒÃÊÔ¹¤éÒ¹ÕéÁÕÍÂÙèã¹ÃÒ¡ÒÃáÅéÇ";
                 ret = false;
                 break;
             }
         }
     }
     return ret;
 }
コード例 #7
0
ファイル: PurchaseRequest.aspx.cs プロジェクト: SoftSuite/ABB
    protected void grvItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        CheckBox chkUrgent = (CheckBox)this.grvItem.Rows[e.RowIndex].Cells[2].FindControl("chkUrgent");
        CheckBox chkMaterial = (CheckBox)this.grvItem.Rows[e.RowIndex].Cells[3].FindControl("chkMaterial");
        //DropDownList cmbProduct = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[5].FindControl("cmbProduct");
        TextBox txtProduct = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("txtProduct");
       // TextBox txtProductName = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[5].FindControl("txtProductName");
        TextBox txtBarcode = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("txtBarCode");
        TextBox txtQty = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[6].FindControl("txtQty");
       // DropDownList cmbUnit = (DropDownList)this.grvItem.Rows[e.RowIndex].Cells[7].FindControl("cmbUnit");
        TextBox txtUnit = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[4].FindControl("txtUnit");
        TextBox txtOldPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[8].FindControl("txtOldPrice");
        TextBox txtCurPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[9].FindControl("txtCurPrice");
        TextBox txtMinPrice = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[10].FindControl("txtMinPrice");
        TextBox txtMinStock = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[11].FindControl("txtMinStock");
        TextBox txtMaxStock = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[12].FindControl("txtMaxStock");
        TextBox txtStock = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[13].FindControl("txtStock");
        TextBox txtLast3Mon = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[14].FindControl("txtLast3Mon");
        TextBox txtLastYear = (TextBox)this.grvItem.Rows[e.RowIndex].Cells[15].FindControl("txtLastYear");
        Controls_DatePickerControl ctlDueDate = (Controls_DatePickerControl)this.grvItem.Rows[e.RowIndex].Cells[16].FindControl("ctlDueDate");

        PRItemData data = new PRItemData();

        data.BARCODE = txtBarcode.Text.Trim();
        data.PRODUCT = Convert.ToDouble(txtProduct.Text == "" ? "0" : txtProduct.Text);
        //data.PRODUCTNAME = txtProductName.Text;
        //data.PRODUCT = Convert.ToDouble(cmbProduct.SelectedItem.Value);
        data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
        data.UNIT = Convert.ToDouble(txtUnit.Text == "" ? "0" : txtUnit.Text);
        data.OLDPRICE = Convert.ToDouble(txtOldPrice.Text);
        data.CURPRICE = Convert.ToDouble(txtCurPrice.Text);
        data.MINPRICE = Convert.ToDouble(txtMinPrice.Text);
        data.MINSTOCK = Convert.ToDouble(txtMinStock.Text);
        data.MAXSTOCK = Convert.ToDouble(txtMaxStock.Text);
        data.STOCK = Convert.ToDouble(txtStock.Text);
        data.LAST3MON = Convert.ToDouble(txtLast3Mon.Text);
        data.LASTYEAR = Convert.ToDouble(txtLastYear.Text);
        data.DUEDATE = ctlDueDate.DateValue;
        if (chkUrgent.Checked)
        {
            data.URGENT = "Y";
        }
        else
        {
            data.URGENT = "N";
        }

        if (chkMaterial.Checked)
        {
            data.ISMATERIAL = "Y";
        }
        else
        {
            data.ISMATERIAL = "N";
        }

        e.NewValues["LOID"] = this.grvItem.Rows[e.RowIndex].Cells[16].Text;
        e.NewValues["PRODUCT"] = data.PRODUCT.ToString();
       // e.NewValues["PRODUCTNAME"] = data.PRODUCTNAME;
        e.NewValues["QTY"] = data.QTY.ToString();
        e.NewValues["UNIT"] = data.UNIT.ToString();
        e.NewValues["MINSTOCK"] = data.MINSTOCK.ToString(Constz.DblFormat);
        e.NewValues["MAXSTOCK"] = data.MAXSTOCK.ToString(Constz.DblFormat);
        e.NewValues["STOCK"] = data.STOCK.ToString();
        e.NewValues["OLDPRICE"] = data.OLDPRICE.ToString();
        e.NewValues["CURPRICE"] = data.CURPRICE.ToString();
        e.NewValues["MINPRICE"] = data.MINPRICE.ToString();
        e.NewValues["LAST3MON"] = data.LAST3MON.ToString();
        e.NewValues["LASTYEAR"] = data.LASTYEAR.ToString();
        e.NewValues["DUEDATE"] = data.DUEDATE.ToString();
        e.NewValues["URGENT"] = data.URGENT;
        e.NewValues["ISMATERIAL"] = data.ISMATERIAL;
        e.NewValues["BARCODE"] = data.BARCODE;

    }
コード例 #8
0
ファイル: PurchaseRequest.aspx.cs プロジェクト: SoftSuite/ABB
    protected void grvItem_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert")
        {
            CheckBox chkUrgent = (CheckBox)this.grvItem.FooterRow.Cells[2].FindControl("chkUrgent");
            CheckBox chkMaterial = (CheckBox)this.grvItem.FooterRow.Cells[3].FindControl("chkMaterial");
            //DropDownList cmbProduct = (DropDownList)this.grvItem.FooterRow.Cells[5].FindControl("cmbNewProduct");
            TextBox txtProduct = (TextBox)this.grvItem.FooterRow.Cells[4].FindControl("txtNewProduct");
            TextBox txtProductName = (TextBox)this.grvItem.FooterRow.Cells[5].FindControl("txtNewProductName");
            TextBox txtBarcode = (TextBox)this.grvItem.FooterRow.Cells[4].FindControl("txtNewBarCode");
            TextBox txtQty = (TextBox)this.grvItem.FooterRow.Cells[6].FindControl("txtNewQty");
            //DropDownList cmbUnit = (DropDownList)this.grvItem.FooterRow.Cells[7].FindControl("cmbNewUnit");
            TextBox txtUnit = (TextBox)this.grvItem.FooterRow.Cells[4].FindControl("txtNewUnit");
            TextBox txtUnitName = (TextBox)this.grvItem.FooterRow.Cells[7].FindControl("txtNewUnitName");
            TextBox txtOldPrice = (TextBox)this.grvItem.FooterRow.Cells[8].FindControl("txtNewOldPrice");
            TextBox txtCurPrice = (TextBox)this.grvItem.FooterRow.Cells[9].FindControl("txtNewCurPrice");
            TextBox txtMinPrice = (TextBox)this.grvItem.FooterRow.Cells[10].FindControl("txtNewMinPrice");
            TextBox txtMinStock = (TextBox)this.grvItem.FooterRow.Cells[11].FindControl("txtNewMinStock");
            TextBox txtMaxStock = (TextBox)this.grvItem.FooterRow.Cells[12].FindControl("txtNewMaxStock");
            TextBox txtStock = (TextBox)this.grvItem.FooterRow.Cells[13].FindControl("txtNewStock");
            TextBox txtLast3Mon = (TextBox)this.grvItem.FooterRow.Cells[14].FindControl("txtNewLast3Mon");
            TextBox txtLastYear = (TextBox)this.grvItem.FooterRow.Cells[15].FindControl("txtNewLastYear");
            Controls_DatePickerControl ctlDueDate = (Controls_DatePickerControl)this.grvItem.FooterRow.Cells[16].FindControl("ctlNewDueDate");
            PRItemData data = new PRItemData();

            data.PRODUCT = Convert.ToDouble(txtProduct.Text == "" ? "0" : txtProduct.Text);
            data.PRODUCTNAME = txtProductName.Text;
            data.BARCODE = txtBarcode.Text.Trim();
            data.QTY = Convert.ToDouble(txtQty.Text == "" ? "0" : txtQty.Text);
            data.UNIT = Convert.ToDouble(txtUnit.Text == "" ? "0" : txtUnit.Text);
            data.UNITNAME = txtUnitName.Text;
            data.OLDPRICE = Convert.ToDouble(txtOldPrice.Text);
            data.CURPRICE = Convert.ToDouble(txtCurPrice.Text == "" ? "0" : txtCurPrice.Text);
            data.MINPRICE = Convert.ToDouble(txtMinPrice.Text);
            data.MINSTOCK = Convert.ToDouble(txtMinStock.Text);
            data.MAXSTOCK = Convert.ToDouble(txtMaxStock.Text);
            data.STOCK = Convert.ToDouble(txtStock.Text);
            data.LAST3MON = Convert.ToDouble(txtLast3Mon.Text);
            data.LASTYEAR = Convert.ToDouble(txtLastYear.Text);
            data.DUEDATE = ctlDueDate.DateValue;
            if (chkUrgent.Checked)
            {
                data.URGENT = "Y";
            }
            else
            {
                data.URGENT = "N";
            }

            if (chkMaterial.Checked)
            {
                data.ISMATERIAL = "Y";
            }
            else
            {
                data.ISMATERIAL = "N";
            }

            if (ItemObj.InsertPRItem(data))
            {
                SetGrvItem(this.txtStatus.Text);
            }
            else
                Appz.ClientAlert(this, ItemObj.ErrorMessage);
        }
    }