예제 #1
0
        private void btnAddCompra_Click(object sender, EventArgs e)
        {
            try
            {
                FrmAddCompraContable frm = new FrmAddCompraContable();
                FrmAddCompraContable.Codregistro = fn.select_one_value("IDRegistroCompra", "RegistroCompra", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);
                FrmAddCompraContable.editar      = false;
                frm.lblTitulo.Text = lblMes.Text + " - " + lblAño.Text;
                frm.ShowDialog();

                string codRegistro = fn.select_one_value("IDRegistroCompra", "RegistroCompra", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);
                MostrarGrid(codRegistro);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ".::SISTEMA::.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void _editar()
        {
            try
            {
                string idRegistro        = fn.select_one_value("IDRegistroCompra", "RegistroCompra", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);
                FrmAddCompraContable frm = new FrmAddCompraContable();
                FrmAddCompraContable.Codregistro = idRegistro;
                FrmAddCompraContable.editar      = true;
                frm.lblTitulo.Text = lblMes.Text + " - " + lblAño.Text;

                float tipoCambio = Convert.ToSingle(dgvDetalle.CurrentRow.Cells["TipoCambio"].Value.ToString());
                frm.lblImpuesto.Text = dgvDetalle.CurrentRow.Cells["Impuesto"].Value.ToString();

                //VARIABLES FACTURACION
                double afecto    = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["BaseGravada"].Value.ToString()) / tipoCambio;
                double inafecto  = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["BaseNoGravada"].Value.ToString()) / tipoCambio;
                double igv       = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["IGV"].Value.ToString()) / tipoCambio;
                double isc       = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["isc"].Value.ToString()) / tipoCambio;
                double otros     = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["OtrosTributos"].Value.ToString()) / tipoCambio;
                double descuento = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["Descuento"].Value.ToString()) / tipoCambio;
                double total     = Convert.ToDouble(dgvDetalle.CurrentRow.Cells["Total"].Value.ToString()) / tipoCambio;



                //PASAMOS DETALLE DE COMPRA

                string IDCompraContable = dgvDetalle.CurrentRow.Cells["IDCompraContable"].Value.ToString();



                frm.idCompraContable        = IDCompraContable;
                frm.dtpFecha.Value          = Convert.ToDateTime(dgvDetalle.CurrentRow.Cells["FechaEmision"].Value);
                frm.dtpFechaVcto.Value      = Convert.ToDateTime(dgvDetalle.CurrentRow.Cells["FechaVencimiento"].Value);
                frm.cbxTipoComprobante.Text = dgvDetalle.CurrentRow.Cells["NombreComprobante"].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.txtAfecto.Text     = afecto.ToString("0.00");
                frm.txtInafecto.Text   = inafecto.ToString("0.00");
                frm.txtIGV.Text        = igv.ToString("0.00");
                frm.txtISC.Text        = isc.ToString("0.00");
                frm.txtOtros.Text      = otros.ToString("0.00");
                frm.txtDescuento.Text  = descuento.ToString("0.00");
                frm.txtTotal.Text      = total.ToString("0.00");
                frm.txtTipoCambio.Text = tipoCambio.ToString();



                frm.ShowDialog();

                string codRegistro = fn.select_one_value("IDRegistroCompra", "RegistroCompra", "MES='" + lblMes.Text + "' AND AÑO='" + lblAño.Text + "'", 0);
                MostrarGrid(codRegistro);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ".::SISTEMA::.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }