コード例 #1
0
        private CTable updateDocumentWrapper()
        {
            CTable m = null;

            m = OnixWebServiceAPI.UpdateAccountDoc(vw.GetDbObject());

            return(m);
        }
コード例 #2
0
        private CTable verifyAccountDocWrapper()
        {
            CTable m = null;

            m = OnixWebServiceAPI.VerifyAccountDoc(vw.GetDbObject().CloneAll());

            return(m);
        }
コード例 #3
0
        private void LoadData()
        {
            isInLoadData = true;

            this.Title = Caption;
            dtDocumentDate.Focus();

            vw.CreateDefaultValue();
            CUtil.EnableForm(false, this);

            if (Mode.Equals("E"))
            {
                CTable m = OnixWebServiceAPI.GetAccountDocInfo(actualView.GetDbObject());
                if (m != null)
                {
                    vw.SetDbObject(m);
                    vw.NotifyAllPropertiesChanged();
                }
            }

            else if (Mode.Equals("A"))
            {
                vw.DocumentDate = DateTime.Now;
                vw.DocumentType = ((int)dt).ToString();

                vw.AllowCashNegative      = CGlobalVariable.IsCashNegativeAllow();
                vw.AllowARAPNegative      = CGlobalVariable.IsArApNegativeAllow();
                vw.AllowInventoryNegative = CGlobalVariable.IsInventoryNegativeAllow();
            }

            vw.IsModified = false;
            isInLoadData  = false;

            CUtil.EnableForm(true, this);
        }
コード例 #4
0
        private void saveData()
        {
            ArrayList arr1 = new ArrayList();
            CTable    o    = orgDoc.GetDbObject();

            ArrayList arr2 = doc.GetDbObject().GetChildArray("ACCOUNT_DOC_DISCOUNTS");

            if (arr2 == null)
            {
                return;
            }

            foreach (CTable t in arr2)
            {
                arr1.Add(t);
            }

            o.RemoveChildArray("ACCOUNT_DOC_DISCOUNTS");
            o.AddChildArray("ACCOUNT_DOC_DISCOUNTS", arr1);
            orgDoc.DiscountItems.Clear();

            foreach (MAccountDocDiscount pmt in doc.DiscountItems)
            {
                orgDoc.DiscountItems.Add(pmt);
            }

            orgDoc.FinalDiscount = doc.FinalDiscount;
        }
コード例 #5
0
        private MAccountDoc constructInvoiceFromSaleOrder(MAccountDoc saleOrder)
        {
            CTable so = OnixWebServiceAPI.GetAccountDocInfo(saleOrder.GetDbObject());

            MAccountDoc sod = new MAccountDoc(so);

            sod.InitAccountDocItem();
            sod.InitEntityAddresses();

            MAccountDoc md = new MAccountDoc(new CTable(""));

            md.DocumentType = ((int)docType).ToString();
            md.DocumentDate = sod.DocumentDate;
            md.DocumentDesc = sod.DocumentDesc;
            md.DueDate      = sod.DocumentDate;

            md.ProjectID        = sod.ProjectID;
            md.ProjectCode      = sod.ProjectCode;
            md.ProjectName      = sod.ProjectName;
            md.ProjectGroupName = sod.ProjectGroupName;

            md.EntityId        = sod.EntityId;
            md.EntityCode      = sod.EntityCode;
            md.EntityName      = sod.EntityName;
            md.EntityAddressID = sod.EntityAddressID;

            md.EmployeeID   = sod.EmployeeID;
            md.EmployeeCode = sod.EmployeeCode;
            md.EmployeeName = sod.EmployeeName;

            CTable  cust = OnixWebServiceAPI.GetEntityInfo(sod.EntityObj.GetDbObject());
            MEntity en   = new MEntity(cust);

            en.InitEntityAddress();
            md.ReloadEntityAddresses(en.AddressItems);

            md.BranchId       = sod.BranchId;
            md.VATType        = sod.VATType;
            md.VAT_PCT        = sod.VAT_PCT;
            md.RefSaleOrderNo = sod.DocumentNo;
            md.RefSaleOrderID = sod.AccountDocId;
            md.RefPoNo        = sod.RefPoNo;
            md.RefQuotationNo = sod.RefQuotationNo;

            foreach (MAccountDocItem ad in sod.AccountItem)
            {
                MAccountDocItem adi = new MAccountDocItem(ad.GetDbObject());
                adi.ProjectID   = sod.ProjectID;
                adi.ProjectCode = sod.ProjectCode;
                adi.ProjectName = sod.ProjectName;

                adi.ExtFlag = "A";
                md.AddAccountDocItem(adi);
            }

            md.CalculateExtraFields();
            md.IsModified = true;

            return(md);
        }
