public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ct_cbtecble_det_Info info_det) { decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); if (ModelState.IsValid) { comprobante_contable_fp.UpdateRow(info_det, IdTransaccionSession); } ct_cbtecble_Info model = new ct_cbtecble_Info(); model.lst_ct_cbtecble_det = comprobante_contable_fp.get_list(IdTransaccionSession); cargar_combos_detalle(); return(PartialView("_GridViewPartial_orden_pago_dc", model)); }
public void AddRow(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = string.IsNullOrEmpty(SessionFixed.IdEmpresa) ? 0 : Convert.ToInt32(SessionFixed.IdEmpresa); List <ct_cbtecble_det_Info> list = get_list(IdTransaccionSession); info_det.secuencia = list.Count == 0 ? 1 : list.Max(q => q.secuencia) + 1; info_det.dc_Valor = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1; if (info_det.IdCtaCble != null) { var cta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble); if (cta != null) { info_det.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta; } } #region Centro de costo 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 #region Punto de cargo if (info_det.IdPunto_cargo == null || info_det.IdPunto_cargo == 0) { info_det.nom_punto_cargo = string.Empty; } else { var pc = bus_pc.GetInfo(Convert.ToInt32(SessionFixed.IdEmpresa), Convert.ToInt32(info_det.IdPunto_cargo)); if (pc != null) { info_det.nom_punto_cargo = pc.nom_punto_cargo; } } #endregion list.Add(info_det); }
public void delete_detail_New_details(cp_proveedor_Info info_proveedor, cp_parametros_Info info_parametro, double cn_subtotal_iva = 0, double cn_subtotal_siniva = 0, double cn_valoriva = 0, double cn_total = 0, string observacion = "", decimal IdTransaccionSession = 0) { try { list_ct_cbtecble_det.set_list(new List <ct_cbtecble_det_Info>(), IdTransaccionSession); // cuenta total ct_cbtecble_det_Info cbtecble_det_total_Info = new ct_cbtecble_det_Info(); cbtecble_det_total_Info.secuencia = 3; cbtecble_det_total_Info.IdEmpresa = 0; cbtecble_det_total_Info.IdTipoCbte = 1; cbtecble_det_total_Info.IdCtaCble = info_proveedor.IdCtaCble_CXP; cbtecble_det_total_Info.dc_Valor_haber = cn_total; cbtecble_det_total_Info.dc_Valor = cn_total * -1; cbtecble_det_total_Info.dc_Observacion = observacion; list_ct_cbtecble_det.AddRow(cbtecble_det_total_Info, IdTransaccionSession); if (cn_subtotal_iva > 0) { // cuenta iva ct_cbtecble_det_Info cbtecble_det_iva_Info = new ct_cbtecble_det_Info(); cbtecble_det_iva_Info.secuencia = 2; cbtecble_det_iva_Info.IdEmpresa = 0; cbtecble_det_iva_Info.IdTipoCbte = 1; cbtecble_det_iva_Info.IdCtaCble = info_parametro.pa_ctacble_iva; cbtecble_det_iva_Info.dc_Valor_debe = cn_valoriva; cbtecble_det_iva_Info.dc_Valor = cn_valoriva; cbtecble_det_iva_Info.dc_Observacion = observacion; list_ct_cbtecble_det.AddRow(cbtecble_det_iva_Info, IdTransaccionSession); } // cuenta sbtotal ct_cbtecble_det_Info cbtecble_det_sub_Info = new ct_cbtecble_det_Info(); cbtecble_det_sub_Info.secuencia = 1; cbtecble_det_sub_Info.IdEmpresa = 0; cbtecble_det_sub_Info.IdTipoCbte = 1; cbtecble_det_sub_Info.IdCtaCble = null; cbtecble_det_sub_Info.dc_Valor_debe = cn_subtotal_iva + cn_subtotal_siniva; cbtecble_det_sub_Info.dc_Valor = cn_subtotal_iva + cn_subtotal_siniva; cbtecble_det_sub_Info.dc_Observacion = observacion; list_ct_cbtecble_det.AddRow(cbtecble_det_sub_Info, IdTransaccionSession); } catch (Exception) { throw; } }
public void UpdateRow_prov(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { var ls = get_list(IdTransaccionSession); ct_plancta_Bus bus_plancta = new ct_plancta_Bus(); var cta = bus_plancta.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCtaCble); ct_cbtecble_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.secuencia == info_det.secuencia).First(); if (cta != null) { info_det.IdCtaCble = cta.IdCtaCble; info_det.pc_Cuenta = cta.pc_Cuenta; } edited_info.pc_Cuenta = info_det.pc_Cuenta; edited_info.IdCtaCble = info_det.IdCtaCble; }
public void delete_detail_New_details(cp_proveedor_Info info_proveedor, cp_parametros_Info info_parametro, double cn_subtotal_iva = 0, double cn_subtotal_siniva = 0, double cn_valoriva = 0, double cn_total = 0, string observacion = "") { try { HttpContext.Current.Session["ct_cbtecble_det_Info" + Convert.ToString(SessionFixed.IdTransaccionSessionActual)] = null; // cuenta total ct_cbtecble_det_Info cbtecble_det_total_Info = new ct_cbtecble_det_Info(); cbtecble_det_total_Info.secuencia = 3; cbtecble_det_total_Info.IdEmpresa = 0; cbtecble_det_total_Info.IdTipoCbte = 1; cbtecble_det_total_Info.IdCtaCble = info_proveedor.IdCtaCble_CXP; cbtecble_det_total_Info.dc_Valor_debe = cn_total; cbtecble_det_total_Info.dc_Valor = cn_total * -1; cbtecble_det_total_Info.dc_Observacion = observacion; AddRow(cbtecble_det_total_Info, Convert.ToDecimal(SessionFixed.IdTransaccionSession)); // cuenta iva ct_cbtecble_det_Info cbtecble_det_iva_Info = new ct_cbtecble_det_Info(); cbtecble_det_iva_Info.secuencia = 2; cbtecble_det_iva_Info.IdEmpresa = 0; cbtecble_det_iva_Info.IdTipoCbte = 1; cbtecble_det_iva_Info.IdCtaCble = info_parametro.pa_ctacble_iva; cbtecble_det_iva_Info.dc_Valor_haber = cn_valoriva; cbtecble_det_iva_Info.dc_Valor = cn_valoriva; cbtecble_det_iva_Info.dc_Observacion = observacion; AddRow(cbtecble_det_iva_Info, Convert.ToDecimal(SessionFixed.IdTransaccionSession)); // cuenta sbtotal ct_cbtecble_det_Info cbtecble_det_sub_Info = new ct_cbtecble_det_Info(); cbtecble_det_sub_Info.secuencia = 1; cbtecble_det_sub_Info.IdEmpresa = 0; cbtecble_det_sub_Info.IdTipoCbte = 1; cbtecble_det_sub_Info.IdCtaCble = info_parametro.pa_ctacble_deudora; cbtecble_det_sub_Info.dc_Valor_haber = cn_subtotal_iva + cn_subtotal_siniva; cbtecble_det_sub_Info.dc_Valor = cn_subtotal_iva + cn_subtotal_siniva; cbtecble_det_sub_Info.dc_Observacion = observacion; AddRow(cbtecble_det_sub_Info, Convert.ToDecimal(SessionFixed.IdTransaccionSession)); } catch (Exception) { throw; } }
public void AddRow(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); List <ct_cbtecble_det_Info> list = get_list(IdTransaccionSession); info_det.secuencia = list.Count == 0 ? 1 : list.Max(q => q.secuencia) + 1; info_det.dc_Valor = Math.Round((info_det.dc_Valor_debe), 2) > 0 ? Math.Round((info_det.dc_Valor_debe), 2) : Math.Round((info_det.dc_Valor_haber * -1), 2); if (!string.IsNullOrEmpty(info_det.IdCtaCble)) { var cta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble); if (cta != null) { info_det.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta; } } list.Add(info_det); }
public void UpdateRow(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = string.IsNullOrEmpty(SessionFixed.IdEmpresa) ? 0 : Convert.ToInt32(SessionFixed.IdEmpresa); ct_cbtecble_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.secuencia == info_det.secuencia).First(); edited_info.IdCtaCble = info_det.IdCtaCble; edited_info.dc_para_conciliar = info_det.dc_para_conciliar; edited_info.dc_Valor = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1; edited_info.dc_Valor_debe = info_det.dc_Valor_debe; edited_info.dc_Valor_haber = info_det.dc_Valor_haber; var cta = bus_plancta.get_info(IdEmpresa, edited_info.IdCtaCble); if (cta != null) { info_det.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta; } edited_info.pc_Cuenta = info_det.pc_Cuenta; }
public ActionResult Index(ImportacionDiarios_Info model) { model.ListaTipoDocumento = ImportacionDiarios_Lista.get_list(model.IdTransaccionSession); ct_cbtecble_Info model_comprobante = new ct_cbtecble_Info(); model_comprobante.IdEmpresa = model.IdEmpresa; model_comprobante.IdTipoCbte = model.IdTipoCbte; model_comprobante.IdSucursal = model.IdSucursal; model_comprobante.CodCbteCble = model.Codigo; model_comprobante.cb_Fecha = model.cb_Fecha; model_comprobante.cb_Valor = Convert.ToDouble(model.ListaTipoDocumento.Sum(q => q.dc_ValorDebe)); model_comprobante.cb_Observacion = model.cb_Observacion; model_comprobante.lst_ct_cbtecble_det = new List <ct_cbtecble_det_Info>(); model_comprobante.IdUsuario = SessionFixed.IdUsuario; foreach (var item in model.ListaTipoDocumento) { ct_cbtecble_det_Info lista_det = new ct_cbtecble_det_Info(); lista_det.dc_Valor = Convert.ToDouble(item.dc_Valor); lista_det.dc_Observacion = item.Detalle; lista_det.IdCtaCble = item.IdCtaCble; lista_det.dc_para_conciliar = false; model_comprobante.lst_ct_cbtecble_det.Add(lista_det); } if (!validar(model_comprobante, ref mensaje)) { cargar_filtros(model.IdEmpresa); ViewBag.mensaje = mensaje; return(View(model)); } if (!bus_comprobante.guardarDB(model_comprobante)) { cargar_filtros(model.IdEmpresa); return(View(model)); } bus_ImporacionDiarios.eliminar_x_tipo_doc(model.tipo_documento); return(RedirectToAction("Index")); }
public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] ct_cbtecble_det_Info info_det) { ct_plancta_Bus bus_plancta = new ct_plancta_Bus(); var cta = bus_plancta.get_info(Convert.ToInt32(SessionFixed.IdEmpresa), info_det.IdCtaCble); if (info_det != null) { if (cta != null) { info_det.pc_Cuenta = cta.pc_Cuenta; info_det.IdCtaCble = cta.IdCtaCble; } } if (ModelState.IsValid) { list_det.UpdateRow(info_det, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); } var model = list_det.get_list_cta(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); return(PartialView("_GridViewPartial_sueldo_x_pagar", model)); }
public void delete_detail_New_details(cp_orden_pago_tipo_x_empresa_Info info_param_op, decimal IdEntidad = 0, double Valor_a_pagar = 0, string observacion = "", decimal IdTransaccionSession = 0) { try { set_list(new List <ct_cbtecble_det_Info>(), IdTransaccionSession); if (info_param_op.IdTipoCbte_OP == null) { return; } // cuenta total ct_cbtecble_det_Info cbtecble_debe_Info = new ct_cbtecble_det_Info(); cbtecble_debe_Info.secuencia = 1; cbtecble_debe_Info.IdEmpresa = info_param_op.IdEmpresa; cbtecble_debe_Info.IdTipoCbte = (int)info_param_op.IdTipoCbte_OP; cbtecble_debe_Info.IdCtaCble = info_param_op.IdCtaCble; cbtecble_debe_Info.dc_Valor_debe = Valor_a_pagar; cbtecble_debe_Info.dc_Valor = Valor_a_pagar; cbtecble_debe_Info.dc_Observacion = observacion; AddRow(cbtecble_debe_Info, IdTransaccionSession); // cuenta iva ct_cbtecble_det_Info cbtecble_haber_Info = new ct_cbtecble_det_Info(); cbtecble_haber_Info.secuencia = 2; cbtecble_haber_Info.IdEmpresa = info_param_op.IdEmpresa; cbtecble_debe_Info.IdTipoCbte = (int)info_param_op.IdTipoCbte_OP; cbtecble_haber_Info.IdCtaCble = info_param_op.IdCtaCble_Credito; cbtecble_haber_Info.dc_Valor_haber = Valor_a_pagar; cbtecble_haber_Info.dc_Valor = Valor_a_pagar * -1; cbtecble_haber_Info.dc_Observacion = observacion; AddRow(cbtecble_haber_Info, IdTransaccionSession); } catch (Exception) { throw; } }
public void AddRow(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = string.IsNullOrEmpty(SessionFixed.IdEmpresa) ? 0 : Convert.ToInt32(SessionFixed.IdEmpresa); List <ct_cbtecble_det_Info> list = get_list(IdTransaccionSession); info_det.secuencia = list.Count == 0 ? 1 : list.Max(q => q.secuencia) + 1; info_det.dc_Valor = info_det.dc_Valor_debe > 0 ? info_det.dc_Valor_debe : info_det.dc_Valor_haber * -1; info_det.IdGrupoPresupuesto = info_det.IdGrupoPresupuesto; info_det.Descripcion = info_det.Descripcion; if (info_det.IdCtaCble != null) { var cta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble); if (cta != null) { info_det.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta; } } list.Add(info_det); }
public void delete_detail_New_details(cp_parametros_Info info_param_op, List <cp_retencion_det_Info> detalle_retencion, decimal IdTransaccionSession, string IdCtaCble = "") { try { int sec = 2; set_list(new List <ct_cbtecble_det_Info>(), IdTransaccionSession); ct_cbtecble_det_Info cbtecble_haber_Info = new ct_cbtecble_det_Info(); cbtecble_haber_Info.secuencia = 1; cbtecble_haber_Info.IdEmpresa = info_param_op.IdEmpresa; cbtecble_haber_Info.IdTipoCbte = (int)info_param_op.pa_IdTipoCbte_x_Retencion; cbtecble_haber_Info.IdCtaCble = IdCtaCble; cbtecble_haber_Info.dc_Valor_debe = Math.Round(detalle_retencion.Sum(v => Convert.ToDouble(v.re_valor_retencion)), 2, MidpointRounding.AwayFromZero); cbtecble_haber_Info.dc_Valor = Math.Round(detalle_retencion.Sum(v => Convert.ToDouble(v.re_valor_retencion)), 2, MidpointRounding.AwayFromZero); cbtecble_haber_Info.dc_Observacion = ""; AddRow(cbtecble_haber_Info, IdTransaccionSession); foreach (var item in detalle_retencion) { ct_cbtecble_det_Info cbtecble_debe_Info = new ct_cbtecble_det_Info(); cbtecble_debe_Info.secuencia = sec; cbtecble_debe_Info.IdEmpresa = info_param_op.IdEmpresa; cbtecble_debe_Info.IdTipoCbte = (int)info_param_op.pa_IdTipoCbte_x_Retencion; cbtecble_debe_Info.IdCtaCble = item.IdCtacble; cbtecble_debe_Info.dc_Valor_haber = Math.Round((double)item.re_valor_retencion, 2, MidpointRounding.AwayFromZero); cbtecble_debe_Info.dc_Valor = Math.Round((double)item.re_valor_retencion, 2, MidpointRounding.AwayFromZero) * -1; cbtecble_debe_Info.dc_Observacion = ""; sec++; AddRow(cbtecble_debe_Info, IdTransaccionSession); } } catch (Exception) { throw; } }
public void UpdateRow(ct_cbtecble_det_Info info_det, decimal IdTransaccionSession) { int IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); ct_cbtecble_det_Info edited_info = get_list(IdTransaccionSession).Where(m => m.secuencia == info_det.secuencia).First(); edited_info.IdCtaCble = info_det.IdCtaCble; edited_info.dc_para_conciliar = info_det.dc_para_conciliar; edited_info.dc_Valor = Math.Round((info_det.dc_Valor_debe), 2) > 0 ? Math.Round((info_det.dc_Valor_debe), 2) : Math.Round((info_det.dc_Valor_haber * -1), 2); edited_info.dc_Valor_debe = Math.Round((info_det.dc_Valor_debe), 2); edited_info.dc_Valor_haber = Math.Round((info_det.dc_Valor_haber), 2); if (!string.IsNullOrEmpty(info_det.IdCtaCble)) { var cta = bus_plancta.get_info(IdEmpresa, info_det.IdCtaCble); if (cta != null) { edited_info.pc_Cuenta = cta.IdCtaCble + " - " + cta.pc_Cuenta; } } else { edited_info.pc_Cuenta = null; } }
private List <ct_cbtecble_det_Info> get_diario_ctble_sueldo_x_pagar(int idEmpresa, int idNominaTipo, int idNominaTipoLiqui, int idPeriodo, int IdRol) { try { List <ct_cbtecble_det_Info> lst_detalle_diario = new List <ct_cbtecble_det_Info>(); List <ro_rol_detalle_Info> oListro_rol_detalle_Info = new List <ro_rol_detalle_Info>(); lst_confn_param_contables = bus_parametros_contables.get_list(idEmpresa, "0"); double ingreso = 0; double egreso = 0; int secuecia = 0; info_cta_sueldo_x_pagar = bus_cta_sueldo_x_pagar.get_info(idEmpresa, idNominaTipo, idNominaTipoLiqui); oListro_rol_detalle_Info = bus_detalle.Get_lst_detalle_contabilizar(idEmpresa, idNominaTipo, idNominaTipoLiqui, idPeriodo, IdRol, false); var lstSucursal = oListro_rol_detalle_Info.GroupBy(q => new { q.IdSucursal, q.Su_Descripcion }).Select(q => new { IdSucursal = q.Key.IdSucursal, Su_Descripcion = q.Key.Su_Descripcion }); #region Rubros que no se contabilizan por empleados foreach (ro_Config_Param_contable_Info item in lst_confn_param_contables.Where(v => v.rub_ContPorEmpleado == false)) { foreach (var Suc in lstSucursal) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => v.IdDivision == Convert.ToInt32(item.IdDivision) && v.IdArea == item.IdArea && v.IdDepartamento == item.IdDepartamento && v.IdRubro == item.IdRubro && Suc.IdSucursal == v.IdSucursal).Sum(v => v.Valor); if (valorTotal < 0) { valorTotal = valorTotal * -1; } if (valorTotal > 0) { valorTotal = Math.Round(valorTotal, 2); secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuecia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdCtaCble = item.IdCtaCble_Haber; oct_cbtecble_det_Info.pc_Cuenta = item.pc_Cuenta; if (item.ru_tipo == "E") { egreso = egreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_haber = valorTotal; valorTotal = valorTotal * -1; } else { ingreso = ingreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; } oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion + "/ " + item.DescripcionArea + "/ " + item.de_descripcion; //Agrego sucursal para contabilización multiple oct_cbtecble_det_Info.IdSucursal = Suc.IdSucursal; oct_cbtecble_det_Info.Su_Descripcion = Suc.Su_Descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info); } } } #endregion #region Rubros que se contabilizan por empleados foreach (ro_rol_detalle_Info item in oListro_rol_detalle_Info.Where(v => v.rub_ContPorEmpleado == true)) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => v.IdDivision == Convert.ToInt32(item.IdDivision) && v.IdArea == item.IdArea && v.IdDepartamento == item.IdDepartamento && v.IdRubro == item.IdRubro).Sum(v => v.Valor); valorTotal = item.Valor; if (valorTotal < 0) { valorTotal = valorTotal * -1; } if (valorTotal > 0) { valorTotal = Math.Round(valorTotal, 2); secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuecia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdCtaCble = item.IdCtaCble_Emplea; oct_cbtecble_det_Info.pc_Cuenta = item.pc_CuentaEmple; if (item.ru_tipo == "E") { egreso = egreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_haber = valorTotal; valorTotal = valorTotal * -1; } else { ingreso = ingreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; } oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion + "/ " + item.pe_nombreCompleato; //Agrego sucursal para contabilización multiple oct_cbtecble_det_Info.IdSucursal = item.IdSucursal; oct_cbtecble_det_Info.Su_Descripcion = item.Su_Descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info); } } #endregion if (info_cta_sueldo_x_pagar == null) { info_cta_sueldo_x_pagar = new ro_parametro_contable_x_Nomina_Tipoliqui_Sueldo_x_Pagar_Info(); } double valorSueldoXPagar = 0; valorSueldoXPagar = ingreso - egreso; secuecia++; foreach (var item in lstSucursal) { ct_cbtecble_det_Info oct_cbtecble_det_Info2 = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info2.secuencia = secuecia; oct_cbtecble_det_Info2.IdEmpresa = idEmpresa; oct_cbtecble_det_Info2.IdCtaCble = (info_cta_sueldo_x_pagar.IdCtaCble) == null ? "" : info_cta_sueldo_x_pagar.IdCtaCble; oct_cbtecble_det_Info2.pc_Cuenta = info_cta_sueldo_x_pagar.pc_Cuenta; oct_cbtecble_det_Info2.dc_Valor = Math.Round(lst_detalle_diario.Where(q => q.IdSucursal == item.IdSucursal).Sum(q => q.dc_Valor), 2, MidpointRounding.AwayFromZero) * -1;// valorSueldoXPagar * -1; oct_cbtecble_det_Info2.dc_Valor_haber = Math.Abs(oct_cbtecble_det_Info2.dc_Valor); oct_cbtecble_det_Info2.dc_Observacion = "Sueldo por Pagar Neto a Recibir al " + idPeriodo; oct_cbtecble_det_Info2.IdSucursal = item.IdSucursal; oct_cbtecble_det_Info2.Su_Descripcion = item.Su_Descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info2); } lst_detalle_diario.ForEach(q => { q.dc_Valor = Math.Round(q.dc_Valor, 2, MidpointRounding.AwayFromZero); q.dc_Valor_debe = Math.Round(q.dc_Valor_debe, 2, MidpointRounding.AwayFromZero); q.dc_Valor_haber = Math.Round(q.dc_Valor_haber, 2, MidpointRounding.AwayFromZero); }); return(lst_detalle_diario); } catch (Exception) { throw; } }
public bool guardar_importacionDB(cp_nota_DebCre_Info info) { try { cp_proveedor_Bus bus_proveedor = new cp_proveedor_Bus(); var prov = bus_proveedor.get_info(info.IdEmpresa, info.IdProveedor); var cp_parametros = bus_cp_parametro.get_info(info.IdEmpresa); info.info_comrobante = new ct_cbtecble_Info(); ct_cbtecble_Info diario = new ct_cbtecble_Info { IdEmpresa = info.IdEmpresa, IdTipoCbte = info.IdTipoCbte_Nota, IdCbteCble = info.IdCbteCble_Nota, cb_Fecha = info.cn_fecha, cb_Observacion = info.cn_observacion, IdPeriodo = Convert.ToInt32(info.cn_fecha.Year.ToString() + info.cn_fecha.Month.ToString().PadLeft(2, '0')), IdSucursal = info.IdSucursal, cb_FechaTransac = DateTime.Now, cb_Estado = "A" }; if (prov != null) { if (info.cn_observacion == null) { info.cn_observacion = ""; } diario.cb_Observacion = "Prov: " + prov.info_persona.pe_nombreCompleto + " " + info.cn_observacion; } else { diario.cb_Observacion = info.cn_observacion; } info.info_comrobante = diario; info.info_comrobante.lst_ct_cbtecble_det = new List <ct_cbtecble_det_Info>(); ct_cbtecble_det_Info diario_det = new ct_cbtecble_det_Info { IdEmpresa = info.IdEmpresa, IdTipoCbte = diario.IdTipoCbte, IdCbteCble = diario.IdCbteCble, secuencia = 1, IdCtaCble = prov.IdCtaCble_CXP, dc_Valor = Math.Round(Convert.ToDouble(info.cn_total), 2, MidpointRounding.AwayFromZero), }; info.info_comrobante.lst_ct_cbtecble_det.Add(diario_det); ct_cbtecble_det_Info diario_det_ = new ct_cbtecble_det_Info { IdEmpresa = diario.IdEmpresa, IdTipoCbte = diario.IdTipoCbte, IdCbteCble = diario.IdCbteCble, secuencia = 2, IdCtaCble = prov.IdCtaCble_CXP, dc_Valor = Math.Round(Convert.ToDouble(info.cn_total), 2, MidpointRounding.AwayFromZero) * -1 }; info.info_comrobante.lst_ct_cbtecble_det.Add(diario_det_); if (bus_contabilidad.guardarDB(info.info_comrobante)) { info.IdTipoCbte_Nota = info.info_comrobante.IdTipoCbte; info.IdCbteCble_Nota = info.info_comrobante.IdCbteCble; info.Estado = "A"; info.cn_vaCoa = "N"; info.IdTipoNota = info.IdTipoNota; if (data.guardarDB(info)) { return(true); } } return(false); } catch (Exception) { throw; } }
public ActionResult CmbCuenta_comprobante_contable() { ct_cbtecble_det_Info model = new ct_cbtecble_det_Info(); return(PartialView("_CmbCuenta_comprobante_contable", model)); }
private List <ct_cbtecble_det_Info> get_diario_ctble_sueldo_x_pagar(int idEmpresa, int idNominaTipo, int idNominaTipoLiqui, int idPeriodo) { try { List <ct_cbtecble_det_Info> lst_detalle_diario = new List <ct_cbtecble_det_Info>(); List <ro_rol_detalle_Info> oListro_rol_detalle_Info = new List <ro_rol_detalle_Info>(); lst_confn_param_contables = bus_parametros_contables.get_list(idEmpresa, "0"); double ingreso = 0; double egreso = 0; int secuecia = 0; info_cta_sueldo_x_pagar = bus_cta_sueldo_x_pagar.get_info(idEmpresa, idNominaTipo, idNominaTipoLiqui); oListro_rol_detalle_Info = bus_detalle.Get_lst_detalle_contabilizar(idEmpresa, idNominaTipo, idNominaTipoLiqui, idPeriodo, false); foreach (ro_Config_Param_contable_Info item in lst_confn_param_contables) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => /*v.IdDivision == Convert.ToInt32(item.IdDivision)*/ //&& v.IdArea == item.IdArea //&& v.IdDepartamento == item.IdDepartamento v.IdRubro == item.IdRubro).Sum(v => v.Valor); if (valorTotal < 0) { valorTotal = valorTotal * -1; } if (valorTotal > 0) { valorTotal = Math.Round(valorTotal, 2); secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuecia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdCtaCble = item.IdCtaCble; oct_cbtecble_det_Info.IdCentroCosto = item.IdCentroCosto; if (item.ru_tipo == "E") { egreso = egreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_haber = valorTotal; valorTotal = valorTotal * -1; } else { ingreso = ingreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; } oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info); } } double valorSueldoXPagar = 0; valorSueldoXPagar = ingreso - egreso; secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info2 = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info2.secuencia = secuecia; oct_cbtecble_det_Info2.IdEmpresa = idEmpresa; oct_cbtecble_det_Info2.IdCtaCble = info_cta_sueldo_x_pagar.IdCtaCble; oct_cbtecble_det_Info2.dc_Valor = valorSueldoXPagar * -1; oct_cbtecble_det_Info2.dc_Valor_haber = valorSueldoXPagar; oct_cbtecble_det_Info2.dc_Observacion = "Sueldo por Pagar Neto a Recibir al " + idPeriodo; lst_detalle_diario.Add(oct_cbtecble_det_Info2); return(lst_detalle_diario); } catch (Exception e) { throw; } }
public ActionResult CmbCuenta_ND() { ct_cbtecble_det_Info model = new ct_cbtecble_det_Info(); return(PartialView("_CmbCuenta_ND", model)); }
public ActionResult CmbCuenta_rubros_x_sueldo() { ct_cbtecble_det_Info model = new ct_cbtecble_det_Info(); return(PartialView("_CmbCuenta_rubros_x_sueldo", model)); }
private List <ct_cbtecble_det_Info> get_diario_ctble_provisiones(int idEmpresa, int idNominaTipo, int idNominaTipoLiqui, int idPeriodo, int IdRol) { try { int secuencia = 0; List <ct_cbtecble_det_Info> lst_detalle_diario = new List <ct_cbtecble_det_Info>(); List <ro_rol_detalle_Info> oListro_rol_detalle_Info = new List <ro_rol_detalle_Info>(); lst_confn_param_contables = bus_parametros_contables.get_list(idEmpresa, "1"); info_cta_sueldo_x_pagar = bus_cta_sueldo_x_pagar.get_info(idEmpresa, idNominaTipo, idNominaTipoLiqui); oListro_rol_detalle_Info = bus_detalle.Get_lst_detalle_contabilizar(idEmpresa, idNominaTipo, idNominaTipoLiqui, idPeriodo, IdRol, true); var lstSucursal = oListro_rol_detalle_Info.GroupBy(q => new { q.IdSucursal, q.Su_Descripcion }).Select(q => new { IdSucursal = q.Key.IdSucursal, Su_Descripcion = q.Key.Su_Descripcion }).ToList(); foreach (var item in lst_confn_param_contables) { foreach (var suc in lstSucursal) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => v.IdDivision == Convert.ToInt32(item.IdDivision) && v.IdArea == item.IdArea && v.IdDepartamento == item.IdDepartamento && v.IdRubro == item.IdRubro && v.IdSucursal == suc.IdSucursal).Sum(v => v.Valor); if (valorTotal > 0) { secuencia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuencia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdTipoCbte = 1; oct_cbtecble_det_Info.IdCtaCble = (item.IdCtaCble); oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion + "/ " + item.DescripcionArea + "/ " + item.de_descripcion; oct_cbtecble_det_Info.pc_Cuenta = item.pc_Cuenta_prov_debito; //Agrego sucursal para contabilización multiple oct_cbtecble_det_Info.IdSucursal = suc.IdSucursal; oct_cbtecble_det_Info.Su_Descripcion = suc.Su_Descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info); secuencia++; ct_cbtecble_det_Info oct_cbtecble_det_Info2 = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info2.secuencia = secuencia; oct_cbtecble_det_Info2.IdEmpresa = idEmpresa; oct_cbtecble_det_Info2.IdTipoCbte = 1; oct_cbtecble_det_Info2.IdCtaCble = (item.IdCtaCble_Haber); oct_cbtecble_det_Info2.dc_Valor = valorTotal * -1; oct_cbtecble_det_Info2.dc_Valor_haber = valorTotal; oct_cbtecble_det_Info2.dc_Observacion = item.ru_descripcion + "/ " + item.DescripcionArea + "/ " + item.de_descripcion; oct_cbtecble_det_Info2.pc_Cuenta = item.pc_Cuenta_prov_credito; //Agrego sucursal para contabilización multiple oct_cbtecble_det_Info2.IdSucursal = suc.IdSucursal; oct_cbtecble_det_Info2.Su_Descripcion = suc.Su_Descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info2); } } } lst_detalle_diario.ForEach(q => { q.dc_Valor = Math.Round(q.dc_Valor, 2, MidpointRounding.AwayFromZero); q.dc_Valor_debe = Math.Round(q.dc_Valor_debe, 2, MidpointRounding.AwayFromZero); q.dc_Valor_haber = Math.Round(q.dc_Valor_haber, 2, MidpointRounding.AwayFromZero); }); return(lst_detalle_diario); } catch (Exception) { throw; } }
private List <ct_cbtecble_det_Info> get_diario_ctble_sueldo_x_pagar(int idEmpresa, int idNominaTipo, int idNominaTipoLiqui, int idPeriodo, int IdRol) { try { List <ct_cbtecble_det_Info> lst_detalle_diario = new List <ct_cbtecble_det_Info>(); List <ro_rol_detalle_Info> oListro_rol_detalle_Info = new List <ro_rol_detalle_Info>(); lst_confn_param_contables = bus_parametros_contables.get_list(idEmpresa, "0"); double ingreso = 0; double egreso = 0; int secuecia = 0; info_cta_sueldo_x_pagar = bus_cta_sueldo_x_pagar.get_info(idEmpresa, idNominaTipo, idNominaTipoLiqui); oListro_rol_detalle_Info = bus_detalle.Get_lst_detalle_contabilizar(idEmpresa, idNominaTipo, idNominaTipoLiqui, idPeriodo, IdRol, false); #region Rubros que no se contabilizan por empleados foreach (ro_Config_Param_contable_Info item in lst_confn_param_contables.Where(v => v.rub_ContPorEmpleado == false)) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => v.IdDivision == Convert.ToInt32(item.IdDivision) && v.IdArea == item.IdArea && v.IdDepartamento == item.IdDepartamento && v.IdRubro == item.IdRubro).Sum(v => v.Valor); if (valorTotal < 0) { valorTotal = valorTotal * -1; } if (valorTotal > 0) { valorTotal = Math.Round(valorTotal, 2); secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuecia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdCtaCble = item.IdCtaCble; if (item.ru_tipo == "E") { egreso = egreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_haber = valorTotal; valorTotal = valorTotal * -1; } else { ingreso = ingreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; } oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion + "/ " + item.DescripcionArea + "/ " + item.de_descripcion; lst_detalle_diario.Add(oct_cbtecble_det_Info); } } #endregion #region Rubros que se contabilizan por empleados foreach (ro_rol_detalle_Info item in oListro_rol_detalle_Info.Where(v => v.rub_ContPorEmpleado == true)) { double valorTotal = 0; valorTotal = oListro_rol_detalle_Info.Where(v => v.IdDivision == Convert.ToInt32(item.IdDivision) && v.IdArea == item.IdArea && v.IdDepartamento == item.IdDepartamento && v.IdRubro == item.IdRubro).Sum(v => v.Valor); valorTotal = item.Valor; if (valorTotal < 0) { valorTotal = valorTotal * -1; } if (valorTotal > 0) { valorTotal = Math.Round(valorTotal, 2); secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info.secuencia = secuecia; oct_cbtecble_det_Info.IdEmpresa = idEmpresa; oct_cbtecble_det_Info.IdCtaCble = item.IdCtaCble_Emplea; if (item.ru_tipo == "E") { egreso = egreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_haber = valorTotal; valorTotal = valorTotal * -1; } else { ingreso = ingreso + valorTotal; oct_cbtecble_det_Info.dc_Valor_debe = valorTotal; } oct_cbtecble_det_Info.dc_Valor = valorTotal; oct_cbtecble_det_Info.dc_Observacion = item.ru_descripcion + "/ " + item.pe_nombreCompleato; lst_detalle_diario.Add(oct_cbtecble_det_Info); } } #endregion if (info_cta_sueldo_x_pagar == null) { info_cta_sueldo_x_pagar = new ro_parametro_contable_x_Nomina_Tipoliqui_Sueldo_x_Pagar_Info(); } double valorSueldoXPagar = 0; valorSueldoXPagar = ingreso - egreso; secuecia++; ct_cbtecble_det_Info oct_cbtecble_det_Info2 = new ct_cbtecble_det_Info(); oct_cbtecble_det_Info2.secuencia = secuecia; oct_cbtecble_det_Info2.IdEmpresa = idEmpresa; oct_cbtecble_det_Info2.IdCtaCble = (info_cta_sueldo_x_pagar.IdCtaCble) == null?"": info_cta_sueldo_x_pagar.IdCtaCble; oct_cbtecble_det_Info2.dc_Valor = valorSueldoXPagar * -1; oct_cbtecble_det_Info2.dc_Valor_haber = valorSueldoXPagar; oct_cbtecble_det_Info2.dc_Observacion = "Sueldo por Pagar Neto a Recibir al " + idPeriodo; lst_detalle_diario.Add(oct_cbtecble_det_Info2); return(lst_detalle_diario); } catch (Exception E) { throw; } }
public ActionResult CmbCuenta_provisiones_credito() { ct_cbtecble_det_Info model = new ct_cbtecble_det_Info(); return(PartialView("_CmbCuenta_provisiones_credito", model)); }