예제 #1
0
        private void BorrarBonificaciones()
        {
            CLS_Acopio boniDel = new CLS_Acopio();

            boniDel.MtdEliminarBonificaciones();
            if (!boniDel.Exito)
            {
                XtraMessageBox.Show(boniDel.Mensaje);
            }
        }
예제 #2
0
        private void CargarPenalizacionCalibres()
        {
            CLS_Acopio selGrupo = new CLS_Acopio();

            selGrupo.MtdSeleccionarPenalizacionCalibres();
            if (selGrupo.Exito)
            {
                dtgPenalizacionCalibres.DataSource = selGrupo.Datos;
            }
        }
예제 #3
0
        private void CargarAcopiadores(int?Valor)
        {
            CLS_Acopio bAcpopiadores = new CLS_Acopio();

            bAcpopiadores.MtdSeleccionarAcopiadores();
            if (bAcpopiadores.Exito)
            {
                CargarCombo(bAcpopiadores.Datos, Valor);
            }
        }
예제 #4
0
        private void CargarPagoCamion()
        {
            CLS_Acopio selCamion = new CLS_Acopio();

            selCamion.MtdSeleccionarPagoCamion();
            if (selCamion.Exito)
            {
                dtgPagoCamion.DataSource = selCamion.Datos;
            }
        }
예제 #5
0
        private void CargarPenalizacionCalidad()
        {
            CLS_Acopio selCamion = new CLS_Acopio();

            selCamion.MtdSeleccionarPenalizacionCalidad();
            if (selCamion.Exito)
            {
                dtgPenalizacionCalidad.DataSource = selCamion.Datos;
            }
        }
예제 #6
0
        private void CargarGrupoPago()
        {
            CLS_Acopio selGrupo = new CLS_Acopio();

            selGrupo.MtdSeleccionarGrupoPago();
            if (selGrupo.Exito)
            {
                dtgGrupoPago.DataSource = selGrupo.Datos;
            }
        }
예제 #7
0
        private void CargarPenalizacionEvaluacionGrupo(string c_codigo_eta)
        {
            CLS_Acopio selGrupo = new CLS_Acopio();

            selGrupo.c_codigo_eta = c_codigo_eta;
            selGrupo.MtdSeleccionarPenalizacionEvaluacionGrupo();
            if (selGrupo.Exito)
            {
                dtgGrupoEvaluacion.DataSource = selGrupo.Datos;
            }
        }
예제 #8
0
        private void ActualizarDatosPenalizacionCamiones()
        {
            CLS_Acopio artprecio = new CLS_Acopio();

            artprecio.c_codigo_camion = "01";
            artprecio.n_camiones_CMP  = Convert.ToInt32(txtCamiones_CMP.Text);
            artprecio.n_camiones_MI   = Convert.ToInt32(txtCamionesMI.Text);
            artprecio.MtdActualizarPenalizacionCamiones();
            if (!artprecio.Exito)
            {
                XtraMessageBox.Show(artprecio.Mensaje);
            }
        }
예제 #9
0
 private void btnConsultar_Click(object sender, EventArgs e)
 {
     hyperlinkLabelControl1.Visible = false;
     if (ValidaDatos())
     {
         ConsultaNoCaturados();
         CLS_Acopio cortesel = new CLS_Acopio();
         if (lkUpAcopiador.EditValue == null)
         {
             Acopiador = string.Empty;
         }
         else
         {
             Acopiador = lkUpAcopiador.Text;
         }
         FechaInicio          = dtInicio.DateTime.Year + DosCeros1(dtInicio.DateTime.Month.ToString()) + DosCeros1(dtInicio.DateTime.Day.ToString());
         FechaFin             = dtFin.DateTime.Year + DosCeros1(dtFin.DateTime.Month.ToString()) + DosCeros1(dtFin.DateTime.Day.ToString());
         cortesel.Acopiador   = Acopiador;
         cortesel.FechaInicio = FechaInicio;
         cortesel.FechaFin    = FechaFin;
         cortesel.MtdSeleccionarCortesAcopiadores();
         if (cortesel.Exito)
         {
             if (cortesel.Datos.Rows.Count > 0)
             {
                 BorrarBonificaciones();
                 ProgressB.Position = 0;
                 Application.DoEvents();
                 InsertarBonificacionVolumen(cortesel.Datos);
                 ProgressB.Position = 30;
                 Application.DoEvents();
                 InsertarBonificacionCalidad(cortesel.Datos);
                 ProgressB.Position = 60;
                 Application.DoEvents();
                 InsertarBonificacionCalibre(cortesel.Datos);
                 ProgressB.Position = 100;
                 Application.DoEvents();
                 MostrarReporte();
             }
             else
             {
                 XtraMessageBox.Show("No existen datos para mostrar");
             }
         }
     }
     else
     {
         XtraMessageBox.Show("Seleccione un Acopiador");
     }
 }