コード例 #6
0
        private void saveData()
        {
            orgDoc.ChangeType = doc.ChangeType;
            createChangeTransaction();

            ArrayList arr1 = new ArrayList();
            CTable    o    = orgDoc.GetDbObject();

            ArrayList arr2 = doc.GetDbObject().GetChildArray("ACCOUNT_DOC_PAYMENTS");

            if (arr2 == null)
            {
                return;
            }

            foreach (CTable t in arr2)
            {
                arr1.Add(t);
            }

            o.RemoveChildArray("ACCOUNT_DOC_PAYMENTS");
            o.AddChildArray("ACCOUNT_DOC_PAYMENTS", arr1);
            orgDoc.PaymentItems.Clear();

            foreach (MAccountDocPayment pmt in doc.PaymentItems)
            {
                orgDoc.PaymentItems.Add(pmt);
            }
        }
        private CTable updateDocumentWrapper()
        {
            CTable m = null;

            m = OnixWebServiceAPI.SubmitObjectAPI("AdjustApproveAccountDoc", vw.GetDbObject());

            return(m);
        }
        private CTable getDocInfoWrapper()
        {
            CTable m = null;

            actualView.EntityAddressFlag = "Y";
            m = OnixWebServiceAPI.SubmitObjectAPI("GetAccountDocInfo", actualView.GetDbObject());

            return(m);
        }
コード例 #9
0
        public WinAddEditDiscount(String rcptAmt, MAccountDoc acctDoc)
        {
            orgDoc = acctDoc;

            doc = new MAccountDoc(acctDoc.GetDbObject().CloneAll());
            doc.InitAccountDocDiscount();
            doc.IsModified = false;

            DataContext = doc;

            InitializeComponent();
        }
コード例 #10
0
        private CTable getDocInfoWrapper()
        {
            CTable m = null;

            if (isBillCorrection)
            {
                m = OnixWebServiceAPI.GetUploadedAccountDocInfo(logImportIssue.GetDbObject());
            }
            else
            {
                actualView.EntityAddressFlag = "Y";
                m = OnixWebServiceAPI.GetAccountDocInfo(actualView.GetDbObject());
            }

            return(m);
        }
コード例 #11
0
        public WinAddEditPayment(String rcptAmt, MAccountDoc acctDoc, Boolean arFlag)
        {
            orgDoc = acctDoc;
            isAr   = arFlag;

            doc = new MAccountDoc(acctDoc.GetDbObject().CloneAll());
            doc.InitAccountDocPayment();
            doc.IsModified = false;

            populateCashType(doc);

            DataContext = doc;

            amt = rcptAmt;
            InitializeComponent();
        }
コード例 #12
0
        private CTable updateDocumentWrapper()
        {
            CTable m = null;

            if (isBillCorrection)
            {
                //logImportIssue
                m = OnixWebServiceAPI.SaveUploadedAccountDoc(vw.GetDbObject());
            }
            else
            {
                m = OnixWebServiceAPI.UpdateAccountDoc(vw.GetDbObject());
            }

            return(m);
        }
コード例 #13
0
        private static MAccountDoc getAccountDocObject(String id)
        {
            //CUtil.EnableForm(false, parent);

            CTable      t  = new CTable("");
            MAccountDoc md = new MAccountDoc(t);

            md.AccountDocId = id;

            CTable obj = OnixWebServiceAPI.GetAccountDocInfo(md.GetDbObject());

            md.SetDbObject(obj);

            md.InitAccountDocItem();
            md.InitAccountDocPayment();
            md.InitEntityAddresses();
            md.InitEntityAddresses();
            md.InitAccountDocReceipt();

            //CUtil.EnableForm(true, parent);

            return(md);
        }
