Beispiel #1
0
 public void DA_Registrar_PLANILLA(VT_Planilla p)
 {
     try
     {
         using (SqlConnection conexion = new SqlConnection(conexionString))
         {
             SqlCommand cmd = new SqlCommand("VT_PLANILLA_INSERT", conexion);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@Id_Solicitud", p.Id_Solicitud);
             cmd.Parameters.AddWithValue("@Tot_Num_Dias", p.Tot_Num_Dias);
             cmd.Parameters.AddWithValue("@Tot_Num_Dias15", p.Tot_Num_Dias15);
             cmd.Parameters.AddWithValue("@Pago_Total", p.Pago_Total);
             cmd.Parameters.AddWithValue("@Rc_Iva", p.Rc_Iva);
             cmd.Parameters.AddWithValue("@Liquido_Pagable", p.Liquido_Pagable);
             cmd.Parameters.AddWithValue("@Num_Cheque", p.Num_Cheque);
             cmd.Parameters.AddWithValue("@Tasa_Cambio", p.Tasa_Cambio);
             cmd.Parameters.AddWithValue("@Fecha", p.Fecha);
             cmd.Parameters.AddWithValue("@Fecha_Atendido", p.Fecha_Atendido);
             cmd.Parameters.AddWithValue("@MontoPorDia", p.MontoPorDia);
             conexion.Open();
             cmd.ExecuteNonQuery();
             conexion.Close();
         }
     }
     catch (Exception err)
     {
         throw (new Exception(err.ToString() + "-" + err.Source.ToString() + "-" + err.Message.ToString()));
     }
 }
Beispiel #2
0
 protected void BtnAceptar_Click(object sender, EventArgs e)
 {
     if (LblEstado.Text == "INF-APROBADO" || LblEstado.Text == "APROBADO")
     {
         DB_VT_Planilla ip = new DB_VT_Planilla();
         VT_Planilla    p  = new VT_Planilla();
         VT_PlanillaDia pd = new VT_PlanillaDia();
         p = ip.DB_Seleccionar_PLANILLA(LblIdSolicitud.Text);
         int idplanilla = p.Id_Planilla;
         p.Id_Solicitud    = LblIdSolicitud.Text;
         p.Tot_Num_Dias    = Convert.ToDecimal(LblDiasCom.Text);
         p.Tot_Num_Dias15  = Convert.ToDecimal(LblDiasCom15.Text);
         p.Pago_Total      = Convert.ToDecimal(LblTotalMonto.Text);
         p.Pago_Total15    = Convert.ToDecimal(LblTotalMonto15.Text);
         p.Liquido_Pagable = Convert.ToDecimal(LblTotalPago.Text);
         p.Num_Cheque      = TxtNumCheque.Text;
         p.Fecha_Atendido  = DateTime.Now;
         p.MontoPorDia     = Convert.ToDecimal(Lbl100.Text);
         ip.DB_Modificar_PLANILLA(p);
         int contador = 1;
         foreach (GridViewRow dgi in GVDetallePlanilla.Rows)
         {
             TextBox      tx  = (TextBox)dgi.Cells[5].Controls[1];
             TextBox      tx1 = (TextBox)dgi.Cells[7].Controls[1];
             DropDownList ddl = (DropDownList)dgi.Cells[3].Controls[1];
             pd.Id_Planilla = p.Id_Planilla;
             pd.Cont        = contador;
             pd.Num_Dias    = Convert.ToDecimal(tx.Text);
             pd.Area        = ddl.SelectedItem.Text;
             pd.Destino     = GVDetallePlanilla.Rows[dgi.RowIndex].Cells[4].Text;
             pd.Monto       = Convert.ToDecimal(GVDetallePlanilla.Rows[dgi.RowIndex].Cells[6].Text);
             pd.Observacion = tx1.Text;
             ip.DB_Modificar_PLANILLA_DIA(pd);
             contador++;
         }
         DB_VT_Solicitud s = new DB_VT_Solicitud();
         s.DB_Cambiar_ESTADO(LblIdSolicitud.Text, "PROCESADO");
         BtnAceptar.Enabled = false;
         StringBuilder sbMensaje = new StringBuilder();
         sbMensaje.Append("<script type='text/javascript'>");
         sbMensaje.AppendFormat("window.open('{0}','Titulo','top=0,left=0,width=1000,height=600,scrollbars=yes,resizable=no,directories=no,location=no,menubar=no,status=no,Titlebar=yes,toolbar=no');", "../Viaticos/repPlanillaPago.aspx?ci=" + p.Id_Solicitud);
         sbMensaje.Append("</script>");
         ClientScript.RegisterClientScriptBlock(this.GetType(), "Mensaje", sbMensaje.ToString());
         //Response.Redirect("frmRevisarInformes.aspx");
     }
     else
     {
         Response.Write("<script>window.alert('No se puede procesar su planilla de pago, por que NO se tiene un informe de viaje APROBADO.');</script>");
     }
 }
Beispiel #3
0
        public VT_Planilla DB_Seleccionar_PLANILLA(string idSolicitud)
        {
            DA_VT_Planilla data = new DA_VT_Planilla();
            DataTable      dt   = new DataTable();

            dt = data.DA_Seleccionar_PLANILLA(idSolicitud);
            VT_Planilla pl = new VT_Planilla();

            pl.Id_Planilla     = Convert.ToInt32(dt.Rows[0][0]);
            pl.Pago_Total      = Convert.ToDecimal(dt.Rows[0][1]);
            pl.Rc_Iva          = Convert.ToDecimal(dt.Rows[0][2]);
            pl.Liquido_Pagable = Convert.ToDecimal(dt.Rows[0][3]);
            pl.Num_Cheque      = dt.Rows[0][4].ToString();
            pl.Tasa_Cambio     = Convert.ToDecimal(dt.Rows[0][5].ToString());
            pl.Fecha           = Convert.ToDateTime(dt.Rows[0][6].ToString());
            pl.Fecha_Atendido  = Convert.ToDateTime(dt.Rows[0][7].ToString());
            return(pl);
        }
Beispiel #4
0
        public VT_Planilla LlenadoPlanilla(string idSolicitud, DB_VT_Planilla ip, ref int idplanilla)
        {
            VT_Planilla regPlanilla = new VT_Planilla();

            regPlanilla = ip.DB_Seleccionar_PLANILLA(idSolicitud);
            idplanilla  = regPlanilla.Id_Planilla;
            regPlanilla.Id_Solicitud    = idSolicitud;
            regPlanilla.Tot_Num_Dias    = Convert.ToDecimal(LblDiasCom.Text);
            regPlanilla.Tot_Num_Dias15  = Convert.ToDecimal(LblDiasCom15.Text);
            regPlanilla.Pago_Total      = Convert.ToDecimal(LblTotalMonto.Text);
            regPlanilla.Pago_Total15    = Convert.ToDecimal(LblTotalMonto15.Text);
            regPlanilla.Rc_Iva          = Convert.ToDecimal(lblRetencion.Text); //SE GUARDA EL CALCULO DE RETENCION
            regPlanilla.Liquido_Pagable = Convert.ToDecimal(lblTotalPagar.Text);
            regPlanilla.Num_Cheque      = TxtNumCheque.Text;
            regPlanilla.Fecha_Atendido  = DateTime.Now;
            regPlanilla.MontoPorDia     = Convert.ToDecimal(Lbl100.Text);
            return(regPlanilla);
        }
