Ejemplo n.º 1
0
        private void CalculateCompanyPackage()
        {
            CPriceProcessor.SetGetCompanyPackageAllCallback(OnixWebServiceAPI.GetCompanyPackageAll);

            CUtil.EnableForm(false, this);
            CPriceProcessor.LoadStandardPackages(companyPackage);
            CUtil.EnableForm(true, this);

            CBasketSet bks = CPriceProcessor.CreateInitialBasketSet(billSim.SelectedItems);

            CUtil.EnableForm(false, this);
            Boolean tmp = billSim.IsModified;

            CBasketSet output = CPriceProcessor.PromotionProcessing(companyPackage, bks, billSim);

            CPriceProcessor.CreateDisplayProcessingTreeView(billSim);
            CPriceProcessor.CreateDisplayView(output, billSim, null);
            billSim.NotifyAllPropertiesChanged();


            //CUtil.LoadMasterRefCombo(cboBranch, true, MasterRefEnum.MASTER_BRANCH, billSim.BranchId);
            billSim.IsModified = tmp;

            CUtil.EnableForm(true, this);

            TabMain.SelectedIndex = 2;
        }
        private void processPromotion(MAccountDoc doc)
        {
            MBillSimulate billSim = doc.BillSimulate;

            priceHash.Clear();

            CPriceProcessor.SetGetCompanyPackageAllCallback(OnixWebServiceAPI.GetCompanyPackageAll);

            CUtil.EnableForm(false, this);
            CPriceProcessor.LoadStandardPackages(companyPackage);
            CUtil.EnableForm(true, this);

            CBasketSet bks = CPriceProcessor.CreateInitialBasketSet(billSim.SelectedItems);

            CUtil.EnableForm(false, this);
            Boolean tmp = billSim.IsModified;

            CBasketSet output = CPriceProcessor.PromotionProcessing(companyPackage, bks, billSim);

            CPriceProcessor.CreateDisplayProcessingTreeView(billSim);
            CPriceProcessor.CreateDisplayView(output, billSim, updateDisplayItem);

            doc.PromotionAmount        = billSim.TotalAmount;
            doc.PromotionFinalDiscount = billSim.DiscountAmount;
            doc.PromotionTotalAmt      = billSim.NetAmount;
            doc.FreeItemCount          = billSim.FreeItemCount.ToString();
            doc.VoucherItemCount       = billSim.VoucherItemCount.ToString();
            doc.PostFreeItemCount      = billSim.PostFreeItemCount.ToString();
            updateDocumentItemPrice(doc);
            doc.NotifyPromotionCalulation();

            doc.FinalDiscount = billSim.DiscountAmount;

            CUtil.EnableForm(true, this);
        }
Ejemplo n.º 3
0
        private void CalculateCompanyCommissionProfile()
        {
            CPriceProcessor.SetGetCompanyPackageAllCallback(OnixWebServiceAPI.GetCompanyPackageAll);

            CUtil.EnableForm(false, this);
            CTable t = new CTable("COMPANY_PACKAGE");

            companyPackage           = new MCompanyPackage(t);
            companyPackage.CompanyID = "1";
            CTable m = OnixWebServiceAPI.GetCompanyPackageInfo(companyPackage.GetDbObject());

            if (m != null)
            {
                companyPackage.SetDbObject(m);
                companyPackage.InitChildItems();
                companyPackage.NotifyAllPropertiesChanged();
            }
            CPriceProcessor.LoadStandardPackages(companyPackage);
            CUtil.EnableForm(true, this);

            CBasketSet bks = CPriceProcessor.CreateInitialBasketSet(billSim.SelectedItems);

            CUtil.EnableForm(false, this);
            Boolean tmp = billSim.IsModified;

            CBasketSet output = CPriceProcessor.PromotionProcessing(companyPackage, bks, billSim);

            CPriceProcessor.CreateDisplayProcessingTreeView(billSim);

            CPriceProcessor.CreateDisplayView(output, billSim, null);
            billSim.NotifyAllPropertiesChanged();

            ArrayList arrBill       = ConvertResultItems(billSim.ResultItems);
            ArrayList arrCommission = companyCommission.GetDbObject().GetChildArray("COMPANY_COMM_PROFILE_ITEM");

            CTable oCal = new CTable("");

            oCal.AddChildArray("BILL_LIST", arrBill);
            oCal.AddChildArray("COMMISSION_LIST", arrCommission);
            ArrayList CalComm = OnixWebServiceAPI.CalculateBillCommission(oCal);

            billSim.InitCommissionItems(CalComm);

            //CUtil.LoadMasterRefCombo(cboBranch, true, MasterRefEnum.MASTER_BRANCH, billSim.BranchId);
            billSim.IsModified = tmp;

            CUtil.EnableForm(true, this);

            TabMain.SelectedIndex = 3;
        }