Exemple #1
0
        private void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            LB1.Focus();

            MWDataManager.clsDataAccess _dbManSaveBudget = new MWDataManager.clsDataAccess();
            _dbManSaveBudget.ConnectionString = _theConnection;
            _dbManSaveBudget.SqlStatement     = "";

            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  BEGIN TRY insert into  [tbl_BookingsDailyProblemsPump] values ( '" + DateLbl.Text + "', \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + " '" + SectionLbl.Text + "', \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  '" + ExtractBeforeColon(ProbLbl.Text) + "', \r\n ";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + " '" + StartTime.EditValue.ToString() + "', '" + EndTime.EditValue.ToString() + "', '" + CommentsTxt.Text + "') END TRY \r\n ";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  \r\n";

            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  BEGIN CATCH update [tbl_BookingsDailyProblemsPump] set \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  ProbID = '" + ExtractBeforeColon(ProbLbl.Text) + "', \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  StartTime = '" + StartTime.EditValue.ToString() + "', \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  EndTime = '" + EndTime.EditValue.ToString() + "', \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + "  Comments = '" + CommentsTxt.Text + "' \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + " where Calendardate = '" + DateLbl.Text + "' \r\n ";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + " and Section = '" + SectionLbl.Text + "'   \r\n";
            _dbManSaveBudget.SqlStatement = _dbManSaveBudget.SqlStatement + " END CATCH\r\n";

            _dbManSaveBudget.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement;
            _dbManSaveBudget.queryReturnType    = MWDataManager.ReturnType.DataTable;
            _dbManSaveBudget.ExecuteInstruction();

            //toastNotificationsManager1.ShowNotification(toastNotificationsManager1.Notifications[0]);

            this.Close();
        }
Exemple #2
0
        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");
        }