public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            MAccountDocPayment mp = model as MAccountDocPayment;

            CTable tb = model.GetDbObject();

            tb.SetFieldValue("CHUNK_FLAG", "Y");
            tb.SetFieldValue("OWNER_FLAG", "Y");
            tb.SetFieldValue("DOCUMENT_STATUS", "2");
            tb.SetFieldValue("IS_NULL_REFUND_STATUS", "Y");
            tb.SetFieldValue("REFUND_STATUS", "");

            items = OnixWebServiceAPI.GetListAPI("GetPaymentTransactionList", "PAYMENT_TRANSACTION_LIST", tb);

            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MAccountDocPayment v = new MAccountDocPayment(o);

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
        private MVTaxFormPRV3_53 fetchData()
        {
            if (currIdx >= arr.Count)
            {
                CTable t = new CTable("");

                t.SetFieldValue("TAX_DOC_ID", actualView.TaxDocID);
                t.SetFieldValue("EXT_CHUNK_NO", chunk.ToString());
                arr = OnixWebServiceAPI.GetListAPI("GetTaxDocRv3Rv53List", "TAX_DOC_REV_LIST", t);

                CTable lastObj = OnixWebServiceAPI.GetLastObjectReturned();
                chunkCount  = CUtil.StringToInt(lastObj.GetFieldValue("EXT_CHUNK_COUNT"));
                recordCount = CUtil.StringToInt(lastObj.GetFieldValue("EXT_RECORD_COUNT"));

                currIdx = 0;
                chunk++;
            }

            if (arr.Count > 0)
            {
                CTable o = (CTable)arr[currIdx];
                currIdx++;
                currRecord++;

                MVTaxFormPRV3_53 m = new MVTaxFormPRV3_53(o);
                return(m);
            }

            return(null);
        }
Exemplo n.º 3
0
        private void filterDrCrAmount(CTable o)
        {
            int factor = 1;

            String docType         = o.GetFieldValue("DOCUMENT_TYPE");
            AccountDocumentType dt = (AccountDocumentType)CUtil.StringToInt(docType);

            if ((dt == AccountDocumentType.AcctDocDrNote) || (dt == AccountDocumentType.AcctDocDrNotePurchase))
            {
                factor = 1;
            }
            else if ((dt == AccountDocumentType.AcctDocCrNotePurchase) || (dt == AccountDocumentType.AcctDocCrNote))
            {
                factor = -1;
            }

            ArrayList temps = new ArrayList {
                "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "TOTAL"
            };

            for (int i = 0; i <= 12; i++)
            {
                String mm  = (String)temps[i];
                double amt = CUtil.StringToDouble(o.GetFieldValue(mm));

                amt = factor * Math.Abs(amt);
                o.SetFieldValue(mm, amt.ToString());
            }

            o.SetFieldValue("DOC_TYPE_DESC", CLanguage.getValue("doc_" + docType));
        }
