Exemple #1
0
        public void AddChildArray(String arrName, CTable data)
        {
            ArrayList arr = dbobj.GetChildArray(arrName);

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

            arr.Add(data);
        }
        public void InitChildItems(String groupNo, ObservableCollection <MCompanyPackage> items)
        {
            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("COMPANY_PACKAGE_ITEM");

            if (arr == null)
            {
                return;
            }

            items.Clear();
            foreach (CTable t in arr)
            {
                MCompanyPackage v = new MCompanyPackage(t);
                if (v.PackageGroup.Equals(groupNo))
                {
                    items.Add(v);
                }

                v.ExtFlag = "I";
            }
        }
Exemple #3
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");
                    }
                }
            }
        }
Exemple #4
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();
        }
        //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);
            }
        }
Exemple #6
0
        private void initExpenseItem()
        {
            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("OT_EXPENSE_LIST");

            if (arr == null)
            {
                expenseItems.Clear();
                return;
            }

            expenseItems.Clear();
            foreach (CTable t in arr)
            {
                MVPayrollExpenseItem v = new MVPayrollExpenseItem(t);

                expenseItems.Add(v);
                v.ExtFlag = "I";
            }
        }
Exemple #7
0
        public override void InitializeAfterLoaded()
        {
            leaveItems.Clear();

            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("EMPLOYEE_LEAVE_RECORDS");

            if (arr == null)
            {
                return;
            }

            foreach (CTable t in arr)
            {
                MLeaveRecord v = new MLeaveRecord(t);
                leaveItems.Add(v);

                v.Seq = internalSeq;

                v.ExtFlag = "I";
            }

            CalculateLeaveTotal();
        }
Exemple #8
0
        public void InitItem(GenericStringTypeFilterCallback requireFunc)
        {
            items.Clear();

            CTable    o    = GetDbObject();
            ArrayList narr = o.GetChildArray("GLOBAL_VARIABLE_ITEM");

            if (narr == null)
            {
                narr = new ArrayList();
                o.AddChildArray("GLOBAL_VARIABLE_ITEM", narr);
            }

            foreach (CTable t in narr)
            {
                MGlobalVariable v = new MGlobalVariable(t);

                if (!requireFunc(v.VariableName))
                {
                    continue;
                }

                items.Add(v);
                v.ExtFlag = "I";
            }
        }
Exemple #9
0
        public void InitPackageBonusFilters()
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PACKAGE_BONUS_ITEM");

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

            int cntBuy = 0, cntFree = 0;

            foreach (CTable t in arr)
            {
                MPackageBonus v = new MPackageBonus(t);
                if (v.QuantityType.Equals("1"))
                {
                    package_bonusFilterBuy.Add(v);
                    cntBuy++;
                }
                else if (v.QuantityType.Equals("2"))
                {
                    package_bonusFilterFree.Add(v);
                    cntFree++;
                }
                v.ExtFlag = "I";

                v.Seq = bonusItemSeq;
                bonusItemSeq++;
            }
        }
Exemple #10
0
        public void InitPackageDiscountFilters()
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PACKAGE_DISCOUNT_ITEM");

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

            int cnt = 0;

            foreach (CTable t in arr)
            {
                MPackageDiscount v = new MPackageDiscount(t);
                package_discountFilter.Add(v);
                v.ExtFlag = "I";

                v.Seq = priceItemSeq;
                priceItemSeq++;

                cnt++;
            }
        }
Exemple #11
0
        public void InitReportConfig()
        {
            variables.Clear();

            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("REPORT_CONFIG_LIST");

            if (arr == null)
            {
                return;
            }

            foreach (CTable obj in arr)
            {
                MGlobalVariable v = new MGlobalVariable(obj);
                fieldHash[v.VariableName] = v;

                if (!defaultFields.ContainsKey(v.VariableName))
                {
                    variables.Add(v);
                }
            }
        }
