Exemplo n.º 1
0
        public void deletePRENDASAL(Gasto gasto, string suc, string emp, string sistema)
        {
            try
            {
                string sql = "prendasal.SP_ELIMINAR_GASTO";
                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter c = cmd.Parameters.Add("idgasto", MySqlDbType.Int32);
                c.Direction = ParameterDirection.Input;
                MySqlParameter sucursal = cmd.Parameters.Add("sucursal", MySqlDbType.VarChar, 2);
                sucursal.Direction = ParameterDirection.Input;
                MySqlParameter empleado = cmd.Parameters.Add("empleado", MySqlDbType.VarChar, 15);
                empleado.Direction = ParameterDirection.Input;
                MySqlParameter system = cmd.Parameters.Add("sistema", MySqlDbType.VarChar, 20);
                system.Direction = ParameterDirection.Input;
                MySqlParameter notaCambio = cmd.Parameters.Add("notaCambio", MySqlDbType.VarChar, 100);
                notaCambio.Direction = ParameterDirection.Input;

                c.Value = gasto.ID_GASTO;

                sucursal.Value = suc;
                empleado.Value = emp;
                system.Value = sistema;

                notaCambio.Value = gasto.NOTA_CAMBIO;

                cmd.ExecuteNonQuery();
                MessageBox.Show("REGISTRO DE GASTO ELIMINADO", "OPERACION FINALIZADA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "ERROR AL ELIMINAR GASTO ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw e;
            }
        }
Exemplo n.º 2
0
 public bool eliminarGastoPRENDASAL(Gasto gasto, string sucursal, string empleado, string sistema)
 {
     try
     {
         db.deletePRENDASAL(gasto, sucursal, empleado, sistema);
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
Exemplo n.º 3
0
 private void cargarSelected()
 {
     SELECTED = null;
     if (tblGASTOS.CurrentCell != null && tblGASTOS.SelectedRows.Count == 1)
     {
         SELECTED = new Gasto();
         SELECTED.ID_GASTO = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<int>("ID_GASTO");
         SELECTED.TRANSACCION = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("COD_TRANS");
         SELECTED.RESPONSABLE = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("RESPONSABLE");
         SELECTED.COD_SUC = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("COD_SUC");
         SELECTED.FECHA = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<DateTime>("FECHA");
         SELECTED.TIPO_DOC = (eTipoDocGasto) GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<int>("TIPO_DOC");
         SELECTED.DOCUMENTO = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("DOCUMENTO");
         SELECTED.DESCRIPCION = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("DESCRIPCION");
         SELECTED.SUMAS = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<decimal>("SUMAS");
         SELECTED.TOTAL = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<decimal>("TOTAL");
         SELECTED.ESTADO =(eEstadoGasto) GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<int>("ESTADO");
         SELECTED.NOTA = GASTOS.Rows[tblGASTOS.CurrentCell.RowIndex].Field<string>("NOTA");
     }
 }
Exemplo n.º 4
0
 public Gasto findByGastoPRENDASAL(string doc)
 {
     Gasto g = null;
     DataTable dt = db.findByGastoPRENDASAL(doc);
     if (dt.Rows.Count > 0)
     {
         g = new Gasto();
         g.ID_GASTO = dt.Rows[0].Field<int>("ID_GASTO");
         g.TRANSACCION = dt.Rows[0].Field<string>("COD_TRANS");
         g.RESPONSABLE = dt.Rows[0].Field<string>("RESPONSABLE");
         g.COD_SUC = dt.Rows[0].Field<string>("COD_SUC");
         g.SUCURSAL = dt.Rows[0].Field<string>("SUCURSAL");
         g.FECHA = dt.Rows[0].Field<DateTime>("FECHA");
         g.TIPO_DOC = (eTipoDocGasto)dt.Rows[0].Field<int>("TIPO_DOC");
         g.DOCUMENTO = dt.Rows[0].Field<string>("DOCUMENTO");
         g.DESCRIPCION = dt.Rows[0].Field<string>("DESCRIPCION");
         g.SUMAS = dt.Rows[0].Field<decimal>("SUMAS");
         g.TOTAL = dt.Rows[0].Field<decimal>("TOTAL");
         g.NOTA = dt.Rows[0].Field<string>("NOTA");
         g.ESTADO = (eEstadoGasto)dt.Rows[0].Field<int>("ESTADO");
         g.INIT_BALANCE = dt.Rows[0].Field<bool>("INIT_BALANCE");
     }
     return g;
 }
Exemplo n.º 5
0
 public bool isCancelado(Gasto gasto)
 {
     try
     {
         return db.isCancelado(gasto.ID_GASTO);
     }
     catch (Exception e)
     {
         return false;
     }
 }
Exemplo n.º 6
0
 public DataTable GET_ITEMS_GASTO(Gasto gasto)
 {
     return db.getItemsGasto(gasto.ID_GASTO);
 }
Exemplo n.º 7
0
 public bool registrarGastoPRENDASAL(Gasto gasto, string sucursal, string empleado, string sistema)
 {
     try
     {
         gasto.ESTADO = eEstadoGasto.PREINGRESADA;
         gasto.INIT_BALANCE = false;
         db.insertPRENDASAL(gasto, sucursal, empleado, sistema);
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
Exemplo n.º 8
0
        private string buildItemsGasto(Gasto gasto)
        {
            string items = "";
            if (gasto.ITEMS_GASTO != null && gasto.ITEMS_GASTO.Count > 0)
            {
                foreach (DataGridViewRow row in gasto.ITEMS_GASTO)
                {
                    items = items + "1.00," + null + "," +
                        row.Cells["DESCRIPCION"].Value + ","
                        + "0.00,"
                        + "0.00,"
                        + Decimal.Parse(row.Cells["MONTO"].FormattedValue.ToString(), System.Globalization.NumberStyles.Currency) + ","
                        + Int32.Parse(row.Cells["TAX"].FormattedValue.ToString()) + ","
                        + "0.00,"
                        + Decimal.Parse(row.Cells["MONTO_IMP"].FormattedValue.ToString(), System.Globalization.NumberStyles.Currency) + ","
                        + row.Cells["CUENTA"].Value + ";";
                }
            }
            else
            {
                int tax = 0;

                items = items + "1.00," + null + ","
                        + gasto.DESCRIPCION + ","
                        + "0.00,"
                        + "0.00,"
                        + gasto.TOTAL + ","
                        + tax + ","
                        + "0.00,"
                        + gasto.TOTAL_IMP + ","
                        + null + ";";
            }
            return items;
        }
Exemplo n.º 9
0
        public void updatePRENDASAL(Gasto gasto, string sucursal, string empleado, string sistema)
        {
            string items = "";
            try
            {
                items = buildItemsGasto(gasto);

                string sql = "prendasal.SP_EDITAR_GASTO";

                MySqlCommand cmd = new MySqlCommand(sql, conn.conection);
                cmd.CommandType = CommandType.StoredProcedure;
                MySqlParameter idcompra = cmd.Parameters.Add("idgasto", MySqlDbType.Int32);
                idcompra.Direction = ParameterDirection.Input;
                MySqlParameter fecha = cmd.Parameters.Add("fecha", MySqlDbType.Date);
                fecha.Direction = ParameterDirection.Input;
                MySqlParameter tipodoc = cmd.Parameters.Add("tipodoc", MySqlDbType.Int32);
                tipodoc.Direction = ParameterDirection.Input;
                MySqlParameter documento = cmd.Parameters.Add("documento", MySqlDbType.VarChar, 20);
                documento.Direction = ParameterDirection.Input;
                MySqlParameter tipocompra = cmd.Parameters.Add("tipogasto", MySqlDbType.Int32);
                tipocompra.Direction = ParameterDirection.Input;
                MySqlParameter sumas = cmd.Parameters.Add("total_sumas", MySqlDbType.Decimal);
                sumas.Direction = ParameterDirection.Input;
                MySqlParameter total = cmd.Parameters.Add("total_gasto", MySqlDbType.Decimal);
                total.Direction = ParameterDirection.Input;
                MySqlParameter estado = cmd.Parameters.Add("estado_gasto", MySqlDbType.Int32);
                estado.Direction = ParameterDirection.Input;
                MySqlParameter nivel_gasto = cmd.Parameters.Add("nivel_gasto", MySqlDbType.Int32);
                nivel_gasto.Direction = ParameterDirection.Input;
                MySqlParameter gastoNat = cmd.Parameters.Add("gastoNat", MySqlDbType.Int32);
                gastoNat.Direction = ParameterDirection.Input;
                MySqlParameter init = cmd.Parameters.Add("init", MySqlDbType.Bit);
                init.Direction = ParameterDirection.Input;
                MySqlParameter codSUC = cmd.Parameters.Add("suc_gasto", MySqlDbType.VarChar, 2);
                codSUC.Direction = ParameterDirection.Input;
                MySqlParameter observacion = cmd.Parameters.Add("observacion", MySqlDbType.VarChar, 100);
                observacion.Direction = ParameterDirection.Input;
                MySqlParameter itemsC = cmd.Parameters.Add("items", MySqlDbType.LongText);
                itemsC.Direction = ParameterDirection.Input;
                MySqlParameter suc = cmd.Parameters.Add("sucursal", MySqlDbType.VarChar, 2);
                suc.Direction = ParameterDirection.Input;
                MySqlParameter emp = cmd.Parameters.Add("empleado", MySqlDbType.VarChar, 15);
                emp.Direction = ParameterDirection.Input;
                MySqlParameter system = cmd.Parameters.Add("sistema", MySqlDbType.VarChar, 20);
                system.Direction = ParameterDirection.Input;

                MySqlParameter notaCambio = cmd.Parameters.Add("notaCambio", MySqlDbType.VarChar, 100);
                notaCambio.Direction = ParameterDirection.Input;

                idcompra.Value = gasto.ID_GASTO;
                fecha.Value = gasto.FECHA.Date.ToString("yyyy-MM-dd");
                tipodoc.Value = (int)gasto.TIPO_DOC;
                documento.Value = gasto.DOCUMENTO;
                tipocompra.Value = (int)eTipoCompra.CONTADO;
                sumas.Value = gasto.SUMAS;
                total.Value = gasto.TOTAL;
                estado.Value = (int)gasto.ESTADO;
                nivel_gasto.Value = (int)eNIVEL.PRENDASAL;
                init.Value = gasto.INIT_BALANCE;
                codSUC.Value = gasto.COD_SUC;
                observacion.Value = gasto.NOTA;

                itemsC.Value = items;

                suc.Value = sucursal;
                emp.Value = empleado;
                system.Value = sistema;

                notaCambio.Value = gasto.NOTA_CAMBIO;

                cmd.ExecuteNonQuery();
                MessageBox.Show("GASTO ACTUALIZADO", "OPERACION FINALIZADA", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception e)
            {
                MessageBox.Show(null, e.Message, "ERROR AL ACTUALIZAR GASTO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw e;
            }
        }