public bool modificarDB(fa_proforma_det_Info info) { try { using (Entities_facturacion Context = new Entities_facturacion()) { fa_proforma_det Entity = Context.fa_proforma_det.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdProforma == info.IdProforma).FirstOrDefault(); if (Entity == null) { return(false); } Entity.NumCotizacion = info.NumCotizacion; Entity.NumOPr = info.NumOPr; Entity.IdCentroCosto = info.IdCentroCosto; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] fa_proforma_det_Info info_det) { int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); decimal IdCliente = Convert.ToDecimal(SessionFixed.IdEntidad); int IdNivelDescuento = Convert.ToInt32(SessionFixed.IdNivelDescuento); if (info_det != null && info_det.IdProducto != 0) { var producto = bus_producto.get_info(IdEmpresa, info_det.IdProducto); if (producto != null) { info_det.pr_descripcion = producto.pr_descripcion_combo; } } if (ModelState.IsValid) { List_det.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); } var model = List_det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); cargar_combos_detalle(); return(PartialView("_GridViewPartial_proforma_det", model)); }
private void ver_stock() { try { fa_proforma_det_Info row = (fa_proforma_det_Info)gridView_detalle.GetFocusedRow(); if (row == null) { return; } in_Producto_Info row_producto = row == null ? null : lst_producto.FirstOrDefault(q => q.IdProducto == row.IdProducto); #region Ver lote if (row_producto.IdProducto_padre != null) { if (cmb_punto_venta.EditValue == null) { return; } fa_PuntoVta_Info row_punto_venta = lst_punto_venta.FirstOrDefault(q => q.IdPuntoVta == Convert.ToInt32(cmb_punto_venta.EditValue)); row_producto.IdSucursal = row_punto_venta.IdSucursal; row_producto.IdBodega = Convert.ToInt32(row_punto_venta.IdBodega); FrmIn_producto_asignacion_lote frm = new FrmIn_producto_asignacion_lote(); frm.set_funcion(Cl_Enumeradores.eFuncion_pantalla_lote.SELECCIONAR); frm.set_info(Convert.ToDecimal(row_producto.IdProducto_padre), row_producto.IdSucursal, row_producto.IdBodega); frm.ShowDialog(); if (frm.Result == System.Windows.Forms.DialogResult.OK) { in_producto_lote info_retorno = frm.get_info_retorno(); if (info_retorno == null) { MessageBox.Show("No ha seleccionado ningún lote", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } int cont = lst_producto.Where(q => q.IdProducto == info_retorno.IdProducto).Count(); if (cont == 0) { MessageBox.Show("El producto seleccionado no esta habilitado para facturacion, comuníquese con sistemas", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } row_producto = lst_producto.FirstOrDefault(q => q.IdProducto == info_retorno.IdProducto); row.IdProducto = info_retorno.IdProducto == null ? row_producto.IdProducto : Convert.ToDecimal(info_retorno.IdProducto); gridView_detalle.RefreshRow(gridView_detalle.FocusedRowHandle); } } #endregion } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; NameMetodo = NameMetodo + " - " + ex.ToString(); MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public bool modificarDB(fa_proforma_det_Info info) { try { return(odata.modificarDB(info)); } catch (Exception) { throw; } }
public JsonResult GetLineaDetalle(int Secuencia = 0, decimal IdTransaccionSession = 0) { fa_proforma_det_Info lineaF = new fa_proforma_det_Info(); var linea = List_det.get_list(IdTransaccionSession).Where(q => q.Secuencia == Secuencia).FirstOrDefault(); if (linea != null) { lineaF = linea; } return(Json(linea, JsonRequestBehavior.AllowGet)); }
public void UpdateRow(fa_proforma_det_Info info_det, decimal IdTransaccionSession) { fa_proforma_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.Secuencia == info_det.Secuencia).First(); edited_info.IdProducto = info_det.IdProducto; edited_info.pr_descripcion = info_det.pr_descripcion; edited_info.pd_cantidad = info_det.pd_cantidad; edited_info.pd_por_descuento_uni = info_det.pd_por_descuento_uni; edited_info.pd_precio = info_det.pd_precio; edited_info.pd_descuento_uni = info_det.pd_precio * (info_det.pd_por_descuento_uni / 100); edited_info.pd_precio_final = info_det.pd_precio - edited_info.pd_descuento_uni; edited_info.pd_subtotal = info_det.pd_cantidad * edited_info.pd_precio_final; edited_info.pd_DetalleAdicional = info_det.pd_DetalleAdicional; edited_info.IdCod_Impuesto = info_det.IdCod_Impuesto; if (!string.IsNullOrEmpty(info_det.IdCod_Impuesto)) { var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto); if (impuesto != null) { edited_info.pd_por_iva = impuesto.porcentaje; } } edited_info.pd_iva = edited_info.pd_subtotal * (edited_info.pd_por_iva / 100); edited_info.pd_total = edited_info.pd_subtotal + edited_info.pd_iva; edited_info.NumCotizacion = info_det.NumCotizacion; edited_info.NumOPr = info_det.NumOPr; edited_info.pd_subtotal_item = info_det.pd_cantidad * edited_info.pd_precio_final; edited_info.pd_iva_item = edited_info.pd_subtotal * (edited_info.pd_por_iva / 100); edited_info.pd_total_item = edited_info.pd_subtotal + edited_info.pd_iva; #region Centro de costo edited_info.IdCentroCosto = info_det.IdCentroCosto; if (string.IsNullOrEmpty(info_det.IdCentroCosto)) { edited_info.cc_Descripcion = string.Empty; } else { var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto); if (cc != null) { edited_info.cc_Descripcion = cc.cc_Descripcion; } } #endregion }
public void AddRow(fa_proforma_det_Info info_det, decimal IdTransaccionSession) { List <fa_proforma_det_Info> list = get_list(IdTransaccionSession); info_det.Secuencia = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1; info_det.IdProducto = info_det.IdProducto; info_det.pr_descripcion = info_det.pr_descripcion; info_det.pd_descuento_uni = info_det.pd_precio * (info_det.pd_por_descuento_uni / 100); info_det.pd_precio_final = info_det.pd_precio - info_det.pd_descuento_uni; info_det.pd_subtotal = info_det.pd_cantidad * info_det.pd_precio_final; var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto); if (impuesto != null) { info_det.pd_por_iva = impuesto.porcentaje; } info_det.pd_iva = info_det.pd_subtotal * (info_det.pd_por_iva / 100); info_det.pd_total = info_det.pd_subtotal + info_det.pd_iva; info_det.pd_subtotal_item = info_det.pd_subtotal; info_det.pd_iva_item = info_det.pd_iva; info_det.pd_total_item = info_det.pd_total; #region Centro de costo info_det.IdCentroCosto = info_det.IdCentroCosto; if (string.IsNullOrEmpty(info_det.IdCentroCosto)) { info_det.cc_Descripcion = string.Empty; } else { var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto); if (cc != null) { info_det.cc_Descripcion = cc.cc_Descripcion; } } #endregion list.Add(info_det); }
public void AddRow(fa_proforma_det_Info info_det, decimal IdTransaccionSession) { List <fa_proforma_det_Info> list = get_list(IdTransaccionSession); info_det.Secuencia = list.Count == 0 ? 1 : list.Max(q => q.Secuencia) + 1; info_det.IdProducto = info_det.IdProducto; info_det.pr_descripcion = info_det.pr_descripcion; info_det.pd_descuento_uni = info_det.pd_precio * (info_det.pd_por_descuento_uni / 100); info_det.pd_precio_final = info_det.pd_precio - info_det.pd_descuento_uni; info_det.pd_subtotal = info_det.pd_cantidad * info_det.pd_precio_final; var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto); if (impuesto != null) { info_det.pd_por_iva = impuesto.porcentaje; } info_det.pd_iva = info_det.pd_subtotal * (info_det.pd_por_iva / 100); info_det.pd_total = info_det.pd_subtotal + info_det.pd_iva; list.Add(info_det); }
public void UpdateRowFact(fa_proforma_fact_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); fa_proforma_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.Secuencia == info_det.Secuencia).First(); var producto = bus_producto.get_info(IdEmpresa, edited_info.IdProducto); if (producto != null) { edited_info.pr_descripcion = producto.pr_descripcion; } if (!string.IsNullOrEmpty(edited_info.IdCod_Impuesto)) { var impuesto = bus_impuesto.get_info(edited_info.IdCod_Impuesto); if (impuesto != null) { edited_info.pd_por_iva = impuesto.porcentaje; } } edited_info.NumCotizacion = info_det.NumCotizacion; edited_info.NumOPr = info_det.NumOPr; #region Centro de costo edited_info.IdCentroCosto = info_det.IdCentroCosto; if (string.IsNullOrEmpty(info_det.IdCentroCosto)) { edited_info.cc_Descripcion = string.Empty; } else { var cc = bus_cc.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCentroCosto); if (cc != null) { edited_info.cc_Descripcion = cc.cc_Descripcion; } } #endregion }
public ActionResult EditingAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] fa_proforma_det_Info info_det) { int IdEmpresa = Convert.ToInt32(Session["IdEmpresa"]); decimal IdCliente = Convert.ToDecimal(SessionFixed.IdEntidad); int IdNivelDescuento = Convert.ToInt32(SessionFixed.IdNivelDescuento); if (info_det != null && info_det.IdProducto != 0) { var producto = bus_producto.get_info(IdEmpresa, info_det.IdProducto); if (producto != null) { info_det.pr_descripcion = producto.pr_descripcion_combo; info_det.IdCod_Impuesto = producto.IdCod_Impuesto_Iva; var cliente = bus_cliente.get_info(IdEmpresa, IdCliente); if (cliente != null) { info_det.pd_precio = producto.precio_1; int nivel_precio = IdNivelDescuento > 1 ? IdNivelDescuento : (cliente.IdNivel == 0 ? 1 : cliente.IdNivel); var nivelproducto = bus_nivelproducto.GetInfo(IdEmpresa, producto.IdProducto, nivel_precio); if (SessionFixed.EsSuperAdmin == "False") { info_det.pd_por_descuento_uni = nivelproducto == null ? 0 : nivelproducto.Porcentaje; } else { info_det.pd_por_descuento_uni = IdNivelDescuento > 1 ? (nivelproducto == null ? 0 : nivelproducto.Porcentaje) : info_det.pd_por_descuento_uni; } } } } List_det.AddRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); var model = List_det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); cargar_combos_detalle(); return(PartialView("_GridViewPartial_proforma_det", model)); }
public void UpdateRow(fa_proforma_det_Info info_det, decimal IdTransaccionSession) { fa_proforma_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.Secuencia == info_det.Secuencia).First(); edited_info.IdProducto = info_det.IdProducto; edited_info.pr_descripcion = info_det.pr_descripcion; edited_info.pd_cantidad = info_det.pd_cantidad; edited_info.pd_por_descuento_uni = info_det.pd_por_descuento_uni; edited_info.pd_precio = info_det.pd_precio; edited_info.pd_descuento_uni = info_det.pd_precio * (info_det.pd_por_descuento_uni / 100); edited_info.pd_precio_final = info_det.pd_precio - edited_info.pd_descuento_uni; edited_info.pd_subtotal = info_det.pd_cantidad * edited_info.pd_precio_final; if (!string.IsNullOrEmpty(info_det.IdCod_Impuesto) && info_det.IdCod_Impuesto != edited_info.IdCod_Impuesto) { var impuesto = bus_impuesto.get_info(info_det.IdCod_Impuesto); if (impuesto != null) { edited_info.pd_por_iva = impuesto.porcentaje; } } edited_info.pd_iva = edited_info.pd_subtotal * (edited_info.pd_por_iva / 100); edited_info.pd_total = edited_info.pd_subtotal + edited_info.pd_iva; }
private void gridView_detalle_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { fa_proforma_det_Info row = (fa_proforma_det_Info)gridView_detalle.GetRow(e.RowHandle); if (row == null) { return; } if (e.Column == col_checked) { if (row.pd_checked) { row.pd_cantidad_aprobada = row.pd_cantidad_pendiente; } else { row.pd_cantidad_aprobada = 0; } row.pd_descuento_uni = Math.Round((row.pd_precio * row.pd_por_descuento_uni) / 100, 2, MidpointRounding.AwayFromZero); row.pd_precio_final = row.pd_precio - row.pd_descuento_uni; row.pd_subtotal = row.pd_cantidad_aprobada * row.pd_precio_final; row.pd_iva = Math.Round(Convert.ToDouble(row.pd_subtotal * (row.pd_por_iva / 100)), 2, MidpointRounding.AwayFromZero); row.pd_total = row.pd_subtotal + row.pd_iva; if (cmb_termino_pago.EditValue != null) { fa_TerminoPago_Info Info_TerminoPago = new fa_TerminoPago_Info(); Info_TerminoPago = lst_termino_pago.Where(q => q.IdTerminoPago == Convert.ToString(cmb_termino_pago.EditValue)).FirstOrDefault(); if (Info_TerminoPago.Num_Cuotas > 0) { crear_cuotas(Info_TerminoPago.IdTerminoPago); } } } if (e.Column == col_can_aprobada) { if (row.pd_cantidad == 0) { row.pd_checked = false; } else { row.pd_checked = true; } row.pd_descuento_uni = Math.Round((row.pd_precio * row.pd_por_descuento_uni) / 100, 2, MidpointRounding.AwayFromZero); row.pd_precio_final = row.pd_precio - row.pd_descuento_uni; row.pd_subtotal = row.pd_cantidad_aprobada * row.pd_precio_final; row.pd_iva = Math.Round(Convert.ToDouble(row.pd_subtotal * (row.pd_por_iva / 100)), 2, MidpointRounding.AwayFromZero); row.pd_total = row.pd_subtotal + row.pd_iva; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridView_detalle_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { fa_proforma_det_Info row = (fa_proforma_det_Info)gridView_detalle.GetRow(e.RowHandle); if (row == null) { return; } if (e.Column == col_IdProducto) { in_Producto_Info row_producto = lst_producto.FirstOrDefault(q => q.IdProducto == row.IdProducto); if (row_producto == null) { return; } #region Ver lote if (row_producto.IdProducto_padre != null) { row_producto.IdSucursal = Convert.ToInt32(cmb_sucursal.EditValue); row_producto.IdBodega = Convert.ToInt32(cmb_bodega.EditValue); FrmIn_producto_asignacion_lote frm = new FrmIn_producto_asignacion_lote(); frm.set_funcion(Cl_Enumeradores.eFuncion_pantalla_lote.SELECCIONAR); frm.set_info(Convert.ToDecimal(row_producto.IdProducto_padre), row_producto.IdSucursal, row_producto.IdBodega); frm.ShowDialog(); if (frm.Result == System.Windows.Forms.DialogResult.OK) { in_producto_lote info_retorno = frm.get_info_retorno(); if (info_retorno == null) { MessageBox.Show("No ha seleccionado ningún lote", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } agregar_producto_en_combo(info_retorno.IdProducto == null ? 0 : Convert.ToDecimal(info_retorno.IdProducto)); int cont = lst_producto.Where(q => q.IdProducto == info_retorno.IdProducto).Count(); if (cont == 0) { MessageBox.Show("El producto seleccionado no esta habilitado para facturacion, comuníquese con sistemas", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } row_producto = lst_producto.FirstOrDefault(q => q.IdProducto == info_retorno.IdProducto); row.IdProducto = info_retorno.IdProducto == null ? row_producto.IdProducto : Convert.ToDecimal(info_retorno.IdProducto); } } #endregion int nivel_precio = (cmb_cliente.get_ClienteInfo().NivelPrecio == null || cmb_cliente.get_ClienteInfo().NivelPrecio == 0) ? 1 : Convert.ToInt32(cmb_cliente.get_ClienteInfo().NivelPrecio); switch (nivel_precio) { case 1: row.pd_precio = row_producto.precio_1 == null ? 0 : Convert.ToDouble(row_producto.precio_1); break; case 2: row.pd_precio = row_producto.precio_2 == null ? (row.pd_precio = row_producto.precio_1 == null ? 0 : Convert.ToDouble(row_producto.precio_1)) : Convert.ToDouble(row_producto.precio_2); break; case 3: row.pd_precio = row_producto.precio_3 == null ? (row.pd_precio = row_producto.precio_1 == null ? 0 : Convert.ToDouble(row_producto.precio_1)) : Convert.ToDouble(row_producto.precio_3); break; case 4: row.pd_precio = row_producto.precio_4 == null ? (row.pd_precio = row_producto.precio_1 == null ? 0 : Convert.ToDouble(row_producto.precio_1)) : Convert.ToDouble(row_producto.precio_4); break; case 5: row.pd_precio = row_producto.precio_5 == null ? (row.pd_precio = row_producto.precio_1 == null ? 0 : Convert.ToDouble(row_producto.precio_1)) : Convert.ToDouble(row_producto.precio_5); break; } row.IdCod_Impuesto = row_producto.IdCod_Impuesto_Iva; tb_sis_impuesto_Info row_impuesto = lst_impuesto.FirstOrDefault(q => q.IdCod_Impuesto == row.IdCod_Impuesto); if (row_impuesto != null) { row.pd_por_iva = row_impuesto.porcentaje; } } if (e.Column == col_cantidad || e.Column == col_precio || e.Column == col_por_descuento) { row.pd_descuento_uni = Math.Round((row.pd_precio * row.pd_por_descuento_uni) / 100, 2, MidpointRounding.AwayFromZero); row.pd_precio_final = row.pd_precio - row.pd_descuento_uni; row.pd_subtotal = row.pd_cantidad * row.pd_precio_final; row.pd_iva = Math.Round(Convert.ToDouble(row.pd_subtotal * (row.pd_por_iva / 100)), 2, MidpointRounding.AwayFromZero); row.pd_total = row.pd_subtotal + row.pd_iva; } if (e.Column == col_impuesto) { tb_sis_impuesto_Info row_impuesto = lst_impuesto.FirstOrDefault(q => q.IdCod_Impuesto == row.IdCod_Impuesto); if (row_impuesto != null) { row.pd_por_iva = row_impuesto.porcentaje; } row.pd_iva = Math.Round(Convert.ToDouble(row.pd_subtotal * (row.pd_por_iva / 100)), 2, MidpointRounding.AwayFromZero); row.pd_total = row.pd_subtotal + row.pd_iva; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] fa_proforma_det_Info info_det) { int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); decimal IdCliente = Convert.ToDecimal(SessionFixed.IdEntidad); if (info_det != null && info_det.IdProducto != 0 && IdCliente > 0) { var producto = bus_producto.get_info(IdEmpresa, info_det.IdProducto); if (producto != null) { info_det.pr_descripcion = producto.pr_descripcion_combo; var cliente = bus_cliente.get_info(IdEmpresa, IdCliente); if (cliente != null) { int nivel_precio = (cliente.NivelPrecio == null || cliente.NivelPrecio == 0) ? 1 : Convert.ToInt32(cliente.NivelPrecio); switch (nivel_precio) { case 1: info_det.pd_precio = producto.precio_1; break; case 2: if (producto.signo_2 == "+") { info_det.pd_precio = producto.precio_2 == 0 ? producto.precio_1 : producto.precio_2; info_det.pd_por_descuento_uni = 0; } else { info_det.pd_precio = producto.precio_1; info_det.pd_por_descuento_uni = producto.porcentaje_2; } break; case 3: if (producto.signo_3 == "+") { info_det.pd_precio = producto.precio_3 == 0 ? producto.precio_1 : producto.precio_3; info_det.pd_por_descuento_uni = 0; } else { info_det.pd_precio = producto.precio_1; info_det.pd_por_descuento_uni = producto.porcentaje_3; } break; case 4: if (producto.signo_4 == "+") { info_det.pd_precio = producto.precio_4 == 0 ? producto.precio_1 : producto.precio_4; info_det.pd_por_descuento_uni = 0; } else { info_det.pd_precio = producto.precio_1; info_det.pd_por_descuento_uni = producto.porcentaje_4; } break; case 5: if (producto.signo_5 == "+") { info_det.pd_precio = producto.precio_5 == 0 ? producto.precio_1 : producto.precio_5; info_det.pd_por_descuento_uni = 0; } else { info_det.pd_precio = producto.precio_1; info_det.pd_por_descuento_uni = producto.porcentaje_5; } break; } } } } List_det.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); var model = List_det.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); cargar_combos_detalle(); return(PartialView("_GridViewPartial_proforma_det", model)); }