Beispiel #5
0
        protected void Cargar_PLANILLA(string idUser, string idSolicitud)
        {
            string              lugar = "";
            DB_VT_Planilla      regP  = new DB_VT_Planilla();
            VT_Planilla         p     = new VT_Planilla();
            VT_PlanillaDia      pd    = new VT_PlanillaDia();
            VT_SolicitudDestino sd1   = new VT_SolicitudDestino();
            VT_SolicitudDestino sd2   = new VT_SolicitudDestino();
            DB_VT_Solicitud     s1    = new DB_VT_Solicitud();
            DB_AP_Registro_Org  aux   = new DB_AP_Registro_Org();
            DataTable           dt    = new DataTable();
            DataTable           dt1   = new DataTable();
            DataTable           dt2   = new DataTable();
            int     numero            = s1.DB_Numero_Filas_SOLICITUD(idSolicitud);// se modifico query con  'cont>0'
            decimal contdias          = Convert.ToDecimal("0");

            p.Id_Solicitud    = idSolicitud;
            p.Tot_Num_Dias    = 0;
            p.Tot_Num_Dias15  = 0;
            p.Pago_Total      = 0;
            p.Pago_Total15    = 0;
            p.Rc_Iva          = 13; /*********************************************************** OJO AQUI HAY QUE PONER LOS PARAMETROS DE GESTION ******/
            p.Liquido_Pagable = 0;
            p.Num_Cheque      = "0";
            p.Tasa_Cambio     = 0;
            p.Fecha           = DateTime.Now;
            p.Fecha_Atendido  = DateTime.Now;
            p.MontoPorDia     = 1;
            regP.DB_Registrar_PLANILLA(p);
            int idplani = Convert.ToInt32(aux.DB_MaxId("VIAT_PLANILLA", "Id_Planilla"));
            /**************************************************************/
            DB_VT_Solicitud sol = new DB_VT_Solicitud();

            dt = sol.DB_Seleccionar_SOLICITUD(idSolicitud);
            /************************************************************/
            DB_AdminUser us = new DB_AdminUser();

            dt1 = us.DB_Desplegar_USUARIO(idUser);
            /******************************************************/
            DB_VT_Categoria cat  = new DB_VT_Categoria();
            string          aux1 = dt1.Rows[0][11].ToString();
            string          aux2 = dt.Rows[0][3].ToString();

            dt2 = cat.DB_Seleccionar_CATEGORIA(Convert.ToInt32(dt1.Rows[0][11].ToString()), dt.Rows[0][3].ToString());
            /***************************************************************/
            //DB_VT_Solicitud sol = new DB_VT_Solicitud();
            int contador = 1;
            int auxiliar = 0;

            for (int i = 1; i <= (numero); i++)
            {
                sd1 = s1.DB_Seleccionar_SOLICITUD_DESTINO(idSolicitud, i);
                sd2 = s1.DB_Seleccionar_SOLICITUD_DESTINO(idSolicitud, (i + 1));
                int dias = sol.DB_NumDHM(Convert.ToDateTime(sd1.Fecha_Salida.ToString()), Convert.ToDateTime(sd2.Fecha_Salida.ToString()), "DD");
                if (sd1.Fecha_Salida.ToString("dd/MM/yyyy") == sd2.Fecha_Salida.ToString("dd/MM/yyyy"))
                {
                    if (numero == 2)
                    {
                        contdias       = Convert.ToDecimal("0.5");
                        pd.Id_Planilla = idplani;
                        pd.Cont        = contador;
                        pd.Num_Dias    = contdias;
                        if (sd1.Zona == "Interdepartamental")
                        {
                            pd.Area  = "Interdepartamental";
                            pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][3].ToString());
                        }
                        else
                        {
                            pd.Area  = "Al interior del Departamento";
                            pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][4].ToString());
                        }
                        pd.Destino     = sd1.Destino + " " + sd1.Lugar;
                        pd.Observacion = "SIN PERNOCTE";
                        pd.FechaDia    = sd1.Fecha_Salida;
                        regP.DB_Registrar_PLANILLADIA(pd);
                        contador++;
                        break;
                    }
                    else
                    {
                        pd.Destino = sd1.Destino + " " + sd1.Lugar;
                    }
                }
                else
                {
                    if (sd1.Tramo == "Salida")
                    {
                        contdias = s1.DB_NumDHM(sd1.Fecha_Salida, sd2.Fecha_Salida, "DD");
                        for (int j = 0; j < contdias; j++)
                        {
                            pd.Id_Planilla = idplani;
                            pd.Cont        = contador;
                            pd.Num_Dias    = 1;
                            if (sd1.Zona == "Interdepartamental")
                            {
                                pd.Area  = "Interdepartamental";
                                pd.Monto = 1 * Convert.ToDecimal(dt2.Rows[0][3].ToString());
                            }
                            else
                            {
                                pd.Area  = "Al interior del Departamento";
                                pd.Monto = 1 * Convert.ToDecimal(dt2.Rows[0][4].ToString());
                            }
                            pd.Destino     = sd1.Destino + " " + sd1.Lugar;
                            pd.Observacion = "CON PERNOCTE";
                            pd.FechaDia    = sd1.Fecha_Salida.AddDays(j);
                            regP.DB_Registrar_PLANILLADIA(pd);
                            auxiliar = j;
                            contador++;
                        }
                    }
                    else
                    {
                        contdias = s1.DB_NumDHM(Convert.ToDateTime(sd1.Fecha_Salida.ToString("dd/MM/yyyy") + " " + "08:00:00"), sd1.Fecha_Salida, "HH");
                        if (contdias > 4) /*************************************** OJO aqui calculamos por hora mayor a 4 horas se contabiliza como medio dia*/
                        {
                            contdias       = Convert.ToDecimal("0.5");
                            pd.Id_Planilla = idplani;
                            pd.Cont        = contador;
                            pd.Num_Dias    = contdias;
                            if (sd1.Zona == "Interdepartamental")
                            {
                                pd.Area  = "Interdepartamental";
                                pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][3].ToString());
                            }
                            else
                            {
                                pd.Area  = "Al interior del Departamento";
                                pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][4].ToString());
                            }
                            pd.Destino     = sd1.Destino + " " + sd1.Lugar;
                            pd.Observacion = "SIN PERNOCTE";
                            pd.FechaDia    = sd1.Fecha_Salida.AddDays(0);
                            regP.DB_Registrar_PLANILLADIA(pd);
                            contador++;
                        }
                        else
                        {
                            contdias       = Convert.ToDecimal("0.0");
                            pd.Id_Planilla = idplani;
                            pd.Cont        = contador;
                            pd.Num_Dias    = contdias;
                            if (sd1.Zona == "Interdepartamental")
                            {
                                pd.Area  = "Interdepartamental";
                                pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][3].ToString());
                            }
                            else
                            {
                                pd.Area  = "Al interior del Departamento";
                                pd.Monto = contdias * Convert.ToDecimal(dt2.Rows[0][4].ToString());
                            }
                            pd.Destino     = sd1.Destino + " " + sd1.Lugar;
                            pd.Observacion = "No se cumplió el periodo de 4 horas que se considera como  medio día de viatico";
                            pd.FechaDia    = sd1.Fecha_Salida.AddDays(0);
                            regP.DB_Registrar_PLANILLADIA(pd);
                            contador++;
                        }
                    }
                }
            }
        }
        protected void Cargar_VALORES()
        {
            DB_VT_Solicitud memo = new DB_VT_Solicitud();
            DB_VT_Planilla  pl   = new DB_VT_Planilla();
            DataTable       data = new DataTable();

            //data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS");
            //LblDestino.Text = data.Rows[0][0].ToString();
            /**************************************************/
            data = memo.DB_Reporte_SOLICITUD_US(LblIdSolicitud.Text, "DETALLE");
            #region comentado
            //if (data.Rows[0][3].ToString() == "Departamental")
            //{
            //    data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS_LUGAR");
            //}
            //else
            //{
            //    data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS");
            //}
            //LblDestino.Text = data.Rows[0][0].ToString();
            //ini lrojas 27072017: se modifico para obtener destino y lugar segun la zona
            #endregion
            string destinos = string.Empty;
            int    fin      = data.Rows.Count;
            int    cont     = 1;
            foreach (DataRow row in data.Rows)
            {
                string des   = row["Zona"].ToString();
                string tramo = row["Tramo"].ToString();
                if (des == "Interdepartamental")
                {
                    if (tramo == "Salida")
                    {
                        if (cont == fin)
                        {
                            destinos = destinos + row["Destino"].ToString();
                        }
                        else
                        {
                            destinos = destinos + row["Destino"].ToString() + ", ";
                        }
                    }
                }
                else
                {
                    if (tramo == "Salida")
                    {
                        if (cont == fin)
                        {
                            destinos = destinos + row["Lugar"].ToString();
                        }
                        else
                        {
                            destinos = destinos + row["Lugar"].ToString() + ", ";
                        }
                    }
                }
                cont++;
            }

            LblDestino.Text = destinos;
            //fin lrojas 27072017: se modifico para obtener destino y lugar segun la zona
            /*****************************************************/
            data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DIASMONTO");
            //Lbl100.Text = data.Rows[0][12].ToString();
            //Lbl70.Text = Convert.ToString((Convert.ToDecimal(data.Rows[0][12].ToString()) * 70) / 100)

            //*ini* lrojas: 26/09/2016
            decimal Monto_1 = (Math.Round(Convert.ToDecimal(data.Rows[0][12].ToString()), 0));
            //decimal Monto = Convert.ToDecimal(data.Rows[0][12].ToString());
            string AlCien = string.Format("{0:n0}", (Math.Truncate(Monto_1 * 100) / 100));    //string.Format("{0:N2}", (Monto_1 * 100) / 100);
            Lbl100.Text = AlCien;
            decimal Monto2    = ((Monto_1 * 70) / 100);
            string  AlSetenta = string.Format("{0:n0}", (Math.Truncate(Monto2 * 100) / 100));
            //string AlSetenta = string.Format("{0:N2}", Convert.ToDecimal((Monto2 * 100) / 100));

            Lbl70.Text = AlSetenta;
            #region
            //*fin*
            //LblDiasCom.Text = data.Rows[0][2].ToString();
            //LblDiasCom10.Text = data.Rows[0][3].ToString();

            //decimal DiasC = (Math.Round(Convert.ToDecimal(data.Rows[0][2].ToString()), 0));
            //string DiasC_S = string.Format("{0:n0}", (Math.Truncate(DiasC * 100) / 100));
            //LblDiasCom.Text = DiasC_S;
            #endregion
            LblDiasCom.Text = Convert.ToDecimal(data.Rows[0][2].ToString()).ToString();

            /*decimal DiasC10 = (Math.Round(Convert.ToDecimal(data.Rows[0][3].ToString()), 0));
             * string DiasC10_S = string.Format("{0:n0}", (Math.Truncate(DiasC10 * 100) / 100));
             * LblDiasCom10.Text = DiasC10_S;*/

            LblDiasCom10.Text = Convert.ToDecimal(data.Rows[0][3].ToString()).ToString();

            //LblTotalMonto.Text = Convert.ToString(Math.Round((Convert.ToDecimal(Lbl100.Text) * Convert.ToDecimal(LblDiasCom.Text)),0));
            /*****************************/
            int     contdias  = 0;
            decimal totaldias = 0;
            decimal total     = 0;
            decimal total15   = 0;
            foreach (GridViewRow dgi in GVDetallePlanilla.Rows)
            {
                //TextBox tx = (TextBox)dgi.Cells[5].Controls[1];
                decimal monto = Convert.ToDecimal(GVDetallePlanilla.Rows[dgi.RowIndex].Cells[6].Text);
                //Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Monto"));
                //DropDownList ddl = (DropDownList)dgi.Cells[3].Controls[1];
                contdias++;
                if (totaldias <= 9)
                {
                    if (GVDetallePlanilla.Rows[dgi.RowIndex].Cells[3].Text == "Interdepartamental")
                    {
                        total = total + monto;
                    }
                    else
                    {
                        total = total + monto;
                    }
                    totaldias = totaldias + Convert.ToDecimal(GVDetallePlanilla.Rows[dgi.RowIndex].Cells[5].Text);
                }
                else
                {
                    if (GVDetallePlanilla.Rows[dgi.RowIndex].Cells[3].Text == "Interdepartamental")
                    {
                        total15 = total15 + (((monto * 70) / 100));
                    }
                    else
                    {
                        total15 = total15 + (((monto * 70) / 100));
                    }
                }
            }
            /**********************/
            //*ini* lrojas 26/09/2016
            //LblTotalMonto.Text = Convert.ToString(Math.Round(total, 0));
            decimal TotalMonto = (Math.Round(total, 0));                                           //total;
            string  TMonto     = string.Format("{0:n0}", (Math.Truncate(TotalMonto * 100) / 100)); //string.Format("{0:N2}", (TotalMonto * 100) / 100);
            LblTotalMonto.Text = TMonto;
            //*fin*

            if (Convert.ToDecimal(LblDiasCom10.Text) == 0)
            {
                LblTotalMonto10.Text = "0";
            }
            else
            {
                //LblTotalMonto10.Text = Convert.ToString(Math.Round(total,0));   //MI REVISION JLAH
                //LblTotalMonto10.Text = Convert.ToString(Math.Round(total15, 0));

                //*ini* lrojas 26/09/2016
                decimal tm10  = (Math.Round(total15, 0));                                   //total15;
                string  tm10s = string.Format("{0:n0}", (Math.Truncate(tm10 * 100) / 100)); //string.Format("{0:N2}", (tm10 * 100) / 100);
                LblTotalMonto10.Text = tm10s;
                //*fin*
            }
            #region
            //*ini* lrojas 26/09/2016
            //LblConIVA.Text = Convert.ToString(Math.Round(((Convert.ToDecimal(LblTotalMonto.Text) * Convert.ToDecimal(data.Rows[0][6]))/100),0));
            //LblConIVA10.Text = Convert.ToString(Math.Round(((Convert.ToDecimal(LblTotalMonto10.Text) * Convert.ToDecimal(data.Rows[0][6]))/100),0));

            //decimal iva = Math.Round(((Convert.ToDecimal(LblTotalMonto.Text) * Convert.ToDecimal(data.Rows[0][6])) / 100), 0);
            #endregion

            //decimal v13Porciento = Convert.ToDecimal(data.Rows[0][6]);
            //decimal valorpcte = Math.Round((Convert.ToDecimal(LblTotalMonto.Text) * v13Porciento / 100),2);
            //decimal valorMonto10 = Convert.ToDecimal(LblTotalMonto10.Text) * v13Porciento/100;
            //string iva = valorpcte.ToString();
            //LblConIVA.Text = iva;
            //decimal Ltotal = Convert.ToDecimal(LblTotalMonto.Text) - Convert.ToDecimal(iva);
            //LblLiquidoTotal.Text = string.Format("{0:N2}", (Ltotal * 100) / 100);

            //decimal iva10 = Math.Round((Convert.ToDecimal(LblTotalMonto10.Text) * v13Porciento / 100), 2); //valorMonto10 / 100;
            //LblConIVA10.Text = iva10.ToString();  // string.Format("{0:N2}", (iva10 * 100) / 100);
            //decimal Ltotal10 = Convert.ToDecimal(LblTotalMonto10.Text) - Convert.ToDecimal(LblConIVA10.Text);
            //LblLiquidoTotal10.Text = string.Format("{0:N2}", (Ltotal10 * 100) / 100);

            //#region
            ////LblLiquidoTotal.Text = Convert.ToString(Math.Round((Convert.ToDecimal(LblTotalMonto.Text)-Convert.ToDecimal(LblConIVA.Text)), 0));
            ////LblLiquidoTotal10.Text = Convert.ToString(Math.Round(Convert.ToDecimal(LblTotalMonto10.Text)-Convert.ToDecimal(LblConIVA10.Text), 0));
            ////var diferencia = string.Format("{0:N2}",(Convert.ToDecimal(LblTotalMonto.Text) - Convert.ToDecimal(LblConIVA10.Text)).ToString());
            //#endregion
            ////LblTotalPago.Text = Convert.ToString(Math.Round(Convert.ToDecimal(data.Rows[0][7]),0));
            //decimal TPago = Convert.ToDecimal(data.Rows[0][7]);
            //LblTotalPago.Text = string.Format("{0:N2}", (TPago * 100) / 100);


            //decimal iva = Math.Round(((Convert.ToDecimal(LblTotalMonto.Text) * Convert.ToDecimal(data.Rows[0][6])) / 100), 0);
            //PARA NO DESCONTAR IVA
            decimal iva = 0;
            LblConIVA.Text = string.Format("{0:n0}", (Math.Truncate(iva * 100) / 100));

            //decimal iva10 = Math.Round(((Convert.ToDecimal(LblTotalMonto10.Text) * Convert.ToDecimal(data.Rows[0][6])) / 100), 0);
            //PARA NO DESCONTAR IVA
            decimal iva10 = 0;
            LblConIVA10.Text = string.Format("{0:n0}", (Math.Truncate(iva10 * 100) / 100));
            //OCULTAR MONTOS DE DESCUENTO
            LblConIVA.Visible = LblConIVA10.Visible = false;

            //LblLiquidoTotal.Text = Convert.ToString(Math.Round((Convert.ToDecimal(LblTotalMonto.Text)-Convert.ToDecimal(LblConIVA.Text)), 0));
            //LblLiquidoTotal10.Text = Convert.ToString(Math.Round(Convert.ToDecimal(LblTotalMonto10.Text)-Convert.ToDecimal(LblConIVA10.Text), 0));

            decimal Ltotal = Math.Round((Convert.ToDecimal(LblTotalMonto.Text) - Convert.ToDecimal(LblConIVA.Text)), 0);
            LblLiquidoTotal.Text = string.Format("{0:n0}", (Math.Truncate(Ltotal * 100) / 100));
            decimal Ltotal10 = Math.Round(Convert.ToDecimal(LblTotalMonto10.Text) - Convert.ToDecimal(LblConIVA10.Text), 0);
            LblLiquidoTotal10.Text = string.Format("{0:n0}", (Math.Truncate(Ltotal10 * 100) / 100));

            lblTotal.Text     = (Ltotal + Ltotal10).ToString();
            lblRetencion.Text = string.Format("{0:n0}", data.Rows[0][6].ToString());

            //LblTotalPago.Text = Convert.ToString(Math.Round(Convert.ToDecimal(data.Rows[0][7]),0));
            decimal TPago = Math.Round(Convert.ToDecimal(data.Rows[0][7]), 0);
            LblTotalPago.Text = string.Format("{0:n0}", (Math.Truncate(TPago * 100) / 100));


            //*fin*

            VT_Planilla planilla = new VT_Planilla();
            planilla          = pl.DB_Seleccionar_PLANILLA(LblIdSolicitud.Text);
            LblNumCuenta.Text = planilla.Num_Cheque;
        }