예제 #10
0
        private void CargarPenalizacionCamiones()
        {
            CLS_Acopio selGrupo = new CLS_Acopio();

            selGrupo.c_codigo_camion = "01";
            selGrupo.MtdSeleccionarPenalizacionCamiones();
            if (selGrupo.Exito)
            {
                if (selGrupo.Datos.Rows.Count > 0)
                {
                    txtCamiones_CMP.Text = selGrupo.Datos.Rows[0][1].ToString();
                    txtCamionesMI.Text   = selGrupo.Datos.Rows[0][2].ToString();
                }
            }
        }
예제 #11
0
 private void ActualizarDatosPenalizacionEvaluacionGrupo()
 {
     for (int i = 0; i < dtgValGrupoEvaluacion.RowCount; i++)
     {
         CLS_Acopio artprecio = new CLS_Acopio();
         artprecio.c_codigo_egru       = dtgValGrupoEvaluacion.GetRowCellValue(i, dtgValGrupoEvaluacion.Columns["c_codigo_egru"]).ToString();
         artprecio.v_penalizacion_egru = dtgValGrupoEvaluacion.GetRowCellValue(i, dtgValGrupoEvaluacion.Columns["v_penalizacion_egru"]).ToString();
         artprecio.n_porcentaje        = Convert.ToDecimal(dtgValGrupoEvaluacion.GetRowCellValue(i, dtgValGrupoEvaluacion.Columns["n_porcentaje"]).ToString());
         artprecio.MtdActualizarPenalizacionEvaluacionGrupo();
         if (!artprecio.Exito)
         {
             XtraMessageBox.Show(artprecio.Mensaje);
         }
     }
 }
예제 #12
0
 private void ActualizarDatosPagoCamion()
 {
     for (int i = 0; i < dtgValPagoCamion.RowCount; i++)
     {
         CLS_Acopio artprecio = new CLS_Acopio();
         artprecio.c_pago_camion     = dtgValPagoCamion.GetRowCellValue(i, dtgValPagoCamion.Columns["c_pago_camion"]).ToString();
         artprecio.v_tipo_camion     = dtgValPagoCamion.GetRowCellValue(i, dtgValPagoCamion.Columns["v_tipo_camion"]).ToString();
         artprecio.n_porcentaje_pago = Convert.ToDecimal(dtgValPagoCamion.GetRowCellValue(i, dtgValPagoCamion.Columns["n_porcentaje_pago"]).ToString());
         artprecio.n_monto_pago      = Convert.ToDecimal(dtgValPagoCamion.GetRowCellValue(i, dtgValPagoCamion.Columns["n_monto_pago"]).ToString());
         artprecio.MtdActualizarPagoCamion();
         if (!artprecio.Exito)
         {
             XtraMessageBox.Show(artprecio.Mensaje);
         }
     }
 }
예제 #13
0
        private void ActualizarDatosGruposPagos()
        {
            int x = 1;

            for (int i = 0; i < dtgValGrupoPago.RowCount; i++)
            {
                CLS_Acopio artprecio = new CLS_Acopio();
                artprecio.c_codigo_gru = dtgValGrupoPago.GetRowCellValue(i, dtgValGrupoPago.Columns["c_codigo_gru"]).ToString();
                artprecio.v_grupopago  = dtgValGrupoPago.GetRowCellValue(i, dtgValGrupoPago.Columns["v_grupopago"]).ToString();
                artprecio.n_porcentaje = Convert.ToDecimal(dtgValGrupoPago.GetRowCellValue(i, dtgValGrupoPago.Columns["n_porcentaje"]).ToString());
                artprecio.MtdActualizarGrupoPago();
                if (!artprecio.Exito)
                {
                    XtraMessageBox.Show(artprecio.Mensaje);
                }
            }
        }
예제 #14
0
        private void ActualizarDatosPenalizacionCalibres()
        {
            int x = 1;

            for (int i = 0; i < dtgValPenalizacionCalibres.RowCount; i++)
            {
                CLS_Acopio artprecio = new CLS_Acopio();
                artprecio.c_codigo_pcali       = dtgValPenalizacionCalibres.GetRowCellValue(i, dtgValPenalizacionCalibres.Columns["c_codigo_pcali"]).ToString();
                artprecio.v_penalizacion_pcali = dtgValPenalizacionCalibres.GetRowCellValue(i, dtgValPenalizacionCalibres.Columns["v_penalizacion_pcali"]).ToString();
                artprecio.n_porcentaje         = Convert.ToDecimal(dtgValPenalizacionCalibres.GetRowCellValue(i, dtgValPenalizacionCalibres.Columns["n_porcentaje"]).ToString());
                artprecio.MtdActualizarPenalizacionCalibres();
                if (!artprecio.Exito)
                {
                    XtraMessageBox.Show(artprecio.Mensaje);
                }
            }
        }
예제 #15
0
        private void ConsultaNoCaturados()
        {
            CLS_Acopio corteseln = new CLS_Acopio();

            FechaInicio           = dtInicio.DateTime.Year + DosCeros1(dtInicio.DateTime.Month.ToString()) + DosCeros1(dtInicio.DateTime.Day.ToString());
            FechaFin              = dtFin.DateTime.Year + DosCeros1(dtFin.DateTime.Month.ToString()) + DosCeros1(dtFin.DateTime.Day.ToString());
            corteseln.FechaInicio = FechaInicio;
            corteseln.FechaFin    = FechaFin;
            corteseln.MtdSeleccionarCapturasPendientes();
            if (corteseln.Exito)
            {
                if (corteseln.Datos.Rows.Count > 0)
                {
                    hyperlinkLabelControl1.Visible = true;
                }
            }
        }
예제 #16
0
        private decimal PorcentajeGrupo(string v)
        {
            decimal    Valor    = 0;
            CLS_Acopio selGrupo = new CLS_Acopio();

            selGrupo.c_codigo_gru = v.ToString();
            selGrupo.MtdSeleccionarGrupoPagoBono();
            if (selGrupo.Exito)
            {
                if (selGrupo.Datos.Rows.Count > 0)
                {
                    Valor = Convert.ToDecimal(selGrupo.Datos.Rows[0]["n_porcentaje"].ToString());
                }
                else
                {
                    XtraMessageBox.Show("No se encontraron Registro para este Grupo");
                }
            }
            else
            {
                XtraMessageBox.Show(selGrupo.Mensaje);
            }
            return(Valor);
        }
예제 #17
0
        private decimal MontoCompletoCamion(decimal v)
        {
            decimal    Valor        = 0;
            CLS_Acopio selMCompleto = new CLS_Acopio();

            selMCompleto.v_tipo_camion = v.ToString();
            selMCompleto.MtdSeleccionarPagoCamionBono();
            if (selMCompleto.Exito)
            {
                if (selMCompleto.Datos.Rows.Count > 0)
                {
                    Valor = Convert.ToDecimal(selMCompleto.Datos.Rows[0]["n_monto_pago"].ToString());
                }
                else
                {
                    Valor = 0;
                }
            }
            else
            {
                XtraMessageBox.Show(selMCompleto.Mensaje);
            }
            return(Valor);
        }
