Пример #1
0
    private void SetData(PurchaseRequestData data)
    {
        this.txtLOID.Text = data.LOID.ToString();
        this.txtStatus.Text = data.STATUS;
        this.txtRequestByID.Text = data.REQUESTBY.ToString();
        this.txtDivision.Text = data.DIVISION.ToString();

        this.cmbPurchaseType.SelectedIndex = this.cmbPurchaseType.Items.IndexOf(this.cmbPurchaseType.Items.FindByValue(data.PURCHASETYPE.ToString()));
        this.txtRequirement.Text = data.REQUIREMENT;
        this.txtReason.Text = data.REASON;
        this.txtFromCompany.Text = data.FROMCOMPANY;
        this.txtPDRequestCode.Text = data.CODE;
        this.ctlRequestDate.DateValue = data.REQUSETDATE;

        SetOfficerData(data.REQUESTBY, false);
        this.txtStatusName.Text = Appz.GetStatusName(data.STATUS);
        
        this.txtRemark.Text = data.REMARK;
        
        SetGrvItem(data.STATUS);
        this.btnVoid.Visible = (data.STATUS == Constz.Requisition.Status.SP.Code && (Authz.CurrentUserInfo.DivisionID == Constz.PurchaseDepartment.LOID || Authz.CurrentUserInfo.DivisionID == Constz.AdminDepartment.LOID));
        this.btnCancelPR.Visible = (data.STATUS == Constz.Requisition.Status.SP.Code && (Authz.CurrentUserInfo.DivisionID == Constz.PurchaseDepartment.LOID || Authz.CurrentUserInfo.DivisionID == Constz.AdminDepartment.LOID));

        if (data.STATUS == Constz.Requisition.Status.SP.Code)
        {
            if (Authz.CurrentUserInfo.DivisionID != Constz.PurchaseDepartment.LOID)
            {
                if (Authz.CurrentUserInfo.DivisionID != Constz.AdminDepartment.LOID)
                {
                    this.ctlToolbar.BtnSaveShow = false;
                    this.ctlToolbar.BtnCancelShow = false;
                    this.ctlToolbar.BtnSubmitShow = false;
                }
            }
        }
        else if (data.STATUS == Constz.Requisition.Status.Approved.Code || data.STATUS == Constz.Requisition.Status.Void.Code)
        {
            this.ctlToolbar.BtnSaveShow = false;
            this.ctlToolbar.BtnCancelShow = false;
            this.ctlToolbar.BtnSubmitShow = false;
        }

        this.ctlToolbar.ClientClickPrint = ABB.Global.Appz.ReportScript(Constz.Report.Purchase, data.LOID) + " return false;";
    }
Пример #2
0
        public bool UpdateData(string userID, PurchaseRequestData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.OnDB = false;
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj.CODE = data.CODE;
                    DALObj.REQUESTDATE = data.REQUSETDATE;
                    DALObj.ORDERTYPE = data.ORDERTYPE;
                    DALObj.PURCHASETYPE = data.PURCHASETYPE;
                    DALObj.REQUESTBY = data.REQUESTBY;
                    DALObj.DIVISION = data.DIVISION;
                    DALObj.APPROVER = data.APPROVER;
                    if (data.APPROVEDATE.Year != 1)
                    {
                        DALObj.APPROVEDATE = data.APPROVEDATE;
                    }
                    DALObj.APPROVE = data.APPROVE;
                    DALObj.ACTIVE = data.ACTIVE;
                    DALObj.STATUS = data.STATUS;
                    DALObj.REQUIREMENT = data.REQUIREMENT;
                    DALObj.REASON = data.REASON;
                    DALObj.REMARK = data.REMARK;
                    DALObj.FROMCOMPANY = data.FROMCOMPANY;

                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj.InsertCurrentData(userID, obj.zTrans);

                    _LOID = DALObj.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }

                    PRItemDAL itemDAL = new PRItemDAL();
                    itemDAL.DeleteDataByPDRequest(data.LOID, obj.zTrans);
                    for (Int16 i = 0; i < data.ITEM.Count; ++i)
                    {
                        PRItemData item = (PRItemData)data.ITEM[i];
                        itemDAL.PRODUCT = item.PRODUCT;
                        itemDAL.PDREQUEST = DALObj.LOID;
                        itemDAL.QTY = item.QTY;
                        itemDAL.UNIT = item.UNIT;
                        itemDAL.MINSTOCK = item.MINSTOCK;
                        itemDAL.MAXSTOCK = item.MAXSTOCK;
                        itemDAL.STOCK = item.STOCK;
                        itemDAL.OLDPRICE = item.OLDPRICE;
                        itemDAL.CURPRICE = item.CURPRICE;
                        itemDAL.MINPRICE = item.MINPRICE;
                        itemDAL.LAST3MON = item.LAST3MON;
                        itemDAL.LASTYEAR = item.LASTYEAR;
                        itemDAL.DUEDATE = item.DUEDATE;
                        itemDAL.ACTIVE = item.ACTIVE;
                        itemDAL.URGENT = item.URGENT;
                        itemDAL.ISMATERIAL = item.ISMATERIAL;

                        itemDAL.OnDB = false;
                        ret = itemDAL.InsertCurrentData(userID, obj.zTrans);
                        if (!ret) throw new ApplicationException(itemDAL.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }
Пример #3
0
 public bool ValidateData(PurchaseRequestData data)
 {
     bool ret = true;
     if (data.PURCHASETYPE == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкػÃÐàÀ·ãººÑ¹·Ö¡ÃÒ¡ÒÃ";
     }
     else if (data.REQUSETDATE.Year == 1)
     {
         ret = false;
         _error = "¡ÃسÒÇѹ·ÕèºÑ¹·Ö¡ÃÒ¡ÒÃ";
     }
     else if (data.REASON == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØà˵ؼÅ㹡Òâͫ×éÍ";
     }
     else if (data.ITEM.Count == 0)
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃÒ¡ÒÃÊÔ¹¤éÒ";
     }
     return ret;
 }
