Exemple #1
0
        public void RegistrarPago(DtoPago objpago)
        {
            double  costo;
            bool    correcto = true;
            DtoPago objpago2 = new DtoPago();

            objpago2.FK_IS_Cod        = objpago.FK_IS_Cod;
            objpago2.DP_ImportePagado = objpago.DP_ImportePagado;
            costo    = objpagodao.SelectCosto(objpago2);
            correcto = objpago2.DP_ImportePagado >= (costo / 2);
            if (!correcto)
            {
                objpago.error = 3;
                return;
            }
            DtoPago objpago3 = new DtoPago();

            objpago3.DP_ImportePagado = objpago.DP_ImportePagado;
            correcto = objpago3.DP_ImportePagado <= costo;
            if (!correcto)
            {
                objpago.error = 4;
                return;
            }
            objpago.error = 77;
            objpagodao.InsertarPago(objpago);
        }
Exemple #2
0
        public void UpdatePago_restante(DtoPago objpago)
        {
            SqlCommand cmd = new SqlCommand("Update T_PAGO set DP_ImportePagado=" + (objpago.DP_ImportePagado + objpago.DP_ImporteRestante) + ", DP_ImporteRestante=0.00, IP_TipoPago=2 where FK_IS_Cod=" + objpago.FK_IS_Cod, conexion);

            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Exemple #3
0
        public double SelectCosto(DtoPago objsolicitud)
        {
            SqlCommand unComando = new SqlCommand("select DS_ImporteTotal from T_Solicitud where PK_IS_Cod =" + objsolicitud.FK_IS_Cod, conexion);

            conexion.Open();
            var ultimo = unComando.ExecuteScalar().ToString();

            conexion.Close();
            return(Convert.ToDouble(ultimo));
        }
Exemple #4
0
        public void RegistrarPago(DtoPago objPago)
        {
            SqlCommand command = new SqlCommand("SP_RegistrarPago", conexion);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@fecha", objPago.DTP_Fecha);
            command.Parameters.AddWithValue("@monto", objPago.DP_Monto);
            command.Parameters.AddWithValue("@anio", objPago.VP_Anio);
            command.Parameters.AddWithValue("@mes", objPago.VP_Mes);
            command.Parameters.AddWithValue("@dni", objPago.FK_IU_DNI);
            command.Parameters.AddWithValue("@concepto", objPago.FK_ICP_Cod);
            conexion.Open();
            command.ExecuteNonQuery();
            conexion.Close();
        }
Exemple #5
0
        public bool SelectPagoRUC(DtoPago p)
        {
            string     Select    = "SELECT * from T_Pago where FK_IS_Cod ='" + p.FK_IS_Cod + "'";
            SqlCommand unComando = new SqlCommand(Select, conexion);

            conexion.Open();
            SqlDataReader reader       = unComando.ExecuteReader();
            bool          hayRegistros = reader.Read();

            if (hayRegistros)
            {
                p.VP_RUC = (string)reader[6];
            }
            conexion.Close();
            return(hayRegistros);
        }
Exemple #6
0
        public void InsertarPagoB(DtoPago objpago)
        {
            SqlCommand cmd = new SqlCommand("SP_InsertarPago", conexion);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@tipo", objpago.IP_TipoPago);
            cmd.Parameters.AddWithValue("@pagado", objpago.DP_ImportePagado);
            cmd.Parameters.AddWithValue("@restante", objpago.DP_ImporteRestante);
            cmd.Parameters.AddWithValue("@tipocertificado", objpago.IP_TipoCertificado);
            cmd.Parameters.AddWithValue("@ruc", objpago.VP_RUC);
            cmd.Parameters.AddWithValue("@solicitud", objpago.FK_IS_Cod);

            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Exemple #7
0
    public void mostrarmsjPAGO(DtoPago p)
    {
        switch (p.error)
        {
        case 3:
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Importe INSUFICIENTE!!!'});", true);
            break;

        case 4:
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Importe INVALIDO!!!'});", true);
            break;

        case 77:
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({title:'Pago registrado CORRECTAMENTE!',text:'Datos ENVIADOS!',icon:'success'}, function(){window.location.href='ConsultarEstadoPago.aspx'});", true);
            break;
        }
    }
Exemple #8
0
        public bool SelectPagoxCod_Solicitud(DtoPago objDtoPago)
        {
            string     select  = "SELECT * FROM T_PAGO WHERE FK_IS_Cod =" + objDtoPago.FK_IS_Cod;
            SqlCommand command = new SqlCommand(select, conexion);

            conexion.Open();
            SqlDataReader reader       = command.ExecuteReader();
            bool          hayRegistros = reader.Read();

            if (hayRegistros)
            {
                objDtoPago.PK_VP_Cod          = (string)reader[0];
                objDtoPago.IP_TipoPago        = (int)reader[2];
                objDtoPago.DP_ImportePagado   = double.Parse(reader[3].ToString());
                objDtoPago.DP_ImporteRestante = double.Parse(reader[4].ToString());
                objDtoPago.IP_TipoCertificado = (int)reader[5];
                objDtoPago.VP_RUC             = (string)reader[6];
            }
            conexion.Close();
            return(hayRegistros);
        }
Exemple #9
0
    protected void btnEnviar_Click(object sender, EventArgs e)
    {
        Log _Log = new Log();

        try
        {
            objfacturaneg = new CtrDatoFactura();
            objfactura    = new DtoDatoFactura();
            objpago       = new DtoPago();
            objpagoneg    = new CtrPago();
            objsol        = new DtoSolicitud();
            objsolneg     = new Ctr_Solicitud();
            objvou        = new DtoVoucher();
            objvouneg     = new CtrVoucher();
            int ultimo = objfacturaneg.ultimo();

            if (valorObtenidoRBTN.Value != "1" && valorObtenidoRBTN.Value != "2")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Seleccione BOLETA o FACTURA!!'});", true);
                return;
            }
            if (txtImporte.Text == "" | txtNumOp.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }
            if (txtnewRUC.Text == "" && valorCheck.Value == "3" && valorObtenidoRBTN.Value == "2")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }
            if (ddlRUC.Text == "" && valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'Complete espacios en BLANCO!!'});", true);
                return;
            }

            objsol.PK_IS_Cod           = Convert.ToInt32(Session["idSolicitudPago"].ToString());
            objfactura.PK_IDF_Cod      = ultimo + 1;
            objfactura.VDF_RazonSocial = "";
            objfactura.FK_VU_DNI       = Session["DNIUsuario"].ToString();
            if (valorObtenidoRBTN.Value == "2" && valorCheck.Value == "3")
            {
                objpago.IP_TipoCertificado = 2;
                objpago.VP_RUC             = txtnewRUC.Text;
                objfactura.IDF_RUC         = txtnewRUC.Text;
            }
            if (valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                objpago.VP_RUC             = ddlRUC.Text;
                objpago.IP_TipoCertificado = 2;
            }
            if (valorObtenidoRBTN.Value == "1")
            {
                objpago.VP_RUC             = "";
                objpago.IP_TipoCertificado = 1;
            }
            objpago.FK_IS_Cod        = Convert.ToInt32(Session["idSolicitudPago"].ToString());
            objpago.DP_ImportePagado = Convert.ToDouble(txtImporte.Text);
            double costo = objpagoneg.Costo(objpago);

            objpago.DP_ImporteRestante = costo - Convert.ToDouble(txtImporte.Text);

            if (Convert.ToDouble(txtImporte.Text) == (costo / 2))
            {
                objpago.IP_TipoPago = 1;
            }
            if (Convert.ToDouble(txtImporte.Text) > (costo / 2) | Convert.ToDouble(txtImporte.Text) == costo)
            {
                objpago.IP_TipoPago = 2;
            }
            objvou.PK_VV_NumVoucher     = txtNumOp.Text;
            objvou.DV_ImporteDepositado = Convert.ToDouble(txtImporte.Text);
            objvou.VV_Comentario        = "";

            if (hftxtimg.Value == "vacio")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "swal({icon: 'error',title: 'ERROR!',text: 'suba la IMAGEN!!'});", true);
                return;
            }
            else
            {
                _Log.CustomWriteOnLog("ImagenGuardada", "EL CAMPO ESTA LLENO");
            }
            objpagoneg.RegistrarPago(objpago);
            mostrarmsjPAGO(objpago);
            if (objpago.error == 77 && valorCheck.Value == "3" && valorObtenidoRBTN.Value == "2")
            {
                objfacturaneg.RegistrarDatoFactura(objfactura);
                mostrarmsjFACTURA(objfactura);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "Ruc registrado");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
            if (objpago.error == 77 && valorObtenidoRBTN.Value == "2" && valorCheck.Value != "3")
            {
                _Log.CustomWriteOnLog("RealizarCompra.cs", "Ruc registrado");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
            if (objpago.error == 77)
            {
                _Log.CustomWriteOnLog("RealizarCompra.cs", "1");
                objvouneg.RegistrarVoucher(objvou);
                _Log.CustomWriteOnLog("RealizarCompra.cs", "2");
                Utils.AddScriptClientUpdatePanel(UpdatePanel1, "uploadFileImagenVoucher('" + objvou.PK_VV_NumVoucher + "');");
                _Log.CustomWriteOnLog("RealizarCompra.cs", "3");
                objsolneg.ActualizarEstado(objsol);
            }
        }
        catch (Exception ex)
        {
            _Log.CustomWriteOnLog("RealizarCompra.cs", "error   " + ex.Message);
        }
    }
Exemple #10
0
 public void RegistrarPago(DtoPago objP)
 {
     objDaoPago.RegistrarPago(objP);
 }
Exemple #11
0
 public bool HayRUC(DtoPago p)
 {
     return(objpagodao.SelectPagoRUC(p));
 }
Exemple #12
0
 public double Costo(DtoPago pago)
 {
     return(objpagodao.SelectCosto(pago));
 }
Exemple #13
0
 public void AgregarRestante(DtoPago objpago)
 {
     objDaoPago.UpdatePago_restante(objpago);
 }
Exemple #14
0
 public bool ExistenciaPago(DtoPago objDtoPago)
 {
     return(objDaoPago.SelectPagoxCod_Solicitud(objDtoPago));
 }
Exemple #15
0
 public void RegistrarPagoB(DtoPago objDtoPago)
 {
     objDaoPago.InsertarPagoB(objDtoPago);
 }