예제 #18
0
        private void InsertarBonificacionCalibre(DataTable datos)
        {
            string  vOrdenCorte          = string.Empty;
            string  vAcopiador           = string.Empty;
            string  vv_nombre_hue        = string.Empty;
            decimal vn_cajas_estimadas   = 0;
            decimal vn_cajas_recibidas   = 0;
            decimal vn_porcentaje        = 0;
            decimal vn_porcentajeVolumen = 0;
            decimal vn_bono_completo     = 0;
            decimal vn_importe           = 0;

            decimal vn_32_est = 0;
            decimal vn_36_est = 0;
            decimal vn_40_est = 0;
            decimal vn_48_est = 0;
            decimal vn_60_est = 0;
            decimal vn_70_est = 0;
            decimal vn_84_est = 0;
            decimal vn_96_est = 0;

            decimal vn_32_pro = 0;
            decimal vn_36_pro = 0;
            decimal vn_40_pro = 0;
            decimal vn_48_pro = 0;
            decimal vn_60_pro = 0;
            decimal vn_70_pro = 0;
            decimal vn_84_pro = 0;
            decimal vn_96_pro = 0;

            decimal vn_porcentaje32 = 0;
            decimal vn_porcentaje36 = 0;
            decimal vn_porcentaje40 = 0;
            decimal vn_porcentaje48 = 0;
            decimal vn_porcentaje60 = 0;
            decimal vn_porcentaje70 = 0;
            decimal vn_porcentaje84 = 0;
            decimal vn_porcentaje96 = 0;
            string  vTipoCorte      = string.Empty;

            decimal vn_porcentajeGrupo = 0;

            for (int i = 0; i < datos.Rows.Count; i++)
            {
                vOrdenCorte        = datos.Rows[i]["OrderCorte"].ToString();
                vAcopiador         = datos.Rows[i]["Acopiador"].ToString();
                vv_nombre_hue      = datos.Rows[i]["Huerta"].ToString();
                vn_cajas_estimadas = Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString());
                vn_cajas_recibidas = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString());

                vn_32_est = Convert.ToDecimal(datos.Rows[i]["Est32"].ToString());
                vn_36_est = Convert.ToDecimal(datos.Rows[i]["Est36"].ToString());
                vn_40_est = Convert.ToDecimal(datos.Rows[i]["Est40"].ToString());
                vn_48_est = Convert.ToDecimal(datos.Rows[i]["Est48"].ToString());
                vn_60_est = Convert.ToDecimal(datos.Rows[i]["Est60"].ToString());
                vn_70_est = Convert.ToDecimal(datos.Rows[i]["Est70"].ToString());
                vn_84_est = Convert.ToDecimal(datos.Rows[i]["Est84"].ToString());
                vn_96_est = Convert.ToDecimal(datos.Rows[i]["Est96"].ToString());

                vn_32_pro = Convert.ToDecimal(datos.Rows[i]["Pro32"].ToString());
                vn_36_pro = Convert.ToDecimal(datos.Rows[i]["Pro36"].ToString());
                vn_40_pro = Convert.ToDecimal(datos.Rows[i]["Pro40"].ToString());
                vn_48_pro = Convert.ToDecimal(datos.Rows[i]["Pro48"].ToString());
                vn_60_pro = Convert.ToDecimal(datos.Rows[i]["Pro60"].ToString());
                vn_70_pro = Convert.ToDecimal(datos.Rows[i]["Pro70"].ToString());
                vn_84_pro = Convert.ToDecimal(datos.Rows[i]["Pro84"].ToString());
                vn_96_pro = Convert.ToDecimal(datos.Rows[i]["Pro96"].ToString());

                vTipoCorte         = datos.Rows[i]["Tipocorte"].ToString();
                vn_porcentajeGrupo = PorcentajeGrupo("03");
                if (Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()) > 0)
                {
                    vn_porcentajeVolumen = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString()) / Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()) * 100;

                    if (Convert.ToDecimal(datos.Rows[i]["Est32"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro32"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est32"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est32"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje32 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro32"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est32"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est32"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje32 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje32 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est36"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro36"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est36"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est36"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje36 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro36"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est36"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est36"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje36 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje36 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est40"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro40"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est40"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est40"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje40 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro40"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est40"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est40"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje40 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje40 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est48"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro48"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est48"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est48"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje48 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro48"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est48"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est48"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje48 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje48 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est60"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro60"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est60"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est60"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje60 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro60"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est60"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est60"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje60 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje60 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est70"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro70"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est70"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est70"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje70 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro70"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est70"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est70"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje70 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje70 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est84"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro84"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est84"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est84"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje84 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro84"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est84"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est84"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje84 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje84 = 0;
                    }

                    if (Convert.ToDecimal(datos.Rows[i]["Est96"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["Pro96"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est96"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est96"].ToString()) / 100) > 0)
                        {
                            vn_porcentaje96 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["Pro96"].ToString()) / Convert.ToDecimal(datos.Rows[i]["Est96"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["Est96"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentaje96 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentaje96 = 0;
                    }

                    vn_porcentaje = vn_porcentaje32 + vn_porcentaje36 + vn_porcentaje40 + vn_porcentaje48 + vn_porcentaje60 + vn_porcentaje70 + vn_porcentaje84 + vn_porcentaje96;

                    if (vn_porcentaje <= 20)
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));

                        vn_importe = (vn_bono_completo * vn_porcentajeGrupo) * (100 - (vn_porcentaje * 4)) / 100;
                    }
                    else
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = 0;
                    }

                    if ((vn_porcentajeVolumen) < 50)
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = 0;
                    }
                }
                else
                {
                    vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                    vn_importe       = 0;
                }
                try
                {
                    CLS_Acopio selporc = new CLS_Acopio();
                    selporc.MtdSeleccionarPenalizacionCalibres();
                    if (selporc.Exito)
                    {
                        for (int x = 0; x < selporc.Datos.Rows.Count; x++)
                        {
                            if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "32" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro32"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "36" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro36"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "40" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro40"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "48" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro48"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "60" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro60"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "70" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro70"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "84" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro84"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcali"].ToString() == "96" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["Pro96"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                        }
                    }
                    CLS_Acopio insCalibre = new CLS_Acopio();
                    insCalibre.OrdenCorte          = vOrdenCorte;
                    insCalibre.Acopiador           = vAcopiador;
                    insCalibre.v_nombre_hue        = vv_nombre_hue;
                    insCalibre.n_cajas_estimadas   = vn_cajas_estimadas;
                    insCalibre.n_32_est            = vn_32_est;
                    insCalibre.n_36_est            = vn_36_est;
                    insCalibre.n_40_est            = vn_40_est;
                    insCalibre.n_48_est            = vn_48_est;
                    insCalibre.n_60_est            = vn_60_est;
                    insCalibre.n_70_est            = vn_70_est;
                    insCalibre.n_84_est            = vn_84_est;
                    insCalibre.n_96_est            = vn_96_est;
                    insCalibre.n_32_pro            = vn_32_pro;
                    insCalibre.n_36_pro            = vn_36_pro;
                    insCalibre.n_40_pro            = vn_40_pro;
                    insCalibre.n_48_pro            = vn_48_pro;
                    insCalibre.n_60_pro            = vn_60_pro;
                    insCalibre.n_70_pro            = vn_70_pro;
                    insCalibre.n_84_pro            = vn_84_pro;
                    insCalibre.n_96_pro            = vn_96_pro;
                    insCalibre.n_porcentaje        = vn_porcentaje;
                    insCalibre.n_porcentajeVolumen = vn_porcentajeVolumen;
                    insCalibre.n_bono_completo     = vn_bono_completo * vn_porcentajeGrupo;
                    insCalibre.n_importe           = vn_importe;
                    insCalibre.v_tipocorte         = vTipoCorte;
                    DateTime vFechaCorte = Convert.ToDateTime(datos.Rows[i]["FechaCorte"].ToString());
                    FechaInicio = vFechaCorte.Year + DosCeros1(vFechaCorte.Month.ToString()) + DosCeros1(vFechaCorte.Day.ToString());
                    insCalibre.d_fecha_OrdenCorte = FechaInicio;
                    insCalibre.MtdInsertarBonificacionCalibre();
                    if (!insCalibre.Exito)
                    {
                        XtraMessageBox.Show(insCalibre.Mensaje);
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }
            }
        }
