private MAuxilaryDoc getPurchaseOrderObject(String id) { CUtil.EnableForm(false, ParentControl); CTable t = new CTable(""); MAuxilaryDoc md = new MAuxilaryDoc(t); md.AuxilaryDocID = id; CTable obj = OnixWebServiceAPI.GetAuxilaryDocInfo(md.GetDbObject()); md.SetDbObject(obj); md.InitAuxilaryDocItem(); md.InitPaymentCriteria(); md.InitEntityAddresses(); String tmp = md.EntityBankAccountID; md.InitEntityBankAccounts(); md.EntityBankAccountID = tmp; CUtil.EnableForm(true, ParentControl); return(md); }
private MAccountDoc constructSaleOrderFromQuotation(MAuxilaryDoc quotation) { CTable qt = OnixWebServiceAPI.GetAuxilaryDocInfo(quotation.GetDbObject()); MAuxilaryDoc qd = new MAuxilaryDoc(qt); qd.InitAuxilaryDocItem(); qd.InitEntityAddresses(); MAccountDoc md = new MAccountDoc(new CTable("")); md.DocumentType = ((int)AccountDocumentType.AcctDocSaleOrder).ToString(); md.DocumentDate = qd.DocumentDate; md.DocumentDesc = qd.DocumentDesc; md.DueDate = qd.DocumentDate; md.ProjectID = qd.ProjectID; md.ProjectCode = qd.ProjectCode; md.ProjectName = qd.ProjectName; md.ProjectGroupName = qd.ProjectGroupName; md.EntityId = qd.EntityId; md.EntityCode = qd.EntityCode; md.EntityName = qd.EntityName; md.EntityAddressID = qd.EntityAddressID; md.EmployeeID = qd.EmployeeID; md.EmployeeCode = qd.EmployeeCode; md.EmployeeName = qd.EmployeeName; CTable cust = OnixWebServiceAPI.GetEntityInfo(qd.EntityObj.GetDbObject()); MEntity en = new MEntity(cust); en.InitEntityAddress(); md.ReloadEntityAddresses(en.AddressItems); md.BranchId = qd.BranchId; md.VATType = qd.VatType; md.RefQuotationNo = qd.DocumentNo; md.RefQuotationID = qd.AuxilaryDocID; foreach (MAuxilaryDocItem ad in qd.AuxilaryDocItems) { MAccountDocItem adi = new MAccountDocItem(ad.GetDbObject()); adi.ExtFlag = "A"; md.AddAccountDocItem(adi); } md.CalculateExtraFields(); md.IsModified = true; return(md); }
private MAuxilaryDoc getDocumentObject(String id) { CUtil.EnableForm(false, ParentControl); CTable t = new CTable(""); MAuxilaryDoc md = new MAuxilaryDoc(t); md.AuxilaryDocID = id; CTable obj = OnixWebServiceAPI.GetAuxilaryDocInfo(md.GetDbObject()); md.SetDbObject(obj); md.InitAuxilaryDocItem(); md.InitEntityAddresses(); CUtil.EnableForm(true, ParentControl); return(md); }
private Boolean SaveData(String approveFlag) { if (!CHelper.VerifyAccessRight("PURCHASE_PO_EDIT")) { return(false); } if (approveFlag.Equals("Y")) { Boolean result = SaveToView(); if (!result) { return(false); } CUtil.EnableForm(false, this); CTable t = approveAccountDocWrapper(); CUtil.EnableForm(true, this); if (t != null) { actualView.DocumentStatus = ((int)PoDocumentStatus.PoApproved).ToString(); if (Mode.Equals("A")) { vw.SetDbObject(t); vw.NotifyAllPropertiesChanged(); createdID = vw.AuxilaryDocID; parentItemsSource.Insert(0, vw); } else if (Mode.Equals("E")) { actualView.SetDbObject(t); actualView.NotifyAllPropertiesChanged(); } vw.IsModified = false; this.Close(); } } else { if (!SaveToView()) { return(false); } CUtil.EnableForm(false, this); vw.DocumentType = ((int)docType).ToString(); CTable newobj = OnixWebServiceAPI.SubmitObjectAPI("SaveAuxilaryDoc", vw.GetDbObject()); CUtil.EnableForm(true, this); if (newobj != null) { if (Mode.Equals("A")) { vw.SetDbObject(newobj); parentItemsSource.Insert(0, vw); } else { actualView.SetDbObject(newobj); actualView.NotifyAllPropertiesChanged(); } return(true); } //Error here CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null); return(false); } return(false); }