예제 #1
0
        private void txtcentro_DoubleClick(object sender, EventArgs e)
        {
            texto = (TextBox)sender;
            FrmSelCentroCostos frm = new FrmSelCentroCostos();

            frm.ShowDialog(this);
        }
예제 #2
0
        private void txtCentro_DoubleClick(object sender, EventArgs e)
        {
            busGrilla = false;
            textoSel  = (TextBox)sender;
            FrmSelCentroCostos frmCC = new FrmSelCentroCostos();

            frmCC.ShowDialog(this);
        }
예제 #3
0
 private void buscarCCosto(string centro)
 {
     if (string.IsNullOrWhiteSpace(centro))
     {
         FrmSelCentroCostos frmSCC = new FrmSelCentroCostos();
         frmSCC.ShowDialog(this);
     }
     else
     {
         objCentro = bllCentro.buscar(centro);
         if (objCentro == null)
         {
             FrmSelCentroCostos frmSCC = new FrmSelCentroCostos();
             frmSCC.ShowDialog(this);
         }
     }
 }
예제 #4
0
        private void dgvDatos_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            busGrilla = false;
            if (e.RowIndex >= 0)
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    if (dgvDatos.Rows[e.RowIndex].Cells["dtDescripcion"].Value != null)
                    {
                        dgvDatos.Rows[e.RowIndex].Cells["dtDescripcion"].Value = dgvDatos.Rows[e.RowIndex].Cells["dtDescripcion"].Value.ToString().ToUpper();
                    }
                    break;

                case 1:
                    string sdebito = (string)dgvDatos.Rows[e.RowIndex].Cells["dtDebito"].Value ?? "0";
                    if (string.IsNullOrEmpty(sdebito) || sdebito == ",")
                    {
                        sdebito = "0";
                    }
                    dgvDatos.Rows[e.RowIndex].Cells["dtDebito"].Value = UtilSystem.fMoneda(Math.Round(Convert.ToDouble(sdebito), 2));
                    if (Convert.ToDouble(sdebito) > 0)
                    {
                        dgvDatos.Rows[e.RowIndex].Cells["dtCredito"].Value = "0,00";
                        SendKeys.Send("{TAB}");
                    }
                    break;

                case 2:
                    string scredito = (string)dgvDatos.Rows[e.RowIndex].Cells["dtCredito"].Value;
                    if (string.IsNullOrEmpty(scredito) || scredito == ",")
                    {
                        scredito = "0";
                    }
                    dgvDatos.Rows[e.RowIndex].Cells["dtCredito"].Value = UtilSystem.fMoneda(Math.Round(Convert.ToDouble(scredito), 2));
                    if (Convert.ToDouble(scredito) > 0)
                    {
                        dgvDatos.Rows[e.RowIndex].Cells["dtDebito"].Value = "0,00";
                    }
                    break;

                case 3:
                    busGrilla = true;
                    if (dgvDatos.Rows[e.RowIndex].Cells["dtCuenta"].Value != null)
                    {
                        buscarCuenta(dgvDatos.Rows[e.RowIndex].Cells["dtCuenta"].Value.ToString());
                    }
                    else
                    {
                        FrmSelCuentas frmSC = new FrmSelCuentas();
                        frmSC.ShowDialog(this);
                    }
                    break;

                case 4:
                    string sBase = (string)dgvDatos.Rows[e.RowIndex].Cells["dtBase"].Value;
                    if (string.IsNullOrEmpty(sBase) || sBase == ",")
                    {
                        sBase = "0";
                    }
                    dgvDatos.Rows[e.RowIndex].Cells["dtBase"].Value = UtilSystem.fMoneda(Math.Round(Convert.ToDouble(sBase), 2));
                    break;

                case 5:

                    string sDias = (string)dgvDatos.Rows[e.RowIndex].Cells["dtDvmto"].Value ?? "0";
                    if (string.IsNullOrEmpty(sDias))
                    {
                        sDias = "0";
                    }
                    int      dias  = Convert.ToInt16(sDias);
                    DateTime fecha = Convert.ToDateTime(txtDia.Text + txtFecha.Text);
                    dgvDatos.Rows[e.RowIndex].Cells["dtFecha"].Value = fecha.AddDays(dias).ToShortDateString();
                    MessageBox.Show(dgvDatos.Rows[e.RowIndex].Cells["dtFecha"].Value.ToString());
                    break;

                case 6:
                    try {
                        DateTime Fecha = DateTime.Parse(dgvDatos.Rows[e.RowIndex].Cells["dtFecha"].Value.ToString());
                    } catch (Exception) {
                        MessageBox.Show("Error al digitar la fecha de vencimiento, Verifique el formato (DD/MM/AAAA)", "SAE Control de Errores", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        dgvDatos.Rows[e.RowIndex].Cells["dtFecha"].Value = "00/00/0000";
                    }
                    break;

                case 7:
                    busGrilla = true;
                    if (dgvDatos.Rows[e.RowIndex].Cells["dtNit"].Value != null)
                    {
                        buscarNit(dgvDatos.Rows[e.RowIndex].Cells["dtNit"].Value.ToString());
                    }
                    else
                    {
                        FrmSelTercero frmT = new FrmSelTercero();
                        frmT.tipo = "PROVEEDOR";
                        frmT.ShowDialog(this);
                    }
                    break;

                case 8:
                    busGrilla = true;
                    if (dgvDatos.Rows[e.RowIndex].Cells["dtCentro"].Value != null)
                    {
                        buscarCCosto(dgvDatos.Rows[e.RowIndex].Cells["dtCentro"].Value.ToString());
                    }
                    else
                    {
                        FrmSelCentroCostos frmSCC = new FrmSelCentroCostos();
                        frmSCC.ShowDialog(this);
                    }
                    break;
                }
            }
            sacarCuenta();
        }