Exemple #1
0
        private void eDITARCOMPRAToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmAddCompra frm = new FrmAddCompra();

            //CONTROLES COMUNES
            frm.editar      = true;
            frm.lblAño.Text = lblAño.Text;
            frm.lblMes.Text = lblMes.Text;
            string idCompra = dgvDetalle.CurrentRow.Cells["CodSistema"].Value.ToString();

            frm.lblIDComproEditada.Text = idCompra;


            //AGREGAMOS DETALLE DE COMPRA
            SqlDataReader lector = fn.selectMultiValues("select i.IDInsumo,i.Insumo,dc.Cantidad,dc.Costo,CAST(dc.Cantidad * dc.Costo as decimal(18,2)) as Importe,dc.Afecto from DetalleCompra dc inner join Insumo i on dc.IDInsumo = i.IDInsumo where IDCompra = '" + idCompra + "'");

            while (lector.Read())
            {
                string IDInsumo = lector["IDInsumo"].ToString();
                string insumo   = lector["Insumo"].ToString();
                string cantidad = lector["Cantidad"].ToString();
                string costo    = lector["Costo"].ToString();
                string importe  = lector["Importe"].ToString();
                bool   afecto   = Convert.ToBoolean(lector["Afecto"].ToString());

                frm.dgvDetalle.Rows.Add(IDInsumo, insumo, cantidad, costo, importe, afecto);
            }
            lector.Close();

            //DATOS COMPROBANTE
            frm.cbxAlmacen.Text           = dgvDetalle.CurrentRow.Cells["Almacen"].Value.ToString();
            frm.dtpFechaComprobante.Value = Convert.ToDateTime(dgvDetalle.CurrentRow.Cells["FechaEmision"].Value);
            frm.dtpFechaVencimiento.Value = Convert.ToDateTime(dgvDetalle.CurrentRow.Cells["FechaVencimiento"].Value);
            frm.cbxTipoComprobante.Text   = dgvDetalle.CurrentRow.Cells["TipoComprobante"].Value.ToString();
            frm.txtSerie.Text             = dgvDetalle.CurrentRow.Cells["Serie"].Value.ToString();
            frm.txtCorrelativo.Text       = dgvDetalle.CurrentRow.Cells["Correlativo"].Value.ToString();
            frm.txtNumero.Text            = dgvDetalle.CurrentRow.Cells["Numero"].Value.ToString();
            frm.txtNombre.Text            = dgvDetalle.CurrentRow.Cells["Denominacion"].Value.ToString();
            frm.cbxMoneda.Text            = dgvDetalle.CurrentRow.Cells["Moneda"].Value.ToString();
            frm.txtTipoCambio.Text        = dgvDetalle.CurrentRow.Cells["TipoCambio"].Value.ToString();
            frm.lblImpuesto.Text          = dgvDetalle.CurrentRow.Cells["Impuesto"].Value.ToString();
            frm.chbxAumentarStock.Checked = Convert.ToBoolean(dgvDetalle.CurrentRow.Cells["AumentaStock"].Value);
            frm.txtISC.Text           = dgvDetalle.CurrentRow.Cells["ISC"].Value.ToString();
            frm.txtOtrosTributos.Text = dgvDetalle.CurrentRow.Cells["OtrosTributos"].Value.ToString();
            frm.txtDescuento.Text     = dgvDetalle.CurrentRow.Cells["Descuento"].Value.ToString();

            frm.chbxConIGV.Checked = Convert.ToBoolean(dgvDetalle.CurrentRow.Cells["ConIGV"].Value);
            frm.ShowDialog();

            string codRegistro = fn.select_one_value("IDRegistroCompraLogistica", "RegistroCompraLogistica", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);

            MostrarGrid(codRegistro);
        }
Exemple #2
0
        private void btnAddCompra_Click(object sender, EventArgs e)
        {
            try
            {
                if (fn.Existencia("*", "RegistroCompraLogistica", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'") == true)
                {
                    string codRegistro = fn.select_one_value("IDRegistroCompraLogistica", "RegistroCompraLogistica", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);

                    FrmAddCompra frm = new FrmAddCompra();
                    frm.lblMes.Text = lblMes.Text;
                    frm.lblAño.Text = lblAño.Text;
                    frm.idRegistro  = codRegistro;
                    frm.editar      = false;
                    frm.ShowDialog();

                    MostrarGrid(codRegistro);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ".::SISTEMA::.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }