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);
        }
        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 cmdReload_Click(object sender, RoutedEventArgs e)
        {
            Client.Model.MCompanyPackage mpk = new Client.Model.MCompanyPackage(companyPackage.GetDbObject());
            mpk.InitChildItems();

            CUtil.EnableForm(false, this);
            CPriceProcessor.ReloadStandardPackages(mpk);
            CUtil.EnableForm(true, this);
        }
        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;
        }
Exemple #5
0
        private void mnuPackageView_Click(object sender, RoutedEventArgs e)
        {
            MPackage p = new MPackage(new CTable("PACKAGE"));

            p.CopyPackageInfo(currentViewObj);

            WinAddEditPackage c = new WinAddEditPackage(p.PackageGroup, "E");

            c.ViewData = p;
            c.Title    = CLanguage.getValue("edit") + " " + CUtil.PackageTypeToString(p.PackageType);
            c.ShowDialog();

            if (c.IsOK)
            {
                //Will be reloade later
                MPackage mp = new MPackage(p.GetDbObject());
                CPriceProcessor.UnloadPackage(mp);
            }
        }