Exemple #12
0
        public void InitItem(GenericStringTypeFilterCallback requireFunc)
        {
            items.Clear();

            CTable    o    = GetDbObject();
            ArrayList narr = o.GetChildArray("DOCUMENT_NUMBER_LIST");

            if (narr == null)
            {
                narr = new ArrayList();
                o.AddChildArray("DOCUMENT_NUMBER_LIST", narr);
            }

            foreach (CTable t in narr)
            {
                MDocumentNumber v = new MDocumentNumber(t);

                if (!requireFunc(v.DocType))
                {
                    continue;
                }

                items.Add(v);
                v.ExtFlag = "I";
            }
        }
Exemple #13
0
        private void processAll()
        {
            Hashtable   args    = GetArguments();
            string      basedir = args["basedir"].ToString();
            ILogger     logger  = GetLogger();
            SaveProduct opr     = (SaveProduct)FactoryBusinessOperation.CreateBusinessOperationObject("SaveProduct");
            CTable      t       = XmlToCTable();

            ArrayList products = t.GetChildArray("Products");

            foreach (CTable pd in products)
            {
                MProduct mpd = new MProduct();
                mpd.Code        = pd.GetFieldValue("Code");
                mpd.Rating      = Int32.Parse(pd.GetFieldValue("Rating"));
                mpd.ProductType = pd.GetFieldValue("ProductType");
                mpd.Price       = Double.Parse(pd.GetFieldValue("Price"));
                mpd.NameColor   = pd.GetFieldValue("NameColor");
                mpd.NameBgColor = pd.GetFieldValue("NameBgColor");

                string[] imgPaths = { basedir, pd.GetFieldValue("Image1LocalPath") };
                mpd.Image1LocalPath = Path.Combine(imgPaths);

                processDescriptions(pd, mpd);
                processCompositionGroups(pd, mpd);
                processPerformances(pd, mpd);

                LogUtils.LogInformation(logger, "Adding product : [{0}]", mpd.Code);
                opr.Apply(mpd);
            }
        }
Exemple #14
0
        private void processPerformances(CTable pd, MProduct mpd)
        {
            ArrayList performances = pd.GetChildArray("Performances");

            foreach (CTable perf in performances)
            {
                MProductPerformance mpp = new MProductPerformance();
                mpp.Code     = perf.GetFieldValue("Code");
                mpp.Quantity = Double.Parse(perf.GetFieldValue("Quantity"));
                mpp.Unit     = perf.GetFieldValue("Unit");

                mpd.Performances.Add(mpp);

                ArrayList compositionDescs = perf.GetChildArray("Descriptions");
                foreach (CTable desc in compositionDescs)
                {
                    MGenericDescription mdc = new MGenericDescription();
                    mdc.Language         = desc.GetFieldValue("Language");
                    mdc.Name             = desc.GetFieldValue("Name");
                    mdc.ShortDescription = desc.GetFieldValue("ShortDescription");
                    mdc.LongDescription1 = desc.GetFieldValue("LongDescription1");
                    mdc.LongDescription2 = desc.GetFieldValue("LongDescription2");

                    mpp.Descriptions.Add(mdc.Language, mdc);
                }
            }
        }