예제 #19
0
        private void InsertarBonificacionVolumen(DataTable datos)
        {
            string  vOrdenCorte        = string.Empty;
            string  vAcopiador         = string.Empty;
            string  vv_nombre_hue      = string.Empty;
            decimal vn_cajas_estimadas = 0;
            decimal vn_cajas_recibidas = 0;
            decimal vn_porcentaje      = 0;
            decimal vn_bono_completo   = 0;
            decimal vn_importe         = 0;
            decimal vn_porcentajeGrupo = 0;

            for (int i = 0; i < datos.Rows.Count; i++)
            {
                vOrdenCorte        = datos.Rows[i]["OrderCorte"].ToString();
                vAcopiador         = datos.Rows[i]["Acopiador"].ToString();
                vv_nombre_hue      = datos.Rows[i]["Huerta"].ToString();
                vn_cajas_estimadas = Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString());
                vn_cajas_recibidas = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString());
                vn_porcentajeGrupo = PorcentajeGrupo("01");
                if (Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()) > 0)
                {
                    vn_porcentaje = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString()) / Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString());
                    if ((vn_porcentaje * 100) >= 50)
                    {
                        if (vn_porcentaje > 1)
                        {
                            vn_porcentaje = 1;
                        }

                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = (vn_bono_completo * vn_porcentajeGrupo) * vn_porcentaje;
                    }
                    else
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = 0;
                    }
                }
                else
                {
                    vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                    vn_importe       = 0;
                }
                try
                {
                    CLS_Acopio insDatos = new CLS_Acopio();
                    insDatos.OrdenCorte        = vOrdenCorte;
                    insDatos.Acopiador         = vAcopiador;
                    insDatos.v_nombre_hue      = vv_nombre_hue;
                    insDatos.n_cajas_estimadas = vn_cajas_estimadas;
                    insDatos.n_cajas_recibidas = vn_cajas_recibidas;
                    insDatos.n_porcentaje      = vn_porcentaje;
                    insDatos.n_bono_completo   = vn_bono_completo * vn_porcentajeGrupo;
                    insDatos.n_importe         = vn_importe;
                    DateTime vFechaCorte = Convert.ToDateTime(datos.Rows[i]["FechaCorte"].ToString());
                    FechaInicio = vFechaCorte.Year + DosCeros1(vFechaCorte.Month.ToString()) + DosCeros1(vFechaCorte.Day.ToString());
                    insDatos.d_fecha_OrdenCorte = FechaInicio;
                    insDatos.MtdInsertarBonificacionVolumen();
                    if (!insDatos.Exito)
                    {
                        XtraMessageBox.Show(insDatos.Mensaje);
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }
            }
        }