Exemplo n.º 4
0
        //Get ScreenConfig by using the same API as GetReportConfig
        public void LoadScreenConfig()
        {
            CTable o = new CTable("");

            o.SetFieldValue("REPORT_NAME", refID);
            o.SetFieldValue("USER_ID", OnixWebServiceAPI.UserID());

            ArrayList arr = OnixWebServiceAPI.GetReportConfigList(o);

            if (arr.Count <= 0)
            {
                return;
            }

            CTable obj = (CTable)arr[0];

            CTable info = OnixWebServiceAPI.GetReportConfigInfo(obj);

            scrConfig.SetDbObject(info);

            ArrayList cols = info.GetChildArray("SORTABLE_COLUMN_ITEMS");

            if (cols == null)
            {
                return;
            }
            foreach (CTable t in cols)
            {
                MCriteriaColumn v = new MCriteriaColumn(t);
                scrConfig.SortingColumns.Add(v);
            }
        }
        private void manipulateRow(CTable o)
        {
            string code       = "";
            string name       = "";
            string typeName   = "";
            string selectType = o.GetFieldValue("SELECTION_TYPE");

            if (selectType.Equals("2"))
            {
                code     = o.GetFieldValue("ITEM_CODE");
                name     = o.GetFieldValue("ITEM_NAME_THAI");
                typeName = CLanguage.getValue("item");
            }
            else if (selectType.Equals("1"))
            {
                code     = o.GetFieldValue("SERVICE_CODE");
                name     = o.GetFieldValue("SERVICE_NAME");
                typeName = CLanguage.getValue("service");
            }
            else
            {
                code     = CLanguage.getValue("free_text");
                name     = o.GetFieldValue("FREE_TEXT");
                typeName = code;
            }

            o.SetFieldValue("SELECTION_TYPE_NAME", typeName);
            o.SetFieldValue("DISPLAY_CODE", code);
            o.SetFieldValue("DISPLAY_NAME", name);
        }
        private void filterDrCrAmount(CTable o)
        {
            double r1           = CUtil.StringToDouble(o.GetFieldValue("01"));
            double r2           = CUtil.StringToDouble(o.GetFieldValue("02"));
            double r3           = CUtil.StringToDouble(o.GetFieldValue("11"));
            double r4           = CUtil.StringToDouble(o.GetFieldValue("03"));
            double r4cr         = -1 * r4;
            double r5           = CUtil.StringToDouble(o.GetFieldValue("04"));
            double totalReceipt = r1 + r2 + r3 + r4cr + r5;

            double e1           = CUtil.StringToDouble(o.GetFieldValue("05"));
            double e2           = CUtil.StringToDouble(o.GetFieldValue("06"));
            double e3           = CUtil.StringToDouble(o.GetFieldValue("12"));
            double e4           = CUtil.StringToDouble(o.GetFieldValue("07"));
            double e4cr         = -1 * e4;
            double e5           = CUtil.StringToDouble(o.GetFieldValue("08"));
            double totalExpense = e1 + e2 + e3 + e4cr + e5;

            double profit = totalReceipt - totalExpense;

            o.SetFieldValue("CR03", r4cr.ToString());
            o.SetFieldValue("CR07", e4cr.ToString());
            o.SetFieldValue("TOTAL_RECEIVE", totalReceipt.ToString());
            o.SetFieldValue("TOTAL_EXPENSE", totalExpense.ToString());
            o.SetFieldValue("TOTAL", profit.ToString());
        }
Exemplo n.º 7
0
        private void cmdTaxReport_Click(object sender, RoutedEventArgs e)
        {
            bool result = CHelper.ValidateTextBox(lblEmployeeTax, txtTaxYear, false);

            if (!result)
            {
                return;
            }

            MEmployee emp = vw as MEmployee;

            CTable dat = emp.GetDbObject().CloneAll();

            dat.SetFieldValue("TAX_YEAR", txtTaxYear.Text);
            dat.SetFieldValue("EMPLOYEE_ID", emp.EmployeeID);
            CTable    obj = OnixWebServiceAPI.SubmitObjectAPI("GetEmployeeTaxYearSummary", dat);
            ArrayList arr = obj.GetChildArray("EMPLOYEE_YEARLY_SUMMARY");

            emp.EmployeeTax.TaxYear = txtTaxYear.Text;
            if (arr.Count > 0)
            {
                CTable o = (CTable)arr[0];

                emp.EmployeeTax.TaxAmount             = o.GetFieldValue("DEDUCT_TAX");
                emp.EmployeeTax.RevenueAmount         = o.GetFieldValue("RECEIVE_AMOUNT");
                emp.EmployeeTax.SocialInsuranceAmount = o.GetFieldValue("DEDUCT_SOCIAL_SECURITY");
            }

            WinFormPrinting w = new WinFormPrinting("grpHRTax", emp);

            w.ShowDialog();
        }