Beispiel #7
0
        public void DB_Modificar_PLANILLA(VT_Planilla p)
        {
            DA_VT_Planilla dato = new DA_VT_Planilla();

            dato.DA_Modificar_PLANILLA(p);
        }
Beispiel #8
0
        public void DB_Registrar_PLANILLA(VT_Planilla p)
        {
            DA_VT_Planilla InsPlani = new DA_VT_Planilla();

            InsPlani.DA_Registrar_PLANILLA(p);
        }
Beispiel #9
0
        protected void Cargar_VALORES()
        {
            DB_VT_Solicitud memo = new DB_VT_Solicitud();
            DB_VT_Planilla  pl   = new DB_VT_Planilla();
            DataTable       data = new DataTable();

            data = memo.DB_Reporte_SOLICITUD_US(LblIdSolicitud.Text, "DETALLE");
            string destinos = string.Empty;
            int    fin      = data.Rows.Count;
            int    cont     = 1;

            foreach (DataRow row in data.Rows)
            {
                string des   = row["Zona"].ToString();
                string tramo = row["Tramo"].ToString();
                if (tramo == "Salida")
                {
                    destinos = cont == fin ? destinos + row["Lugar"].ToString() : destinos + row["Lugar"].ToString() + ", ";
                }
                cont++;
            }

            LblDestino.Text = destinos;

            int     contdias    = 0;
            decimal totaldias   = 0;
            decimal totaldias15 = 0;
            decimal monto       = 0;
            decimal total       = 0;
            decimal total15     = 0;

            foreach (GridViewRow dgi in GVDetallePlanilla.Rows)
            {
                TextBox      tx  = (TextBox)dgi.Cells[5].Controls[1];
                DropDownList ddl = (DropDownList)dgi.Cells[3].Controls[1];
                monto = Convert.ToDecimal(GVDetallePlanilla.Rows[dgi.RowIndex].Cells[6].Text);
                contdias++;
                if (totaldias <= 9)
                {
                    total       = total + monto;
                    Lbl100.Text = ddl.SelectedItem.Text == "Interdepartamental" ? LblPgoDiaUrbano.Text : LblPgoDiaRural.Text;
                    totaldias   = totaldias + Convert.ToDecimal(tx.Text);
                }
                else
                {
                    total15     = total15 + (((monto * 70) / 100));
                    totaldias15 = totaldias15 + Convert.ToDecimal(tx.Text);
                }
            }

            Lbl70.Text = Convert.ToString((Convert.ToDecimal(Lbl100.Text) * 70) / 100);

            LblDiasCom15.Text = totaldias15.ToString();
            LblDiasCom.Text   = totaldias.ToString();
            LblTotDias.Text   = (totaldias + totaldias15).ToString();

            LblTotalMonto.Text   = Convert.ToString(Math.Round(total, 0));
            LblTotalMonto15.Text = Convert.ToString(Math.Round(total15, 0));


            total15 = total = 0;
            // QUITA EL RC IVA 13%

            LblConIVA.Text   = Convert.ToString(Math.Round(((total * 13) / 100), 0));
            LblConIVA15.Text = Convert.ToString(Math.Round(((total15 * 13) / 100), 0));

            LblConIVA.Visible = LblConIVA15.Visible = false;    //OCULTA LOS CONTROLES DONDE APARECE EL DESCUENTO DEL RC IVA 13%

            LblLiquidoTotal.Text   = (Convert.ToInt32(LblTotalMonto.Text) - Convert.ToInt32(LblConIVA.Text)).ToString();
            LblLiquidoTotal15.Text = (Convert.ToInt32(LblTotalMonto15.Text) - Convert.ToInt32(LblConIVA15.Text)).ToString();

            LblTotalPago.Text = (Convert.ToInt32(LblLiquidoTotal.Text) + Convert.ToInt32(LblLiquidoTotal15.Text)).ToString();

            decimal retencion = Convert.ToInt32(LblTotalPago.Text) - Convert.ToInt32(txtMontoFactura.Text);

            retencion = retencion < 0 ? 0:retencion;

            lblRetencion.Text = Math.Round((retencion * 13) / 100, 0).ToString();

            lblTotalPagar.Text = (Convert.ToInt32(LblTotalPago.Text) - Convert.ToInt32(lblRetencion.Text)).ToString();


            VT_Planilla plani = new VT_Planilla();

            if (LblEstado.Text == "INF-APROBADO")
            {
                plani                = pl.DB_Seleccionar_PLANILLA(LblIdSolicitud.Text);
                TxtNumCheque.Text    = plani.Num_Cheque;
                TxtNumCheque.Visible = true;
            }
        }
