private void calcularCustos(Regra regra) { Double txComissao = 0, alq1, alq2, custo, Vd1, Vd2, Frete, federal1, federal2, ICMSD1, ICMSD2, ICMSC, alICMSC, IPI, LB1, LB2, LL1, LL2, TXFixa1, TXFixa2, comissao1, comissao2; custo = Convert.ToDouble(txtCusto.Text.ToString()); alq1 = Convert.ToDouble(txtaliq1.Text.ToString()); Vd1 = Convert.ToDouble(txtvalor1.Text.ToString()); //Fazendo o valor 2 em relação ao desconto. Vd2 = (Convert.ToDouble(txtvalor1.Text.ToString()) - ((Convert.ToDouble(txtDesconto.Text.ToString()) / 100) * Convert.ToDouble(txtvalor1.Text.ToString()))); alq2 = (((Vd2 - custo) * 100) / custo); txtvalor2.Text = Vd2.ToString("N"); txtaliq2.Text = alq2.ToString("N"); Frete = Convert.ToDouble(txtCusto.Text.ToString()) * ((Convert.ToDouble(txtFrete.Text.ToString())) / 100); federal1 = Vd1 * (regra.getFederal() / 100); federal2 = Vd2 * (regra.getFederal() / 100); alICMSC = Convert.ToDouble(txtIcms.Text.ToString()); IPI = custo * (Convert.ToDouble(txtIPI.Text.ToString()) / 100); LB1 = custo * (alq1 / 100); LB2 = custo * (alq2 / 100); TXFixa1 = Vd1 * (regra.getTaxaDespesasFixas() / 100); TXFixa2 = Vd2 * (regra.getTaxaDespesasFixas() / 100); ICMSC = custo * ((18 - alICMSC) / 100); // Mudar quando não usar mais aliquotas negativas para ICMSC //Deve-se prepara a regra para Normal e SuperSimples, neste caso só apresentarei o superSimples ICMSD1 = 0; ICMSD2 = 0; txComissao = (txtComissao.Text.Equals("")) ? 0 : (Convert.ToDouble(txtComissao.Text) / 100); comissao1 = txComissao * Vd1; comissao2 = txComissao * Vd2; LL1 = Vd1 - (custo + Frete + federal1 + IPI + ICMSC + ICMSD1 + TXFixa1 + comissao1); LL2 = Vd2 - (custo + Frete + federal2 + IPI + ICMSC + ICMSD2 + TXFixa2 + comissao2); Labfrete1.Text = Frete.ToString("N"); Labfrete2.Text = Frete.ToString("N"); LabICMS0.Text = (ICMSC + ICMSD1).ToString("N"); LabICMS1.Text = (ICMSC + ICMSD2).ToString("N"); LabFederal1.Text = federal1.ToString("N"); LabFederal2.Text = federal2.ToString("N"); LabIPI1.Text = IPI.ToString("N"); LabIPI2.Text = IPI.ToString("N"); LabLB1.Text = LB1.ToString("N"); LabLB2.Text = LB2.ToString("N"); LabFixa1.Text = TXFixa1.ToString("N"); LabFixa2.Text = TXFixa2.ToString("N"); LabLL1.Text = (LL1 < 0)? "<font color ='red'>" + LL1.ToString("N") + "</font>" : LL1.ToString("N"); LabLL2.Text = (LL2 < 0) ? "<font color ='red'>" + LL2.ToString("N") + "</font>" : LL2.ToString("N"); labComissao1.Text = comissao1.ToString("N"); labComissao2.Text = comissao2.ToString("N"); }
private void OpenFile_Click(object sender, EventArgs e) { OpenFileDialog fileName = new OpenFileDialog(); fileName.InitialDirectory = Application.StartupPath; fileName.Filter = "txt files (*.txt)|*.txt"; fileName.FilterIndex = 1; fileName.RestoreDirectory = true; if (fileName.ShowDialog() == DialogResult.OK) { string path = fileName.FileName.ToString(); //string Name = path.Substring(path.LastIndexOf) backEnd = new LL1(path); Dictionary <string, List <string> > rule = backEnd.GetRuleSet(); RuleDisplay.Clear(); if (rule == null) { MessageBox.Show("LL1运行失败,输入的规则式有问题"); } else { foreach (string key in rule.Keys) { foreach (string showRule in rule[key]) { RuleDisplay.AppendText(key + "->" + showRule + "\r\n"); } } MessageBox.Show("输入的规则式合法"); backEnd.SolveFirstSet(); backEnd.SolveFollowSet(); isSyntaxValid = backEnd.BuildTable(); GetFirstAndFollow.Enabled = true; } } }
static Merge(LL1, LL2) { }