Exemplo n.º 8
0
        private void CmdAuto_Click(object sender, RoutedEventArgs e)
        {
            if (mv.EmployeeID.Equals(""))
            {
                return;
            }

            CUtil.EnableForm(false, this);

            CTable dat = new CTable("");

            dat.SetFieldValue("FROM_DOCUMENT_DATE", CUtil.DateTimeToDateStringInternalMin(mvParent.FromSalaryDate));
            dat.SetFieldValue("TO_DOCUMENT_DATE", CUtil.DateTimeToDateStringInternalMax(mvParent.ToSalaryDate));
            dat.SetFieldValue("EMPLOYEE_ID", mv.EmployeeID);

            ArrayList arr = OnixWebServiceAPI.GetListAPI("GetEmployeePayrollAccumulate", "PAYROLL_EMPLOYEE_ACCUM_LIST", dat);

            mv.ReceiveOT = getAmount(arr, "EMPLOYEE_OT");
            if (mvParent.EmployeeType.Equals("1"))
            {
                mv.ReceiveIncome = getAmount(arr, "EMPLOYEE_WORK");
            }
            mv.ReceiveTransaportation = getAmount(arr, "EMPLOYEE_EXPENSE");
            mv.DeductPenalty          = getAmount(arr, "EMPLOYEE_DEDUCTION");

            CUtil.EnableForm(true, this);
        }
Exemplo n.º 9
0
        private void filterDrCrAmount(CTable o)
        {
            double vatAmt = CUtil.StringToDouble(o.GetFieldValue("VAT_AMT"));
            double amt    = CUtil.StringToDouble(o.GetFieldValue("REVENUE_EXPENSE_FOR_VAT_AMT"));
            double arap   = CUtil.StringToDouble(o.GetFieldValue("AR_AP_AMT"));

            int factor = 1;

            AccountDocumentType dt = (AccountDocumentType)CUtil.StringToInt(o.GetFieldValue("DOCUMENT_TYPE"));

            if ((dt == AccountDocumentType.AcctDocDrNote) || (dt == AccountDocumentType.AcctDocDrNotePurchase))
            {
                factor = 1;
            }
            else if ((dt == AccountDocumentType.AcctDocCrNotePurchase) || (dt == AccountDocumentType.AcctDocCrNote))
            {
                factor = -1;
            }

            vatAmt = factor * Math.Abs(vatAmt);
            amt    = factor * Math.Abs(amt);
            arap   = factor * Math.Abs(arap);

            o.SetFieldValue("VAT_AMT", vatAmt.ToString());
            o.SetFieldValue("REVENUE_EXPENSE_FOR_VAT_AMT", amt.ToString());
            o.SetFieldValue("AR_AP_AMT", arap.ToString());
        }
Exemplo n.º 10
0
        private void filterDrCrAmount(CTable o)
        {
            double revExp = CUtil.StringToDouble(o.GetFieldValue("REVENUE_EXPENSE_AMT"));
            double vatAmt = CUtil.StringToDouble(o.GetFieldValue("VAT_AMT"));
            double whAmt  = CUtil.StringToDouble(o.GetFieldValue("WH_TAX_AMT"));
            double amt    = CUtil.StringToDouble(o.GetFieldValue("CASH_RECEIPT_AMT"));

            int factor = 1;

            AccountDocumentType dt = (AccountDocumentType)CUtil.StringToInt(o.GetFieldValue("DOCUMENT_TYPE"));

            if ((dt == AccountDocumentType.AcctDocDrNote) || (dt == AccountDocumentType.AcctDocDrNotePurchase))
            {
                factor = 1;
            }
            else if ((dt == AccountDocumentType.AcctDocCrNotePurchase) || (dt == AccountDocumentType.AcctDocCrNote))
            {
                factor = -1;
            }

            vatAmt = factor * Math.Abs(vatAmt);
            whAmt  = factor * Math.Abs(whAmt);
            amt    = factor * Math.Abs(amt);
            revExp = factor * Math.Abs(revExp);

            o.SetFieldValue("PRIMARY_REVENUE_EXPENSE_AMT", revExp.ToString());
            o.SetFieldValue("VAT_AMT", vatAmt.ToString());
            o.SetFieldValue("WH_TAX_AMT", whAmt.ToString());
            o.SetFieldValue("CASH_RECEIPT_AMT", amt.ToString());
        }
        private void populateTempFields(CTable o)
        {
            MAccountDocItem di = new MAccountDocItem(o);

            o.SetFieldValue("SELECTED_ITEM_CODE", di.SelectItemCode);
            o.SetFieldValue("SELECTED_ITEM_CODE", di.SelectItemCode);
            o.SetFieldValue("SELECTED_ITEM_NAME", di.SelectItemName);
            o.SetFieldValue("SELECTED_UNIT_NAME", di.UnitName);

            di = null;
        }