Пример #4
0
 public PurchaseRequestData GetData(double loid)
 {
     PurchaseRequestData data = new PurchaseRequestData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.LOID = DALObj.LOID;
         data.CODE = DALObj.CODE;
         data.REQUSETDATE = DALObj.REQUESTDATE;
         data.PURCHASETYPE = DALObj.PURCHASETYPE;
         data.REQUESTBY = DALObj.REQUESTBY;
         data.DIVISION = DALObj.DIVISION;
         data.STATUS = DALObj.STATUS;
         data.REQUIREMENT = DALObj.REQUIREMENT;
         data.REASON = DALObj.REASON;
         data.REMARK = DALObj.REMARK;
         data.FROMCOMPANY = DALObj.FROMCOMPANY;
     }
     return data;
 }
Пример #5
0
    private PurchaseRequestData GetRecentData()
    {
        PurchaseRequestData data = new PurchaseRequestData();
        data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
        data.CODE = this.txtPDRequestCode.Text.Trim();
        data.REQUSETDATE = this.ctlRequestDate.DateValue;
        data.ORDERTYPE = Constz.OrderType.PO.Code;
        data.PURCHASETYPE = Convert.ToDouble(this.cmbPurchaseType.SelectedItem.Value);
        data.REQUESTBY = Convert.ToDouble(this.txtRequestByID.Text == "" ? "0" : this.txtRequestByID.Text);
        data.DIVISION = Convert.ToDouble(this.txtDivision.Text == "" ? "0" : this.txtDivision.Text);
        data.APPROVER = Authz.CurrentUserInfo.UserID;
        data.APPROVEDATE = DateTime.Now.Date;
        data.APPROVE = "Y";
        data.ACTIVE = Constz.ActiveStatus.Active;
        if (Authz.CurrentUserInfo.DivisionID == Constz.PurchaseDepartment.LOID)
        {
            data.STATUS =  Constz.Requisition.Status.Approved.Code;
        }
        else if (Authz.CurrentUserInfo.DivisionID == Constz.AdminDepartment.LOID)
        {
            data.STATUS = Constz.Requisition.Status.SP.Code;
            this.ctlToolbar.BtnSubmitShow = false;
        }
        else 
        {
            data.STATUS = Constz.Requisition.Status.SP.Code;
        }
        data.REQUIREMENT = this.txtRequirement.Text.Trim();
        data.REASON = this.txtReason.Text.Trim();
        data.REMARK = this.txtRemark.Text.Trim();
        data.FROMCOMPANY = this.txtFromCompany.Text.Trim();
        data.ITEM = ItemObj.GetRecentItemList();

        return data;
    }
Пример #6
0
    private PurchaseRequestData GetData()
    {
        PurchaseRequestData data = new PurchaseRequestData();
        data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
        data.CODE = this.txtPDRequestCode.Text.Trim();
        data.REQUSETDATE = this.ctlRequestDate.DateValue;
        data.ORDERTYPE = Constz.OrderType.PO.Code;
        data.PURCHASETYPE = Convert.ToDouble(this.cmbPurchaseType.SelectedItem.Value);
        data.REQUESTBY = Convert.ToDouble(this.txtRequestByID.Text == "" ? "0" : this.txtRequestByID.Text);
        data.DIVISION = Convert.ToDouble(this.txtDivision.Text == "" ? "0" : this.txtDivision.Text);
        data.ACTIVE = Constz.ActiveStatus.Active;
        data.STATUS = this.txtStatus.Text.Trim();
        data.REQUIREMENT = this.txtRequirement.Text.Trim();
        data.REASON = this.txtReason.Text.Trim();
        data.REMARK = this.txtRemark.Text.Trim();
        data.FROMCOMPANY = this.txtFromCompany.Text.Trim();
        data.ITEM = ItemObj.GetItemList();

        return data;
    }