Beispiel #10
0
        protected void Cargar_VALORES()
        {
            DB_VT_Solicitud memo = new DB_VT_Solicitud();
            DB_VT_Planilla  pl   = new DB_VT_Planilla();
            DataTable       data = new DataTable();

            #region
            //data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS");
            //LblDestino.Text = data.Rows[0][0].ToString();
            /**************************************************/
            ////DataTable data = new DataTable();
            #endregion
            data = memo.DB_Reporte_SOLICITUD_US(LblIdSolicitud.Text, "DETALLE");
            #region
            //if (data.Rows[0][3].ToString() == "Departamental")
            //{
            //    data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS_LUGAR");
            //}
            //else
            //{
            //    data = pl.DB_Reporte_DETALLE_PLANILLA(LblIdSolicitud.Text, "DESTINOS");
            //}

            //LblDestino.Text = data.Rows[0][0].ToString();
            //ini lrojas 27072017: se modifico para obtener destino y lugar segun la zona
            #endregion
            string destinos = string.Empty;
            int    fin      = data.Rows.Count;
            int    cont     = 1;
            foreach (DataRow row in data.Rows)
            {
                string des   = row["Zona"].ToString();
                string tramo = row["Tramo"].ToString();
                if (des == "Interdepartamental")
                {
                    if (tramo == "Salida")
                    {
                        if (cont == fin)
                        {
                            destinos = destinos + row["Destino"].ToString();
                        }
                        else
                        {
                            destinos = destinos + row["Destino"].ToString() + ", ";
                        }
                    }
                }
                else
                {
                    if (tramo == "Salida")
                    {
                        if (cont == fin)
                        {
                            destinos = destinos + row["Lugar"].ToString();
                        }
                        else
                        {
                            destinos = destinos + row["Lugar"].ToString() + ", ";
                        }
                    }
                }
                cont++;
            }

            LblDestino.Text = destinos;
            //fin lrojas 27072017: se modifico para obtener destino y lugar segun la zona

            /**************************************************/
            int     contdias    = 0;
            decimal totaldias   = 0;
            decimal totaldias15 = 0;
            decimal total       = 0;
            decimal total15     = 0;
            foreach (GridViewRow dgi in GVDetallePlanilla.Rows)
            {
                TextBox tx    = (TextBox)dgi.Cells[5].Controls[1];
                decimal monto = Convert.ToDecimal(GVDetallePlanilla.Rows[dgi.RowIndex].Cells[6].Text);
                //Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Monto"));
                DropDownList ddl = (DropDownList)dgi.Cells[3].Controls[1];
                contdias++;
                if (totaldias <= 9)
                {
                    if (ddl.SelectedItem.Text == "Interdepartamental")
                    {
                        total = total + monto;
                        //total = total + ((Convert.ToDecimal(tx.Text) * Convert.ToDecimal(LblPgoDiaUrbano.Text)));

                        Lbl100.Text = LblPgoDiaUrbano.Text;
                    }
                    else
                    {
                        total = total + monto;
                        //total = total + ((Convert.ToDecimal(tx.Text) * Convert.ToDecimal(LblPgoDiaRural.Text)));

                        Lbl100.Text = LblPgoDiaRural.Text;
                    }
                    totaldias = totaldias + Convert.ToDecimal(tx.Text);
                }
                else
                {
                    if (ddl.SelectedItem.Text == "Interdepartamental")
                    {
                        //total15 = total15 + ((((Convert.ToDecimal(tx.Text) * Convert.ToDecimal(LblPgoDiaUrbano.Text) * 70) / 100)));
                        total15 = total15 + (((monto * 70) / 100));
                    }
                    else
                    {
                        //total15 = total15 + ((((Convert.ToDecimal(tx.Text) * Convert.ToDecimal(LblPgoDiaRural.Text) * 70) / 100)));
                        total15 = total15 + (((monto * 70) / 100));
                    }
                    totaldias15 = totaldias15 + Convert.ToDecimal(tx.Text);
                }
            }

            Lbl70.Text = Convert.ToString((Convert.ToDecimal(Lbl100.Text) * 70) / 100);
            //Lbl70.Text = string.Format("{0:N2}",(Convert.ToDecimal(Lbl100.Text)*70)/100);

            LblDiasCom15.Text = totaldias15.ToString();
            LblDiasCom.Text   = totaldias.ToString();
            LblTotDias.Text   = (totaldias + totaldias15).ToString();

            #region Lineas anterior que no permitia el redondeo correcto.
            //LblTotalMonto.Text = Convert.ToString(Math.Round(total, 0));
            //LblTotalMonto15.Text = Convert.ToString(Math.Round(total15, 0));
            //LblConIVA.Text = Convert.ToString(Math.Round(((total * 13) / 100), 0));
            //LblConIVA15.Text = Convert.ToString(Math.Round(((total15 * 13) / 100), 0));
            //LblLiquidoTotal.Text = Convert.ToString(Math.Round((total - ((total * 13) / 100)), 0));
            //LblLiquidoTotal15.Text = Convert.ToString(Math.Round((total15 - ((total15 * 13) / 100)), 0));
            //LblTotalPago.Text = Convert.ToString(Math.Round(((total - ((total * 13) / 100)) + (total15 - ((total15 * 13) / 100))), 0));
            //==================================================================================================
            #endregion
            decimal vTotal       = Convert.ToDecimal(total);
            decimal vTotal15     = Convert.ToDecimal(total15);
            decimal vPctajeIva   = Convert.ToDecimal((vTotal * 13) / 100);
            decimal vPctajeIva15 = Convert.ToDecimal((vTotal15 * 13) / 100);

            LblTotalMonto.Text   = Convert.ToString(Math.Round(total, 0));   //string.Format("{0:N2}",vTotal);
            LblTotalMonto15.Text = Convert.ToString(Math.Round(total15, 0)); //string.Format("{0:N2}", vTotal15);

            /*
             * LblConIVA.Text = Convert.ToString(Math.Round(((total * 13) / 100), 0)); //string.Format("{0:N2}", vPctajeIva);
             * LblConIVA15.Text = string.Format("{0:N2}", vPctajeIva15);
             * LblLiquidoTotal.Text = string.Format("{0:N2}", vTotal - Convert.ToDecimal(LblConIVA.Text));
             * LblLiquidoTotal15.Text = string.Format("{0:N2}", vTotal15 - Convert.ToDecimal(LblConIVA15.Text));
             */
            LblConIVA.Text         = Convert.ToString(Math.Round(((total * 13) / 100), 0));
            LblConIVA15.Text       = Convert.ToString(Math.Round(((total15 * 13) / 100), 0));
            LblLiquidoTotal.Text   = Convert.ToString(Math.Round((total - ((total * 13) / 100)), 0));
            LblLiquidoTotal15.Text = Convert.ToString(Math.Round((total15 - ((total15 * 13) / 100)), 0));
            LblTotalPago.Text      = Convert.ToString(Math.Round(((total - ((total * 13) / 100)) + (total15 - ((total15 * 13) / 100))), 0)); //string.Format("{0:N2}", (vTotal - Convert.ToDecimal(LblConIVA.Text) ) + (vTotal15 - Convert.ToDecimal(LblConIVA15.Text)  ));

            VT_Planilla plani = new VT_Planilla();
            if (LblEstado.Text == "INF-APROBADO")
            {
                plani                = pl.DB_Seleccionar_PLANILLA(LblIdSolicitud.Text);
                TxtNumCheque.Text    = plani.Num_Cheque;
                TxtNumCheque.Visible = true;
            }
        }