Exemplo n.º 12
0
        private void populateCacheRow(CTable cacheRow, CMergeCellParam mergedParam, CRow row, CColumn col)
        {
            String    text    = col.GetText().Text;
            ArrayList columns = cacheRow.GetChildArray("COLUMNS");

            CTable cacheColumn = new CTable("");

            columns.Add(cacheColumn);

            int fromCell = mergedParam.FromCell + 1;
            int toCell   = mergedParam.ToCell + 1;
            int span     = mergedParam.CellMergedCount;

            cacheColumn.SetFieldValue("TEXT", text);
            cacheColumn.SetFieldValue("FROM_CELL", fromCell.ToString());
            cacheColumn.SetFieldValue("TO_CELL", toCell.ToString());
            cacheColumn.SetFieldValue("CELL_SPAN", span.ToString());

            Boolean isBold = row.GetFontWeight().Equals(System.Windows.FontWeights.Bold);
            String  dt     = col.getDataType();

            System.Windows.HorizontalAlignment align = col.GetHorizontalAlignment();

            cacheColumn.SetFieldValue("IS_BOLD", isBold.ToString());
            cacheColumn.SetFieldValue("TYPE", dt);
            cacheColumn.SetFieldValue("TEXT_ALIGN", align.ToString());
            cacheColumn.SetFieldValue("IS_MERGED", mergedParam.IsMerged.ToString());
        }
Exemplo n.º 13
0
        private void filterRecord(CTable o)
        {
            String docType = o.GetFieldValue("DOCUMENT_TYPE");

            o.SetFieldValue("DOC_TYPE_DESC", docTypeMapping(docType));

            if ("p001,m_001,m_002,r_tot,e_tot".Contains(docType))
            {
                o.SetFieldValue("ROW_TYPE", "FOOTER_LEVEL1");
            }
            else
            {
                o.SetFieldValue("ROW_TYPE", "DATA_LEVEL1");
            }
        }
Exemplo n.º 14
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            MAccountDoc mp = model as MAccountDoc;

            mp.Category = eType;

            CTable tb = model.GetDbObject();

            String tmpSet = "(1, 2)"; //Only pending and approved, no cancled status

            tb.SetFieldValue("DOCUMENT_STATUS_SET", tmpSet);

            items = OnixWebServiceAPI.GetBillSummaryAbleDocList(tb);

            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MAccountDoc v = new MAccountDoc(o);

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
        private void populateTotalAmount(CTable data)
        {
            double vatamt   = CUtil.StringToDouble(data.GetFieldValue("VAT_TAX_AMT"));
            double revExp   = CUtil.StringToDouble(data.GetFieldValue("REVENUE_EXPENSE_AMT"));
            double wh       = CUtil.StringToDouble(data.GetFieldValue("WH_TAX_AMT"));
            int    redeemID = CUtil.StringToInt(data.GetFieldValue("REDEEM_DOCUMENT_ID"));

            double amt = revExp + vatamt - wh;

            data.SetFieldValue("TEMP_TOTAL_AMT", amt.ToString());

            if (redeemID > 0)
            {
                data.SetFieldValue("REDEEM_FLAG", "Y");
            }
        }
Exemplo n.º 16
0
        //Send OBJECT node to this function
        private CTable populateTableObject(XmlNode node)
        {
            CTable table = new CTable(node.Attributes["name"].Value);

            foreach (XmlNode n1 in node.ChildNodes)
            {
                if (n1.Name.Equals("FIELD"))
                {
                    table.SetFieldValue(n1.Attributes["name"].Value, n1.InnerText);
                }
                else if (n1.Name.Equals("ITEMS"))
                {
                    String arrName = n1.Attributes["name"].Value;

                    ArrayList arr = new ArrayList();
                    table.AddChildArray(arrName, arr);

                    foreach (XmlNode n2 in n1.ChildNodes)
                    {
                        //Only OBJECTs are here
                        if (n2.Name.Equals("OBJECT"))
                        {
                            //Recursive
                            CTable child = populateTableObject(n2);
                            arr.Add(child);
                        }
                    }
                }
            }

            return(table);
        }
