public void TraerRegistro(int n_IdRegistro) { DataTable dtResult = new DataTable(); DataTable dtCargoCab = new DataTable(); DataTable dtCargoDet = new DataTable(); int n_row = 0; if (miFun.TraerRegistro(n_IdRegistro) == true) { dtListar = miFun.dtListar; dtCargoCab = miFun.dtCargoCab; dtCargoDet = miFun.dtCargoDet; if (dtListar.Rows.Count != 0) { e_Cargos.n_idemp = Convert.ToInt32(dtListar.Rows[0]["n_idemp"]); e_Cargos.n_id = Convert.ToInt32(dtListar.Rows[0]["n_id"]); e_Cargos.n_idano = Convert.ToInt32(dtListar.Rows[0]["n_idano"]); e_Cargos.n_idmes = Convert.ToInt32(dtListar.Rows[0]["n_idmes"]); e_Cargos.n_idpla = Convert.ToInt32(dtListar.Rows[0]["n_idpla"]); e_Cargos.d_fchemi = Convert.ToDateTime(dtListar.Rows[0]["d_fchemi"]); e_Cargos.n_impbru = Convert.ToDouble(dtListar.Rows[0]["n_impbru"]); e_Cargos.n_impigv = Convert.ToDouble(dtListar.Rows[0]["n_impigv"]); e_Cargos.n_imptot = Convert.ToDouble(dtListar.Rows[0]["n_imptot"]); e_Cargos.n_numrec = Convert.ToInt32(dtListar.Rows[0]["n_numrec"]); e_Cargos.d_fchini = Convert.ToDateTime(dtListar.Rows[0]["d_fchini"]); e_Cargos.c_obs = fungen.NulosC(dtListar.Rows[0]["c_obs"]); } if (dtCargoCab.Rows.Count != 0) { for (n_row = 0; n_row <= dtCargoCab.Rows.Count - 1; n_row++) { BE_EST_CARGOSCAB e_CargosCab = new BE_EST_CARGOSCAB(); e_CargosCab.n_idemp = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idemp"]); e_CargosCab.n_idcar = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idcar"]); e_CargosCab.n_id = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_id"]); e_CargosCab.n_idpla = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idpla"]); e_CargosCab.n_idtipdoc = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idtipdoc"]); e_CargosCab.c_numser = dtCargoCab.Rows[n_row]["c_numser"].ToString(); e_CargosCab.c_numdoc = dtCargoCab.Rows[n_row]["c_numdoc"].ToString(); e_CargosCab.d_fchemi = Convert.ToDateTime(dtCargoCab.Rows[n_row]["d_fchemi"]); e_CargosCab.n_idcli = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idcli"]); e_CargosCab.n_impbru = Convert.ToDouble(dtCargoCab.Rows[n_row]["n_impbru"]); e_CargosCab.n_impigv = Convert.ToDouble(dtCargoCab.Rows[n_row]["n_impigv"]); e_CargosCab.n_imptot = Convert.ToDouble(dtCargoCab.Rows[n_row]["n_imptot"]); e_CargosCab.n_impsal = Convert.ToDouble(dtCargoCab.Rows[n_row]["n_impsal"]); e_CargosCab.n_idtipdocfac = Convert.ToInt32(dtCargoCab.Rows[n_row]["n_idtipdocfac"]); l_CargosCab.Add(e_CargosCab); } } if (dtCargoDet.Rows.Count != 0) { for (n_row = 0; n_row <= dtCargoDet.Rows.Count - 1; n_row++) { BE_EST_CARGOSDET e_CargosDet = new BE_EST_CARGOSDET(); e_CargosDet.n_idcar = Convert.ToInt32(dtCargoDet.Rows[n_row]["n_idcar"]); e_CargosDet.n_idcab = Convert.ToInt32(dtCargoDet.Rows[n_row]["n_idcab"]); e_CargosDet.n_idser = Convert.ToInt32(dtCargoDet.Rows[n_row]["n_idser"]); e_CargosDet.n_idunimed = Convert.ToInt32(dtCargoDet.Rows[n_row]["n_idunimed"]); e_CargosDet.n_impbru = Convert.ToDouble(dtCargoDet.Rows[n_row]["n_impbru"]); e_CargosDet.n_impigv = Convert.ToDouble(dtCargoDet.Rows[n_row]["n_impigv"]); e_CargosDet.n_imptot = Convert.ToDouble(dtCargoDet.Rows[n_row]["n_imptot"]); l_CargosDet.Add(e_CargosDet); } } } else { b_OcurrioError = miFun.b_OcurrioError; c_ErrorMensaje = miFun.c_ErrorMensaje; n_ErrorNumber = miFun.n_ErrorNumber; } return; }
void AsignarEntidad() { int n_id = 0; int n_row = 0; string c_dato = ""; l_carcab.Clear(); l_cardet.Clear(); if (n_QueHace == 1) { n_id = 0; } else { n_id = Convert.ToInt16(DgLista.Columns[0].CellValue(DgLista.Row).ToString()); } BE_Registro.n_idemp = STU_SISTEMA.EMPRESAID; BE_Registro.n_id = n_id; BE_Registro.n_idpla = Convert.ToInt16(CboPla.SelectedValue); BE_Registro.n_idano = STU_SISTEMA.ANOTRABAJO; BE_Registro.n_idmes = STU_SISTEMA.MESTRABAJO; BE_Registro.d_fchemi = Convert.ToDateTime(TxtFchEmi.Text); BE_Registro.d_fchini = Convert.ToDateTime(TxtFchIni.Text); BE_Registro.n_impbru = Convert.ToDouble(TxtImpBru.Text); BE_Registro.n_impigv = Convert.ToDouble(txtImpIgv.Text); BE_Registro.n_imptot = Convert.ToDouble(TxtImpTot.Text); BE_Registro.n_numrec = FgPlacas.Rows.Count - 2; BE_Registro.c_obs = TxtObs.Text; for (n_row = 2; n_row <= FgPlacas.Rows.Count - 1; n_row++) { BE_EST_CARGOSCAB e_carcab = new BE_EST_CARGOSCAB(); e_carcab.n_idemp = STU_SISTEMA.EMPRESAID; e_carcab.n_idcar = n_id; c_dato = FgPlacas.GetData(n_row, 11).ToString(); e_carcab.n_id = Convert.ToInt16(c_dato); e_carcab.n_idpla = Convert.ToInt16(CboPla.SelectedValue); e_carcab.n_idtipdoc = 83; c_dato = FgPlacas.GetData(n_row, 4).ToString().Substring(0, 4); e_carcab.c_numser = c_dato; c_dato = FgPlacas.GetData(n_row, 4).ToString().Substring(5, 10); e_carcab.c_numdoc = c_dato; e_carcab.d_fchemi = Convert.ToDateTime(TxtFchEmi.Text); c_dato = FgPlacas.GetData(n_row, 8).ToString(); e_carcab.n_idcli = Convert.ToInt16(c_dato); c_dato = FgPlacas.GetData(n_row, 5).ToString(); e_carcab.n_impbru = Convert.ToDouble(c_dato); c_dato = FgPlacas.GetData(n_row, 6).ToString(); e_carcab.n_impigv = Convert.ToDouble(c_dato); c_dato = FgPlacas.GetData(n_row, 7).ToString(); e_carcab.n_imptot = Convert.ToDouble(c_dato); e_carcab.n_impsal = Convert.ToDouble(c_dato); c_dato = FgPlacas.GetData(n_row, 9).ToString(); e_carcab.n_idtipdocfac = Convert.ToInt16(c_dato); l_carcab.Add(e_carcab); } string c_fchcini = ""; string c_fchcfin = ""; DataTable dtres = new DataTable(); for (n_row = 2; n_row <= FgPlacas.Rows.Count - 1; n_row++) { BE_EST_CARGOSDET e_cardet = new BE_EST_CARGOSDET(); c_dato = FgPlacas.GetData(n_row, 8).ToString(); dtres = funDatos.DataTableFiltrar(dtcliente, "n_id = " + c_dato + ""); c_fchcini = Convert.ToDateTime(dtres.Rows[0]["d_fching"]).ToString("dd/MM/yyyy").Substring(0, 2) + "/" + DateTime.Now.Month.ToString("00") + "/" + DateTime.Now.Year.ToString("0000"); if (c_fchcini == "31/11/2018") { c_fchcini = "30/11/2018"; } if (c_fchcini == "31/02/2019") { c_fchcini = "28/02/2019"; } if (c_fchcini == "30/02/2019") { c_fchcini = "28/02/2019"; } if (c_fchcini == "29/02/2019") { c_fchcini = "28/02/2019"; } if (c_fchcini == "31/04/2019") { c_fchcini = "30/04/2019"; } if (c_fchcini == "31/06/2019") { c_fchcini = "30/06/2019"; } if (c_fchcini == "31/09/2019") { c_fchcini = "30/09/2019"; } if (c_fchcini == "31/11/2019") { c_fchcini = "30/11/2019"; } //c_fchcini = Convert.ToDateTime(dtres.Rows[0]["d_fching"]).ToString("dd/MM/yyyy"); c_fchcfin = Convert.ToDateTime(c_fchcini).AddDays(30).ToString("dd/MM/yyyy"); e_cardet.n_idcar = n_id; c_dato = FgPlacas.GetData(n_row, 11).ToString(); e_cardet.n_idcab = Convert.ToInt16(c_dato); c_dato = FgPlacas.GetData(n_row, 10).ToString(); e_cardet.n_idser = Convert.ToInt16(c_dato); c_dato = funDatos.DataTableBuscar(dtSer, "n_id", "n_idunimed", c_dato, "N").ToString(); e_cardet.n_idunimed = Convert.ToInt16(c_dato); c_dato = FgPlacas.GetData(n_row, 5).ToString(); e_cardet.n_impbru = Convert.ToDouble(c_dato); c_dato = FgPlacas.GetData(n_row, 6).ToString(); e_cardet.n_impigv = Convert.ToDouble(c_dato); c_dato = FgPlacas.GetData(n_row, 7).ToString(); e_cardet.n_imptot = Convert.ToDouble(c_dato); e_cardet.c_desser = "CARGO ABONADO DEL: " + c_fchcini + " AL: " + c_fchcfin; l_cardet.Add(e_cardet); } }