コード例 #1
0
ファイル: Compras.cs プロジェクト: paulasierraa/A.P.O
 private void Detalle_dtgrdvw_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (this.Detalle_dtgrdvw.Columns[e.ColumnIndex].Name == "eliminar")
     {
         long subtotal_v = 0;
         long iva_v      = 0;
         long total_facv = 0;
         Lógica.Clase_detalle_Compra dtv = new Clase_detalle_Compra();
         int pocision   = Detalle_dtgrdvw.CurrentRow.Index;
         int id_Detalle = int.Parse(Detalle_dtgrdvw[0, pocision].Value.ToString());
         int resultado  = dtv.EliminarDetalleCompra(id_Detalle);
         if (resultado > 0)
         {
             int posicion = Detalle_dtgrdvw.CurrentRow.Index;
             obj_mensajes.Eliminar();
             Detalle_dtgrdvw.Rows.RemoveAt(pocision);
             foreach (DataGridViewRow row in Detalle_dtgrdvw.Rows)
             {
                 subtotal_v += Convert.ToInt64(row.Cells["Subtotalclm"].Value);
             }
             subtotaltxt.Text = subtotal_v.ToString();
             iva_v            = subtotal_v * 19 / 100;
             ivatxt.Text      = iva_v.ToString();
             total_facv       = subtotal_v + iva_v;
             Totaltxt.Text    = total_facv.ToString();
         }
     }
 }
コード例 #2
0
ファイル: Compras.cs プロジェクト: paulasierraa/A.P.O
 private void editar_Detallebtn_Click(object sender, EventArgs e)
 {
     if (productocmb.Text == "" || cantidad_productos_compratxt.Text == "" || valor_unitario_compratxt.Text == "")
     {
         obj_mensajes.Campos_vacios();
     }
     else
     {
         try
         {
             long subtotal_C  = 0;
             long iva_c       = 0;
             long total_fac_C = 0;
             Lógica.Clase_detalle_Compra ing_detalle = new Clase_detalle_Compra();
             int  producto        = int.Parse(productocmb.SelectedValue.ToString());
             long valor_unitario  = long.Parse(valor_unitario_compratxt.Text);
             int  cantidad_compra = int.Parse(cantidad_productos_compratxt.Text);
             long subtotal        = valor_unitario * cantidad_compra;
             int  numero_Factura  = int.Parse(Numero_Factxt.Text);
             int  id_Detalle      = int.Parse(id_Detallelbl.Text);
             int  resultado       = ing_detalle.ModificarDetalleCompra(id_Detalle, producto, valor_unitario, cantidad_compra, subtotal, numero_Factura);
             if (resultado > 0)
             {
                 int posicion = Detalle_dtgrdvw.CurrentRow.Index;
                 obj_mensajes.Modificar();
                 Detalle_dtgrdvw[1, posicion].Value = productocmb.Text;
                 Detalle_dtgrdvw[2, posicion].Value = long.Parse(valor_unitario_compratxt.Text);
                 Detalle_dtgrdvw[3, posicion].Value = int.Parse(cantidad_productos_compratxt.Text);
                 foreach (DataGridViewRow row in Detalle_dtgrdvw.Rows)
                 {
                     subtotal_C += Convert.ToInt64(row.Cells["Subtotalclm"].Value);
                 }
                 subtotaltxt.Text = subtotal_C.ToString();
                 iva_c            = subtotal_C * 19 / 100;
                 ivatxt.Text      = iva_c.ToString();
                 total_fac_C      = subtotal_C + iva_c;
                 Totaltxt.Text    = total_fac_C.ToString();
                 Limpiar();
             }
         }
         catch (SqlException ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }