Example #1
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         if (chkFactura.Checked && txtPtoVenta.Text != "" && txtFactura.Text != "")
         {
             fact.Ptoventa = Convert.ToInt32(txtPtoVenta.Text);
             fact.Numerofact = Convert.ToInt32(txtFactura.Text);
             TipoFormasPago t = new TipoFormasPago(Convert.ToInt32(cmbFormaPago.SelectedValue), cmbFormaPago.Text, "", "", "",0);
             if (cmbFormaPago.Text == "TARJETA DE CREDITO" || cmbFormaPago.Text == "TARJETA DE DEBITO")
             {
                 t.Idtarjetas = (Convert.ToString(cmbFormaPago.SelectedValue));
                 t.Cupon = txtCupon.Text;
                 t.Cuotas = txtCuotas.Text;
             }
             if (cmbFormaPago.Text != "CUENTA CORRIENTE")
             {
                 controlf.Agregar2(fact, lista1, t);
             }
         }
         else
         {
             Acceso_BD oacceso = new Acceso_BD();
             DataTable dt = oacceso.leerDatos("select numero + 1 as numero from contador where detalle = 'recibo'");
             int factura = 0;
             foreach (DataRow dr in dt.Rows)
             {
                 factura = Convert.ToInt32(dr["numero"]);
             }
             fact.Ptoventa = 0;
             fact.Numerofact = factura;
             TipoFormasPago t = new TipoFormasPago(Convert.ToInt32(cmbFormaPago.SelectedValue), cmbFormaPago.Text, "", "", "",0);
             if (cmbFormaPago.Text == "TARJETA DE CREDITO" || cmbFormaPago.Text == "TARJETA DE DEBITO")
             {
                 t.Idtarjetas = (Convert.ToString(cmbFormaPago.SelectedValue));
                 t.Cupon = txtCupon.Text;
                 t.Cuotas = txtCuotas.Text;
             }
             if (cmbFormaPago.Text != "CUENTA CORRIENTE")
             {
                 controlf.Agregar2(fact, lista1, t);
             }
             oacceso.ActualizarBD("update contador set numero = numero + 1 where detalle = 'recibo'");
         }
         MessageBox.Show("Comprobante guardado exitosamente");
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
 public void Agregar2(Factura dato, List<Ctacte> dato1, TipoFormasPago dato2)
 {
     DataTable dt = oacceso.leerDatos("insert into facturacion (fecha,idpaciente,detalle,domicilio,documento,localidad,total,ptoventa,factura,bonificacion, tipocomp) values ('" + dato.Fecha.ToString("yyyy-MM-dd HH:mm:ss") + "','" + dato.Idpaciente + "','" + dato.Detalle + "','" + dato.Domicilio + "','" + dato.Documento + "','" + dato.Localidad + "','" + dato.Total.ToString().Replace(',', '.') + "','" + dato.Ptoventa + "','" + dato.Numerofact + "','" + dato.Bonif.ToString().Replace(',', '.') + "','2'); select max(idfacturacion) as idfactura from facturacion;");
     string idfactura = "";
     foreach (DataRow dr in dt.Rows)
     {
         idfactura = Convert.ToString(dr["idfactura"]);
     }
     string update = "begin; ";
     foreach (Ctacte aux in dato1)
     {
         if (aux.Acancelar > 0)
         {
             update = update + "update ctacte set cancelado = cancelado + '" + aux.Acancelar.ToString().Replace(',', '.') + "' where idctacte = '" + aux.Idctacte + "'; ";
         }
     }
     update = update + "insert into ctacte (idfacturacion, idpacientes, tipocomp, importe, cancelado) values ('" + idfactura + "','" + dato.Idpaciente + "','2','" + dato.Total.ToString().Replace(',', '.') + "','" + dato.Total.ToString().Replace(',', '.') + "'); commit;";
     oacceso.ActualizarBD(update);
     oacceso.ActualizarBD("insert into formasdepago (idtipoformaspago, idfacturacion, idtarjetas, cupon, cuotas, total) values ('" + dato2.Idtipoformaspago + "','" + idfactura + "','" + dato2.Idtarjetas + "','" + dato2.Cupon + "','" + dato2.Cuotas + "','" + dato.Total.ToString().Replace(',', '.') + "')");
 }
Example #3
0
 public void AgregarFP(TipoFormasPago dato2, string idfactura)
 {
     oacceso.ActualizarBD("insert into formasdepago (idtipoformaspago, idfacturacion, idtarjetas, cupon, cuotas, total) values ('" + dato2.Idtipoformaspago + "','" + idfactura + "','" + dato2.Idtarjetas + "','" + dato2.Cupon + "','" + dato2.Cuotas + "','" + dato2.Importe.ToString().Replace(',', '.') + "')");
 }
Example #4
0
 public void AgregarFPC(TipoFormasPago dato2, string idfactura, string idpaciente)
 {
     oacceso.ActualizarBD("insert into ctacte (idfacturacion, idpacientes, tipocomp, importe, cancelado) values ('" + idfactura + "','" + idpaciente + "','1','" + dato2.Importe.ToString().Replace(',', '.') + "',0)");
     oacceso.ActualizarBD("insert into formasdepago (idtipoformaspago, idfacturacion, idtarjetas, cupon, cuotas, total) values ('" + dato2.Idtipoformaspago + "','" + idfactura + "','" + dato2.Idtarjetas + "','" + dato2.Cupon + "','" + dato2.Cuotas + "','" + dato2.Importe.ToString().Replace(',', '.') + "')");
 }
Example #5
0
        private void frmFormaPago1_Load(object sender, EventArgs e)
        {
            Acceso_BD oacceso = new Acceso_BD();
            DataTable dt = oacceso.leerDatos("select * from tipoformaspago order by tipo asc");
            List<TipoFormasPago> listat = new List<TipoFormasPago>();
            foreach (DataRow dr in dt.Rows)
            {
                TipoFormasPago t = new TipoFormasPago(Convert.ToInt32(dr["idtipoformaspago"]), Convert.ToString(dr["tipo"]), "", "", "",0);
                listat.Add(t);
            }
            cmbFormaPago.DataSource = listat;
            cmbFormaPago.DisplayMember = "forma";
            cmbFormaPago.ValueMember = "idtipoformaspago";
            cmbFormaPago.SelectedIndex = 1;
            cmbFormaPago.Text = "EFECTIVO";

            dt = oacceso.leerDatos("select * from tarjetas order by tarjeta asc");
            List<Tarjetas> listata = new List<Tarjetas>();
            foreach (DataRow dr in dt.Rows)
            {
                Tarjetas t = new Tarjetas(Convert.ToInt32(dr["idtarjetas"]), Convert.ToString(dr["tarjeta"]));
                listata.Add(t);
            }
            cmbTarjetas.DataSource = listata;
            cmbTarjetas.DisplayMember = "tarjeta";
            cmbTarjetas.ValueMember = "idtarjetas";
            cmbTarjetas.SelectedIndex = 0;
            cmbTarjetas.SelectedItem = null;
            txtTotal.Text = fact.Total.ToString();
        }