예제 #20
0
        private void InsertarBonificacionCalidad(DataTable datos)
        {
            string  vOrdenCorte          = string.Empty;
            string  vAcopiador           = string.Empty;
            string  vv_nombre_hue        = string.Empty;
            decimal vn_cajas_estimadas   = 0;
            decimal vn_cajas_recibidas   = 0;
            decimal vn_porcentaje        = 0;
            decimal vn_porcentajeVolumen = 0;
            decimal vn_bono_completo     = 0;
            decimal vn_importe           = 0;
            decimal vn_cat1_est          = 0;
            decimal vn_cat2_est          = 0;
            decimal vn_Nac_est           = 0;
            decimal vn_cat1_pro          = 0;
            decimal vn_cat2_pro          = 0;
            decimal vn_Nac_pro           = 0;
            decimal vn_porcentajeCat1    = 0;
            decimal vn_porcentajeCat2    = 0;
            decimal vn_porcentajeNal     = 0;
            decimal vn_porcentajeGrupo   = 0;
            string  vTipoCorte           = string.Empty;

            for (int i = 0; i < datos.Rows.Count; i++)
            {
                vOrdenCorte        = datos.Rows[i]["OrderCorte"].ToString();
                vAcopiador         = datos.Rows[i]["Acopiador"].ToString();
                vv_nombre_hue      = datos.Rows[i]["Huerta"].ToString();
                vn_cajas_estimadas = Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString());
                vn_cajas_recibidas = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString());
                vn_cat1_est        = Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString());
                vn_cat2_est        = Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString());
                vn_Nac_est         = Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString());
                vn_cat1_pro        = Convert.ToDecimal(datos.Rows[i]["ProCat1"].ToString());
                vn_cat2_pro        = Convert.ToDecimal(datos.Rows[i]["ProCat2"].ToString());
                vn_Nac_pro         = Convert.ToDecimal(datos.Rows[i]["ProNal"].ToString());
                vTipoCorte         = datos.Rows[i]["Tipocorte"].ToString();
                vn_porcentajeGrupo = PorcentajeGrupo("02");
                if (Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()) > 0)
                {
                    vn_porcentajeVolumen = Convert.ToDecimal(datos.Rows[i]["RecibCajas"].ToString()) / Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()) * 100;

                    if (Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["ProCat1"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString()) / 100) > 0)
                        {
                            vn_porcentajeCat1 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["ProCat1"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstCat1"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentajeCat1 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentajeCat1 = 0;
                    }
                    if (Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["ProCat2"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString()) / 100) > 0)
                        {
                            vn_porcentajeCat2 = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["ProCat2"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstCat2"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentajeCat2 = 0;
                        }
                    }
                    else
                    {
                        vn_porcentajeCat2 = 0;
                    }
                    if (Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString()) > 0)
                    {
                        if ((100 - (((Convert.ToDecimal(datos.Rows[i]["ProNal"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString()) / 100) > 0)
                        {
                            vn_porcentajeNal = Math.Abs(100 - (((Convert.ToDecimal(datos.Rows[i]["ProNal"].ToString()) / Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString())) * 100))) * (Convert.ToDecimal(datos.Rows[i]["EstNal"].ToString()) / 100);
                        }
                        else
                        {
                            vn_porcentajeNal = 0;
                        }
                    }
                    else
                    {
                        vn_porcentajeNal = 0;
                    }
                    vn_porcentaje = vn_porcentajeCat1 + vn_porcentajeCat2 + vn_porcentajeNal;

                    if (vn_porcentaje <= 10)
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = (vn_bono_completo * vn_porcentajeGrupo) * (100 - (vn_porcentaje * 5)) / 100;
                    }
                    else
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = 0;
                    }
                    if ((vn_porcentajeVolumen) < 50)
                    {
                        vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                        vn_importe       = 0;
                    }
                }
                else
                {
                    vn_bono_completo = MontoCompletoCamion(Convert.ToDecimal(datos.Rows[i]["n_cajas_pcd"].ToString()));
                    vn_importe       = 0;
                }
                try
                {
                    CLS_Acopio selporc = new CLS_Acopio();
                    selporc.MtdSeleccionarPenalizacionCalidad();
                    if (selporc.Exito)
                    {
                        for (int x = 0; x < selporc.Datos.Rows.Count; x++)
                        {
                            if (selporc.Datos.Rows[x]["v_penalizacion_pcal"].ToString() == "Cat1" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["ProCat1"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcal"].ToString() == "Cat2" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["ProCat2"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                            else if (selporc.Datos.Rows[x]["v_penalizacion_pcal"].ToString() == "Nacional" && Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) > 0)
                            {
                                if (Convert.ToDecimal(selporc.Datos.Rows[x]["n_porcentaje"].ToString()) * 100 <= Convert.ToDecimal(datos.Rows[i]["ProNal"].ToString()))
                                {
                                    vn_importe = 0;
                                }
                            }
                        }
                    }
                    CLS_Acopio insCalibre = new CLS_Acopio();
                    insCalibre.OrdenCorte          = vOrdenCorte;
                    insCalibre.Acopiador           = vAcopiador;
                    insCalibre.v_nombre_hue        = vv_nombre_hue;
                    insCalibre.n_cajas_estimadas   = vn_cajas_estimadas;
                    insCalibre.n_cat1_est          = vn_cat1_est;
                    insCalibre.n_cat2_est          = vn_cat2_est;
                    insCalibre.n_Nac_est           = vn_Nac_est;
                    insCalibre.n_cat1_pro          = vn_cat1_pro;
                    insCalibre.n_cat2_pro          = vn_cat2_pro;
                    insCalibre.n_Nac_pro           = vn_Nac_pro;
                    insCalibre.n_porcentaje        = vn_porcentaje;
                    insCalibre.n_porcentajeVolumen = vn_porcentajeVolumen;
                    insCalibre.n_bono_completo     = vn_bono_completo * vn_porcentajeGrupo;
                    insCalibre.n_importe           = vn_importe;
                    insCalibre.v_tipocorte         = vTipoCorte;
                    DateTime vFechaCorte = Convert.ToDateTime(datos.Rows[i]["FechaCorte"].ToString());
                    FechaInicio = vFechaCorte.Year + DosCeros1(vFechaCorte.Month.ToString()) + DosCeros1(vFechaCorte.Day.ToString());
                    insCalibre.d_fecha_OrdenCorte = FechaInicio;

                    insCalibre.MtdInsertarBonificacionCalidad();
                    if (!insCalibre.Exito)
                    {
                        XtraMessageBox.Show(insCalibre.Mensaje);
                    }
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }
            }
        }