Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         PriceCaculator = new PriceCaculator("1+2+3");
     }
 }
Beispiel #2
0
        public void getFormToPriceCaculator()
        {
            PriceCaculator = new PriceCaculator(txtFormulaExpress.Text.Trim());

            for (int idx = 0; idx < grdVariableOfTax.VisibleRowCount; idx++)
            {
                /*2013-11-24 ERP-1125 Khoa.Truong MOD START*/
                //string TaxTypeName = grdVariableOfTax.GetRowValues(idx, "TaxTypeName").ToString();
                string Code = (string)grdVariableOfTax.GetRowValues(idx, "Code");
                //ASPxButton btn = grdVariableOfTax.FindRowCellTemplateControlByKey(TaxTypeName,
                //    grdVariableOfTax.Columns["TaxTypeName"] as GridViewDataColumn, "btnSelectVariable") as ASPxButton;
                ASPxButton btn = grdVariableOfTax.FindRowCellTemplateControlByKey(Code,
                                                                                  grdVariableOfTax.Columns["Code"] as GridViewDataColumn, "btnSelectVariable") as ASPxButton;
                /*2013-11-24 ERP-1125 Khoa.Truong MOD END*/
                //string placeHolder = "[" + Convert.ToChar(65 + idx) + "]";
                if (txtFormulaExpress.Text.Trim().IndexOf(Code) > -1)
                {
                    //PriceCaculator.ExpressionStr = PriceCaculator.ExpressionStr.Replace(placeHolder, "[" + TaxTypeName + "]");
                    TaxTypeSelection t = new TaxTypeSelection();
                    t.TaxTypeId = Guid.Parse(grdVariableOfTax.GetRowValues(idx, "TaxTypeId").ToString());
                    t.ByValue   = 0;

                    /*2013-11-24 ERP-1125 Khoa.Truong MOD START
                     *  Tam thoi hard code t.ByPercentTage
                     */
                    //t.ByPercentTage = double.Parse(grdVariableOfTax.GetRowValuesByKeyValue(TaxTypeName, "Percentage").ToString());
                    t.ByPercentTage = (double)0;
                    /*2013-11-24 ERP-1125 Khoa.Truong MOD END*/
                    PriceCaculator.Parameters[Code] = t.ByPercentTage;
                    PriceCaculator.TaxTypeSelections.Add(t);
                }
            }

            if (txtFormulaExpress.Text.Trim().IndexOf("[COGS]") > -1)
            {
                PriceCaculator.Parameters["COGS"] = 1;
            }
        }
Beispiel #3
0
        public void settingInit(string expression, List <TaxTypeSelection> list)
        {
            this.PriceCaculator = new PriceCaculator(expression);
            this.PriceCaculator.ExpressionStr     = expression;
            this.PriceCaculator.TaxTypeSelections = list;
            resetForm();

            //expression = expression.Replace("TAXTYPE_VAT_PRODUCT", getCharacterInButtonByTaxCode("TAXTYPE_VAT_PRODUCT"));
            //expression = expression.Replace("TAXTYPE_SPECIAL_PRODUCT", getCharacterInButtonByTaxCode("TAXTYPE_SPECIAL_PRODUCT"));
            //expression = expression.Replace("TAXTYPE_RESOURCE_PRODUCT", getCharacterInButtonByTaxCode("TAXTYPE_RESOURCE_PRODUCT"));
            //expression = expression.Replace("TAXTYPE_VAT_SERVICE", getCharacterInButtonByTaxCode("TAXTYPE_VAT_SERVICE"));
            txtFormulaExpress.Text = expression;

            //for (int idx = 0; idx < grdVariableOfTax.VisibleRowCount; idx++)
            //{
            //    Guid TaxTypeId = Guid.Parse(grdVariableOfTax.GetRowValues(idx, "TaxTypeId").ToString());
            //    /*2013-11-24 ERP-1125 Khoa.Truong MOD START*/
            //    //string TaxTypeName = grdVariableOfTax.GetRowValues(idx, "TaxTypeName").ToString();
            //    string TaxTypeName = (string)grdVariableOfTax.GetRowValues(idx, "Code");
            //    /*2013-11-24 ERP-1125 Khoa.Truong MOD END*/

            //    TaxTypeSelection ptmp = this.PriceCaculator.TaxTypeSelections.Find(p => p.TaxTypeId == TaxTypeId);
            //}
        }