Exemplo n.º 17
0
        private void populateSalary()
        {
            if (isInLoad)
            {
                return;
            }

            if (mv.EmployeeID.Equals(""))
            {
                return;
            }

            String empID = mv.EmployeeID;

            CTable dat = new CTable("");

            dat.SetFieldValue("EMPLOYEE_ID", empID);

            CUtil.EnableForm(false, this);
            CTable empObj = OnixWebServiceAPI.SubmitObjectAPI("GetEmployeeInfo", dat);

            CUtil.EnableForm(true, this);

            MEmployee emp = new MEmployee(empObj);

            mv.ReceiveIncome = emp.Salary;
        }
Exemplo n.º 18
0
        private void cmdTest_Click(object sender, RoutedEventArgs e)
        {
            OnixConnectionXML dbos = new OnixConnectionXML(txtDesc.Password, url, "pemgail9uzpgzl88");

            String sendString = "HELLOWORLD";

            CTable t = new CTable("");

            t.SetFieldValue("ECHO_MESSAGE", sendString);
            CUtil.EnableForm(false, this);
            CTable echo = OnixWebServiceAPI.TestServer(dbos, t);

            CUtil.EnableForm(true, this);

            if (echo == null)
            {
                CMessageBox.Show(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                String returnStr = echo.GetFieldValue("RETURN_MESSAGE");
                if (sendString.Equals(returnStr))
                {
                    CMessageBox.Show(CLanguage.getValue("connect_success"), "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    CMessageBox.Show(CLanguage.getValue("connect_fail"), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Exemplo n.º 19
0
        private void populateTempFields(CTable o)
        {
            String name     = o.GetFieldValue("EMPLOYEE_NAME");
            String lastName = o.GetFieldValue("EMPLOYEE_LASTNAME");
            double refund   = CUtil.StringToDouble(o.GetFieldValue("RECEIVE_REFUND"));
            double coverage = CUtil.StringToDouble(o.GetFieldValue("DEDUCT_COVERAGE"));

            o.SetFieldValue("EMPLOYEE_NAME_LASTNAME", name + " " + lastName);
            double received = getSumArray(o, empReceives);
            double deduct   = getSumArray(o, empDeducts);
            double total    = received + refund - deduct - coverage;

            o.SetFieldValue("EMP_DEDUCT_TOTAL", deduct.ToString());
            o.SetFieldValue("EMP_RECEIVED_TOTAL", received.ToString());
            o.SetFieldValue("EMP_AMOUNT_TOTAL", total.ToString());
        }
Exemplo n.º 20
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            MVTaxDocument ad = (model as MVTaxDocument);
            CTable        tb = ad.GetDbObject();

            tb.SetFieldValue("DOCUMENT_TYPE_SET", "(4)");

            items = OnixWebServiceAPI.GetListAPI("GetTaxDocList", "TAX_DOC_LIST", tb);
            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MVTaxDocument v = new MVTaxDocument(o);

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
Exemplo n.º 21
0
        private void WinMain_OnLoad(object sender, RoutedEventArgs e)
        {
            CConfig.ConfigRead();

            initStatusBar();

            WinLogin wLogin = new WinLogin();

            wLogin.ShowDialog();
            Boolean isOK = wLogin.LoginOK;

            if (isOK)
            {
                stbiUserValue.Content = OnixWebServiceAPI.GetLastUserLogin();
                isLogin = true;

                configureMenu();

                //Load user variables
                if (!OnixWebServiceAPI.UserID().Equals(""))
                {
                    currentUser = new CTable("USER");
                    currentUser.SetFieldValue("USER_ID", OnixWebServiceAPI.UserID());
                    currentUser = OnixWebServiceAPI.GetUserInfo(currentUser);
                    CConfig.LoadLastValueSaved(currentUser);
                }

                CReportFactory.InitReports();
                CMasterReference.LoadCompanyProfile();
                CGlobalVariable.InitGlobalVariables();
                CMasterReference.LoadAllMasterRefItems(OnixWebServiceAPI.GetAllMasterRefList);
                CUtil.ExportLoadingImage();
            }
        }
Exemplo n.º 22
0
        public void AddPromotionItem(CBasketItemDisplay itm, String arrName)
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray(arrName);

            if (arr == null)
            {
                arr = new ArrayList();
                o.AddChildArray(arrName, arr);
            }

            itm.ExtFlag         = "A";
            itm.Seq             = seq;
            itm.DisplayCategory = getDisplayCategory(arrName);
            ObservableCollection <CBasketItemDisplay> items = getNameMapArray(arrName);

            CTable t = itm.CreateCTableObject();

            t.SetFieldValue("INTERNAL_SEQ", seq.ToString());
            arr.Add(t);

            seq++;

            items.Add(itm);
        }
Exemplo n.º 23
0
        private void cmdSearch_Click(object sender, RoutedEventArgs e)
        {
            CTable tb = criteria.Model.GetDbObject();

            tb.SetFieldValue("EXT_CHUNK_NO", "");
            query(tb);
        }
Exemplo n.º 24
0
        private void CmdAddProduct_Click(object sender, RoutedEventArgs e)
        {
            MVTaxDocument td = (MVTaxDocument)vw;

            if (td.TaxDocID.Equals(""))
            {
                CHelper.ShowErorMessage("", "ERROR_PLEASE_SAVE_FIRST", null);
                return;
            }

            Boolean result = validateData();

            if (!result)
            {
                return;
            }

            TaxDocumentType tdt = (TaxDocumentType)CUtil.StringToInt(td.DocumentType);

            String tt = "53";

            if (tdt == TaxDocumentType.TaxDocRev3)
            {
                tt = "3";
            }

            CTable t = vw.GetDbObject();

            t.SetFieldValue("RV_TAX_TYPE", tt);

            CUtil.EnableForm(false, this);
            CTable obj = OnixWebServiceAPI.SubmitObjectAPI("PopulateWhItems", t);

            CUtil.EnableForm(true, this);

            if (obj == null)
            {
                CHelper.ShowErorMessage("", "ERROR_NO_ITEM_FOUND", null);
                return;
            }

            if (obj != null)
            {
                td.ItemCount        = obj.GetFieldValue("ITEM_COUNT");
                td.WhAmount         = obj.GetFieldValue("WH_AMOUNT");
                td.ExpenseAmount    = obj.GetFieldValue("EXPENSE_REVENUE_AMT");
                td.PreviousRunMonth = obj.GetFieldValue("PREVIOUS_RUN_MONTH");
                td.PreviousRunYear  = obj.GetFieldValue("PREVIOUS_RUN_YEAR");

                ArrayList arr = obj.GetChildArray("WH_ITEMS");
                if (arr.Count <= 0)
                {
                    //Just notify
                    CHelper.ShowErorMessage("", "ERROR_NO_ITEM_FOUND", null);
                }

                td.PopulateWhItems(arr);
                td.IsModified = true;
            }
        }
Exemplo n.º 25
0
        private static MAccessRight retrieveAccessRight(String accessRightMode)
        {
            CTable data = new CTable("");

            data.SetFieldValue("ACCESS_RIGHT_CODE", accessRightMode);

            CTable       acr = OnixWebServiceAPI.SubmitObjectAPI("GetUserContextAccessRight", data);
            MAccessRight m   = null;

            if (acr == null)
            {
                acr = new CTable("");
                m   = new MAccessRight(acr);

                //Next time will call API immediately
                m.LastUpdateDate = DateTime.Now;
                m.ExpireDate     = m.LastUpdateDate;

                //If permission has not been added then allow (I don't want to annoy user if permission is not yet added)
                m.IsEnable = true;
            }
            else
            {
                m = new MAccessRight(acr);
                m.LastUpdateDate = DateTime.Now;
                //Refresh from API in every 5 minutes
                m.ExpireDate = m.LastUpdateDate.AddMinutes(refreshIntervalMinute);
            }

            return(m);
        }
Exemplo n.º 26
0
        protected void removeAssociateItems(MBaseModel vp, String arrName, String seqField, String idField)
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray(arrName);

            if (arr == null)
            {
                return;
            }

            CTable obj = vp.GetDbObject();
            String seq = obj.GetFieldValue(seqField);

            foreach (CTable t in arr)
            {
                String q = t.GetFieldValue(seqField);
                if (q.Equals(seq))
                {
                    if (obj.GetFieldValue(idField).Equals(""))
                    {
                        arr.Remove(t);
                        break;
                    }
                    else
                    {
                        obj.SetFieldValue("EXT_FLAG", "D");
                    }
                }
            }
        }
        private void cmdSaleOrderUnlink_Click(object sender, RoutedEventArgs e)
        {
            CTable m = new CTable("");

            m.SetFieldValue("ACCOUNT_DOC_ID", vw.RefSaleOrderID);

            CUtil.EnableForm(false, this);
            CTable t = OnixWebServiceAPI.GetAccountDocInfo(m);

            CUtil.EnableForm(true, this);

            if (t == null)
            {
                return;
            }

            MAccountDoc vm = new MAccountDoc(t);
            Boolean     ok = CHelper.AskConfirmMessage(vm.DocumentNo, "ERROR_SALE_ORDER_UNLINK");

            if (!ok)
            {
                return;
            }

            OnixWebServiceAPI.UnlinkSaleOrderFromInvoice(vw.GetDbObject());
            vw.RefSaleOrderID = "";
        }
Exemplo n.º 28
0
        private CTable getAccumObject(String accumType)
        {
            CTable dat = new CTable("");

            dat.SetFieldValue("START_DATE", CUtil.DateTimeToDateStringInternalMin(mvParent.FromSalaryDate));
            dat.SetFieldValue("ACCUM_TYPE", accumType);
            dat.SetFieldValue("EMPLOYEE_ID", mv.EmployeeID);

            ArrayList arr = OnixWebServiceAPI.GetListAPI("GetEmployeeAccumulate", "EMPLOYEE_PAYROLL_ACCUM_LIST", dat);

            if (arr.Count > 0)
            {
                return((CTable)arr[0]);
            }

            return(new CTable(""));
        }
Exemplo n.º 29
0
        public void AddRow(CRow row)
        {
            String name = row.GetName();

            if (name.Contains("GLB_HEADER_LEVEL0"))
            {
                currentPage++;
            }

            if ((currentPage > 1) && name.Contains("HEADER"))
            {
                //Skip header if page greater than 1
                return;
            }

            currentRow++;

            ArrayList arr = (ArrayList)rowMergedParam[name];

            if (arr == null)
            {
                return;
            }

            int    cnt     = row.GetColumnCount();
            String rowText = String.Format("{0}", name);

            CTable cacheRow = new CTable("ROW");

            cacheRow.SetFieldValue("ROW_ID", currentRow.ToString());
            cacheRow.SetFieldValue("ROW_TYPE", row.GetName());
            cacheRow.AddChildArray("COLUMNS", new ArrayList());
            cacheRows.Add(cacheRow);

            for (int i = 0; i < cnt; i++)
            {
                CMergeCellParam mergedParam = (CMergeCellParam)arr[i];
                CColumn         col         = row.GetColumn(i);
                String          text        = col.GetText().Text;

                populateCacheRow(cacheRow, mergedParam, row, col);
            }

            String dummy = rowText;
        }
Exemplo n.º 30
0
        private void mnuContextMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mnu  = (sender as MenuItem);
            string   name = mnu.Name;

            if (name.Equals("mnuEdit"))
            {
                ShowEditWindowEx(docType, (MAccountDoc)currentObj, printPreview);
            }
            else if (name.Equals("mnuCopy") || name.Equals("mnuCopyHead"))
            {
                CTable t = currentObj.GetDbObject();
                CUtil.EnableForm(false, ParentControl);

                t.SetFieldValue("IS_ONLY_HEAD", "N");
                if (name.Equals("mnuCopyHead"))
                {
                    t.SetFieldValue("IS_ONLY_HEAD", "Y");
                }

                CTable newobj = OnixWebServiceAPI.CopyAccountDoc(t);

                if (newobj != null)
                {
                    MAccountDoc ivd = new MAccountDoc(newobj);
                    ItemAddedEvent(ivd, e);
                }
                else
                {
                    //Error here
                    CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null);
                }

                CUtil.EnableForm(true, ParentControl);
            }
            else if (name.Equals("mnuPrint"))
            {
                CUtil.EnableForm(false, ParentControl);

                WinFormPrinting wp = new WinFormPrinting(docTypeToReportGroup(docType), getAccountDocObject((currentObj as MAccountDoc).AccountDocId));
                wp.ShowDialog();

                CUtil.EnableForm(true, ParentControl);
            }
        }