Exemple #15
0
        private void processCompositionGroups(CTable pd, MProduct mpd)
        {
            ArrayList compositionGroups = pd.GetChildArray("CompositionGroups");

            foreach (CTable cg in compositionGroups)
            {
                MProductCompositionGroup mpcg = new MProductCompositionGroup();
                mpcg.PerUnit = cg.GetFieldValue("PerUnit");

                ArrayList compositions = cg.GetChildArray("Compositions");
                foreach (CTable comp in compositions)
                {
                    MProductComposition mpc = new MProductComposition();
                    mpc.Code     = comp.GetFieldValue("Code");
                    mpc.Quantity = Double.Parse(comp.GetFieldValue("Quantity"));
                    mpc.Unit     = comp.GetFieldValue("Unit");

                    mpcg.Compositions.Add(mpc);

                    ArrayList compositionDescs = comp.GetChildArray("Descriptions");
                    foreach (CTable desc in compositionDescs)
                    {
                        MGenericDescription mdc = new MGenericDescription();
                        mdc.Language         = desc.GetFieldValue("Language");
                        mdc.Name             = desc.GetFieldValue("Name");
                        mdc.ShortDescription = desc.GetFieldValue("ShortDescription");
                        mdc.LongDescription1 = desc.GetFieldValue("LongDescription1");
                        mdc.LongDescription2 = desc.GetFieldValue("LongDescription2");

                        mpc.Descriptions.Add(mdc.Language, mdc);
                    }
                }
                mpd.CompositionGroups.Add(mpcg);
            }
        }
        public void InitCurrentMovements()
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("MOVEMENT_ITEM");

            if (arr == null)
            {
                return;
            }

            currentMovements = null;
            currentMovements = new ObservableCollection <MBalanceTransaction>();

            int seq = 0;

            foreach (CTable t in arr)
            {
                MBalanceTransaction v = new MBalanceTransaction(t);
                if (seq == 0)
                {
                    MBalanceTransaction fw = new MBalanceTransaction(t.Clone());
                    fw.IsBalanceForward = true;
                    currentMovements.Add(fw);
                }

                currentMovements.Add(v);

                seq++;
            }
        }
Exemple #17
0
        public void ProcessCommissionBatch(String mode)
        {
            commissioBatchItem.Clear();

            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("COMMISSION_BATCH_ITEM");

            if (arr == null)
            {
                return;
            }

            int seq = 0;

            foreach (CTable t in arr)
            {
                t.RemoveChildArray("COMMISSION_INPUT");
                t.RemoveChildArray("COMMISSION_ITEM");

                MCommissionBatchDetail v = new MCommissionBatchDetail(t);
                commissioBatchItem.Add(v);
                seq++;
                v.Seq     = seq;
                v.ExtFlag = mode;
            }
        }
Exemple #18
0
        public void InitPackageVoucherFilters()
        {
            package_voucherBuy.Clear();
            package_voucherFree.Clear();

            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PACKAGE_VOUCHER_ITEM");

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

            int cntBuy = 0, cntFree = 0;

            foreach (CTable t in arr)
            {
                MPackageVoucher v = new MPackageVoucher(t);
                if (v.QuantityType.Equals("1"))
                {
                    package_voucherBuy.Add(v);
                    cntBuy++;
                }
                else if (v.QuantityType.Equals("2"))
                {
                    package_voucherFree.Add(v);
                    cntFree++;
                }
                v.ExtFlag = "I";

                v.Seq = voucherItemSeq;
                voucherItemSeq++;
            }
        }
Exemple #19
0
        public void AddChildItems(ObservableCollection <MCompanyCommissionProfile> items, MCompanyCommissionProfile vw, MCommissionProfile cv)
        {
            CTable t = new CTable("COMPANY_COMM_PROFILE");

            t.CopyFrom(cv.GetDbObject());

            MCompanyCommissionProfile v = new MCompanyCommissionProfile(t);

            v.CompanyCommProfID = "";
            v.CompanyID         = "1";
            v.SeqNo             = (v.GetMaxSeqNo((items)) + 1).ToString();

            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("COMPANY_COMM_PROFILE_ITEM");

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

            arr.Add(t);
            items.Add(v);

            v.ExtFlag = "A";
        }
Exemple #20
0
        public void InitPeriods()
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PACKAGE_PERIOD_ITEM");

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

            for (int d = 1; d <= 7; d++)
            {
                CTable dbo = getObjectByDay(arr, d.ToString());
                if (dbo == null)
                {
                    dbo = new CTable("PERIOD");
                    MPeriod p = new MPeriod(dbo);
                    p.ExtFlag   = "A";
                    p.DayOfWeek = d.ToString();
                    p.CreateDefaultValue();

                    arr.Add(dbo);
                    periods.Add(p);
                }
                else
                {
                    MPeriod p = new MPeriod(dbo);
                    p.ExtFlag = "I";
                    periods.Add(p);
                }
            }
        }
