private void cargar_tiponota_check(int IdEmpresa, int[] intTipoArray) { fa_TipoNota_Bus bus_nota = new fa_TipoNota_Bus(); var lst_nota = bus_nota.get_list(IdEmpresa, false); if (intTipoArray == null || intTipoArray.Count() == 0) { } else { foreach (var item in lst_nota) { item.Seleccionado = (intTipoArray.Where(q => q == item.IdTipoNota).Count() > 0 ? true : false); } } ViewBag.lst_nota = lst_nota; }
Boolean guardarDatos() { try { Boolean bolReult = false; fa_TipoNota_Bus bus_tiponota = new fa_TipoNota_Bus(); int id = 0; string msg = ""; if (validarDatos()) { get_TipoNota(); switch (_Accion) { case Cl_Enumeradores.eTipo_action.grabar: if (bus_tiponota.GrabarDB(info, ref id, ref msg)) { bolReult = true; // MessageBox.Show("Registro guardado exitosamente", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); lbl_id_tipo_nota.Text = Convert.ToString(id); string smensaje = string.Format(Core.Erp.Recursos.Properties.Resources.msgDespues_Grabar, "El tipo de Nota", id); MessageBox.Show(smensaje, param.Nombre_sistema); //ucGe_Menu.Visible_btnGuardar = false; //ucGe_Menu.Visible_bntGuardar_y_Salir = false; LimpiarDatos(); } else { MessageBox.Show("Error " + msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case Cl_Enumeradores.eTipo_action.actualizar: if (bus_tiponota.ModificarDB(info, ref msg)) { bolReult = true; // MessageBox.Show("Registro modificado exitosamente", "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); string smensaje = string.Format(Core.Erp.Recursos.Properties.Resources.msgDespues_Modificar, "El tipo de Nota", info.IdTipoNota); MessageBox.Show(smensaje, param.Nombre_sistema); //ucGe_Menu.Visible_btnGuardar = false; //ucGe_Menu.Visible_bntGuardar_y_Salir = false; LimpiarDatos(); } else { MessageBox.Show("Error " + msg, "SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } return(bolReult); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e) { #region Variables fa_notaCreDeb_List ListaFactura = new fa_notaCreDeb_List(); List <fa_notaCreDeb_Info> Lista_Factura = new List <fa_notaCreDeb_Info>(); fa_cliente_Bus bus_cliente = new fa_cliente_Bus(); fa_cliente_contactos_Bus bus_cliente_contatos = new fa_cliente_contactos_Bus(); tb_sucursal_Bus bus_sucursal = new tb_sucursal_Bus(); fa_parametro_Bus bus_fa_parametro = new fa_parametro_Bus(); fa_TipoNota_Bus bus_tipo_nota = new fa_TipoNota_Bus(); tb_bodega_Bus bus_bodega = new tb_bodega_Bus(); int cont = 0; int IdNota = 1; decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); #endregion Stream stream = new MemoryStream(e.UploadedFile.FileBytes); if (stream.Length > 0) { IExcelDataReader reader = null; reader = ExcelReaderFactory.CreateOpenXmlReader(stream); #region Saldo Fact var info_fa_parametro = bus_fa_parametro.get_info(IdEmpresa); var IdTipoNota = 12; //default var infoTipoNota = bus_tipo_nota.get_info(IdEmpresa, IdTipoNota); var CodDocumentoTipo = "NTDB"; var IdPuntoVta = 7; while (reader.Read()) { if (!reader.IsDBNull(0) && cont > 0) { var Su_CodigoEstablecimiento = Convert.ToString(reader.GetValue(0)).Trim(); var lst_sucursal = bus_sucursal.get_list(IdEmpresa, false); var IdSucursal = lst_sucursal.Where(q => q.Su_CodigoEstablecimiento == Su_CodigoEstablecimiento).FirstOrDefault().IdSucursal; var InfoCliente = bus_cliente.get_info_x_num_cedula(IdEmpresa, Convert.ToString(reader.GetValue(1))); var infoBodega = bus_bodega.get_info(IdEmpresa, IdSucursal, 1); if (InfoCliente != null && InfoCliente.IdCliente != 0) { //var InfoContactosCliente = bus_cliente_contatos.get_list(IdEmpresa, InfoCliente.IdCliente); var InfoContactosCliente = bus_cliente_contatos.get_info(IdEmpresa, InfoCliente.IdCliente, 1); fa_notaCreDeb_Info info = new fa_notaCreDeb_Info { IdEmpresa = IdEmpresa, IdSucursal = IdSucursal, IdBodega = infoBodega.IdBodega, IdNota = IdNota++, dev_IdEmpresa = null, dev_IdDev_Inven = null, CodNota = Convert.ToString(reader.GetValue(2)), CreDeb = "D", CodDocumentoTipo = CodDocumentoTipo, Serie1 = null, Serie2 = null, NumNota_Impresa = null, NumAutorizacion = null, Fecha_Autorizacion = null, IdCliente = InfoCliente.IdCliente, no_fecha = Convert.ToDateTime(reader.GetValue(5)), no_fecha_venc = Convert.ToDateTime(reader.GetValue(6)), IdTipoNota = infoTipoNota.IdTipoNota, sc_observacion = Convert.ToString(reader.GetValue(7)) == "" ? ("DOCUMENTO #" + Convert.ToString(reader.GetValue(2)) + " CLIENTE: " + InfoCliente.info_persona.pe_nombreCompleto) : Convert.ToString(reader.GetValue(7)), IdUsuario = SessionFixed.IdUsuario, NaturalezaNota = null, IdCtaCble_TipoNota = infoTipoNota.IdCtaCble, IdPuntoVta = IdPuntoVta, aprobada_enviar_sri = false }; info.lst_det = new List <fa_notaCreDeb_det_Info>(); info.lst_cruce = new List <fa_notaCreDeb_x_fa_factura_NotaDeb_Info>(); fa_notaCreDeb_det_Info info_detalle = new fa_notaCreDeb_det_Info { IdEmpresa = IdEmpresa, IdSucursal = IdSucursal, IdBodega = info.IdBodega, IdNota = info.IdNota, IdProducto = 1, sc_cantidad = 1, sc_Precio = Convert.ToDouble(reader.GetValue(4)), sc_descUni = 0, sc_PordescUni = 0, sc_precioFinal = Convert.ToDouble(reader.GetValue(4)), sc_subtotal = Convert.ToDouble(reader.GetValue(4)), sc_iva = 0, sc_total = Convert.ToDouble(reader.GetValue(4)), sc_costo = 0, sc_observacion = Convert.ToString(reader.GetValue(7)), vt_por_iva = 0, IdPunto_Cargo = null, IdPunto_cargo_grupo = null, IdCod_Impuesto_Iva = "IVA0", IdCentroCosto = null, sc_cantidad_factura = null }; info.lst_det.Add(info_detalle); Lista_Factura.Add(info); } } else { cont++; } } ListaFactura.set_list(Lista_Factura, IdTransaccionSession); #endregion } }