コード例 #14
0
        private Boolean SaveData(String approveFlag)
        {
            if (!CHelper.VerifyAccessRight(getAccessRightEdit()))
            {
                return(false);
            }

            vw.RefDocDate   = vw.DocumentDate;
            vw.DocumentType = ((int)dt).ToString();
            vw.ConstructWhDefinitionFromCrDr();
            vw.CalculateARAmountForDrCr();

            if (approveFlag.Equals("Y"))
            {
                Boolean result = SaveToView();
                if (!result)
                {
                    return(false);
                }

                CUtil.EnableForm(false, this);
                CTable t = OnixWebServiceAPI.ApproveAccountDoc(vw.GetDbObject().Clone());
                CUtil.EnableForm(true, this);
                if (t != null)
                {
                    MInventoryDoc vcd = new MInventoryDoc(t);
                    vcd.InitErrorItem();
                    if (vcd.ErrorItems.Count > 0)
                    {
                        WinErrorDetails w = new WinErrorDetails(vcd.ErrorItems, "InventoryDoc");
                        w.Title = CLanguage.getValue("approve_error");
                        w.ShowDialog();
                    }
                    else
                    {
                        if (Mode.Equals("A"))
                        {
                            vw.SetDbObject(t);
                            vw.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString();
                            (vw as MAccountDoc).NotifyAllPropertiesChanged();

                            if (itemAddedHandler != null)
                            {
                                itemAddedHandler(vw, null);
                            }
                            else
                            {
                                //Will be obsoleted soon
                                parentItemsSource.Insert(0, vw);
                            }
                        }
                        else if (Mode.Equals("E"))
                        {
                            actualView.SetDbObject(t);
                            actualView.DocumentStatus = ((int)CashDocumentStatus.CashDocApproved).ToString();
                            (actualView as MAccountDoc).NotifyAllPropertiesChanged();
                        }

                        vw.IsModified = false;
                        this.Close();
                    }
                }
            }

            else if (Mode.Equals("A"))
            {
                if (SaveToView())
                {
                    CUtil.EnableForm(false, this);
                    vw.DocumentStatus = ((int)CashDocumentStatus.CashDocPending).ToString();

                    CTable newobj = OnixWebServiceAPI.CreateAccountDoc(vw.GetDbObject());
                    CUtil.EnableForm(true, this);
                    if (newobj != null)
                    {
                        vw.SetDbObject(newobj);
                        if (itemAddedHandler != null)
                        {
                            itemAddedHandler(vw, null);
                        }
                        else
                        {
                            //Will be obsoleted soon
                            parentItemsSource.Insert(0, vw);
                        }
                        return(true);
                    }

                    //Error here
                    CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null);
                    return(false);
                }
            }
            else if (Mode.Equals("E"))
            {
                if (vw.IsModified)
                {
                    Boolean result = SaveToView();
                    if (result)
                    {
                        CUtil.EnableForm(false, this);
                        CTable t = OnixWebServiceAPI.UpdateAccountDoc(vw.GetDbObject());
                        CUtil.EnableForm(true, this);
                        if (t != null)
                        {
                            actualView.SetDbObject(t);
                            actualView.NotifyAllPropertiesChanged();

                            return(true);
                        }

                        CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_EDIT", null);
                    }

                    return(false);
                }

                return(true);
            }

            return(false);
        }
コード例 #15
0
        private Boolean ValidateData()
        {
            Boolean result = false;

            result = CHelper.ValidateTextBox(lblDocumentNo, txtDocNo, true);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblDocumentStatus, txtStatus, false);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateLookup(lblCustomer, uCustomer, false);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateTextBox(lblDesc, txtDesc, true);
            if (!result)
            {
                return(result);
            }
            result = CHelper.ValidateComboBox(lblBranch, cboBranch, false);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblDebtAmount, txtDebtAmount, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblNet, txtNet, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            result = CHelper.ValidateTextBox(lblhwdvalue, txthwdvalue, false, InputDataType.InputTypeZeroPossitiveDecimal);
            if (!result)
            {
                return(result);
            }

            CTable      ug = new CTable("ACCOUNT_DOC");
            MAccountDoc uv = new MAccountDoc(ug);

            uv.DocumentNo = txtDocNo.Text;
            if (vw != null)
            {
                uv.AccountDocId = (vw as MAccountDoc).AccountDocId;
            }
            if (OnixWebServiceAPI.IsAccountDocExist(uv.GetDbObject()))
            {
                CHelper.ShowKeyExist(lblDocumentNo, txtDocNo);
                return(false);
            }

            return(result);
        }