Exemple #21
0
        private void initOTDocItem()
        {
            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("OT_DOC_LIST");

            if (arr == null)
            {
                docItems.Clear();
                return;
            }

            docItems.Clear();
            foreach (CTable t in arr)
            {
                MVOTDocumentItem v = new MVOTDocumentItem(t);

                docItems.Add(v);
                v.ExtFlag = "I";
            }
        }
Exemple #22
0
        public void InitPackageCustomers()
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("PACKAGE_CUSTOMER_ITEM");

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

            int cnt = 0;

            foreach (CTable t in arr)
            {
                MPackageCustomer v = new MPackageCustomer(t);
                package_customerFilter.Add(v);
                v.ExtFlag = "I";

                v.Seq = customerItemSeq;
                customerItemSeq++;

                cnt++;
            }
        }
Exemple #23
0
        private void initDeductionItem()
        {
            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("DEDUCTION_LIST");

            if (arr == null)
            {
                deductionItems.Clear();
                return;
            }

            deductionItems.Clear();
            foreach (CTable t in arr)
            {
                MVPayrollDeductionItem v = new MVPayrollDeductionItem(t);

                deductionItems.Add(v);
                v.ExtFlag = "I";
            }
        }
Exemple #24
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());
        }
        public void InitCompanyImage()
        {
            companyImages.Clear();

            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("COMPANY_IMAGES");

            if (arr == null)
            {
                return;
            }

            foreach (CTable t in arr)
            {
                MCompanyImage v = new MCompanyImage(t);
                companyImages.Add(v);
                if (!v.ExtFlag.Equals("A"))
                {
                    v.ExtFlag = "I";
                }
            }
        }
Exemple #26
0
        public void DeletePromotionItem(CBasketItemDisplay itm, String arrName)
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray(arrName);
            int       seq = itm.Seq;

            if (arr == null)
            {
                return;
            }

            foreach (CTable t in arr)
            {
                int q = CUtil.StringToInt(t.GetFieldValue("INTERNAL_SEQ"));
                if (q == seq)
                {
                    if (itm.ID.Equals(""))
                    {
                        arr.Remove(t);
                        break;
                    }
                    else
                    {
                        t.SetFieldValue("EXT_FLAG", "D");
                        itm.ExtFlag = "D";
                    }
                }
            }

            ObservableCollection <CBasketItemDisplay> items = getNameMapArray(arrName);

            items.Remove(itm);
        }
Exemple #27
0
        public void DeleteSelectedItem(MSelectedItem itm)
        {
            CTable    o   = GetDbObject();
            ArrayList arr = o.GetChildArray("BILL_SIMULATE_ITEM");
            int       seq = itm.Seq;

            foreach (CTable t in arr)
            {
                int q = CUtil.StringToInt(t.GetFieldValue("INTERNAL_SEQ"));
                if (q == seq)
                {
                    if (itm.BillSelectedItemID.Equals(""))
                    {
                        arr.Remove(t);
                        break;
                    }
                    else
                    {
                        itm.ExtFlag = "D";
                    }
                }
            }

            selectedItems.Remove(itm);
            //arr.Remove(itm.GetDbObject());
        }
Exemple #28
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);
        }
Exemple #29
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;
            }
        }
Exemple #30
0
        public void InitBankAccounts()
        {
            bankAccounts.Clear();

            CTable o = GetDbObject();

            if (o == null)
            {
                return;
            }

            ArrayList arr = o.GetChildArray("ACCOUNT_ITEM");

            if (arr == null)
            {
                return;
            }

            foreach (CTable t in arr)
            {
                MEntityBankAccount v = new MEntityBankAccount(t);
                bankAccounts.Add(v);

                v.Seq = internalSeq;
                internalSeq++;

                v.ExtFlag = "I";
            }
        }