Example #1
0
        private void XBAN_Rpt005_rpt_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                XBAN_Rpt005_Bus         repbus      = new XBAN_Rpt005_Bus();
                List <XBAN_Rpt005_Info> listDataRpt = new List <XBAN_Rpt005_Info>();
                List <XBAN_Rpt005_Info> listDataRpt_agrupado_x_cta = new List <XBAN_Rpt005_Info>();

                string  mensaje     = "";
                string  OP_CtbeCble = "";
                int     IdEmpresa   = 0;
                int     IdTipoCbte  = 0;
                decimal IdCbteCble  = 0;

                IdEmpresa  = Convert.ToInt32(this.PIdEmpresa.Value);
                IdCbteCble = Convert.ToDecimal(this.PIdCbteCble.Value);
                IdTipoCbte = Convert.ToInt32(this.PIdTipo.Value);

                cp_orden_pago_cancelaciones_Bus         BusOp   = new cp_orden_pago_cancelaciones_Bus();
                List <cp_orden_pago_cancelaciones_Info> listsOP = new List <cp_orden_pago_cancelaciones_Info>();

                listsOP = BusOp.Get_List_OP_x_CbteCtble(IdEmpresa, IdTipoCbte, IdCbteCble, ref mensaje);

                foreach (var item in listsOP)
                {
                    if (OP_CtbeCble == "" || OP_CtbeCble == null)
                    {
                        OP_CtbeCble = item.IdOrdenPago_op.ToString();
                    }
                    else
                    {
                        OP_CtbeCble = OP_CtbeCble + "/" + item.IdOrdenPago_op.ToString();
                    }
                }

                lbl_OP_x_CbteCble.Text = "Orden de Pago:" + OP_CtbeCble;

                listDataRpt = repbus.GetData(IdEmpresa, IdCbteCble, IdTipoCbte, ref mensaje);

                var qGrupo = from Cb in listDataRpt
                             group Cb by new
                {
                    Cb.IdEmpresa,
                    Cb.IdCbteCble,
                    Cb.IdTipocbte,
                    Cb.Cod_Cbtecble,
                    Cb.cb_Observacion,
                    Cb.cb_secuencia,
                    Cb.cb_Valor,
                    Cb.cb_Cheque,
                    Cb.cb_ChequeImpreso,
                    Cb.cb_FechaCheque,
                    Cb.Fecha_Transac,
                    Cb.Estado,
                    Cb.cb_giradoA,
                    Cb.cb_ciudadChq,
                    Cb.CodTipoCbteBan,
                    Cb.cb_Fecha,
                    Cb.con_Fecha,
                    Cb.con_Valor,
                    Cb.con_Observacion,
                    Cb.con_IdCbteCble,
                    Cb.IdCtaCble,
                    Cb.pc_Cuenta,
                    Cb.ValorEnLetras,
                    Cb.nom_ciudad
                }
                into grouping
                    select new { grouping.Key, totaldebidoxCta = grouping.Sum(p => p.dc_ValorDebe), totalcreditoxCta = grouping.Sum(p => p.dc_ValorHaber) };

                foreach (var item in qGrupo)
                {
                    XBAN_Rpt005_Info InfoD = new XBAN_Rpt005_Info();

                    InfoD.cb_Valor        = item.Key.cb_Valor;
                    InfoD.IdCbteCble      = item.Key.IdCbteCble;
                    InfoD.cb_Cheque       = item.Key.cb_Cheque;
                    InfoD.cb_Observacion  = item.Key.cb_Observacion;
                    InfoD.con_Fecha       = item.Key.con_Fecha;
                    InfoD.cb_FechaCheque  = item.Key.cb_FechaCheque;
                    InfoD.cb_giradoA      = item.Key.cb_giradoA;
                    InfoD.ValorEnLetras   = item.Key.ValorEnLetras;
                    InfoD.dc_ValorDebe    = item.totaldebidoxCta;
                    InfoD.dc_ValorHaber   = item.totalcreditoxCta;
                    InfoD.con_Valor       = item.Key.con_Valor;
                    InfoD.con_Observacion = item.Key.con_Observacion;
                    InfoD.IdCtaCble       = item.Key.IdCtaCble;
                    InfoD.pc_Cuenta       = item.Key.pc_Cuenta;
                    InfoD.ValorEnLetras   = item.Key.ValorEnLetras;
                    InfoD.cb_ciudadChq    = item.Key.cb_ciudadChq;
                    InfoD.nom_ciudad      = item.Key.nom_ciudad;

                    listDataRpt_agrupado_x_cta.Add(InfoD);
                }

                this.DataSource = listDataRpt_agrupado_x_cta.ToArray();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "XBAN_Rpt005_rpt_BeforePrint", ex.Message), ex)
                      {
                          EntityType = typeof(XBAN_Rpt005_rpt)
                      };
            }
        }
Example #2
0
        public List <XBAN_Rpt005_Info> GetData(int IdEmpresa, decimal IdComprobante, int IdTipoComprobante, ref string MensajeError)
        {
            try
            {
                List <XBAN_Rpt005_Info> Result = new List <XBAN_Rpt005_Info>();
                using (EntitiesBancos_Reporte_Ge conexion = new EntitiesBancos_Reporte_Ge())
                {
                    var Select = from q in conexion.vwBAN_Rpt005
                                 where q.IdEmpresa == IdEmpresa && q.IdCbteCble == IdComprobante && q.IdTipocbte == IdTipoComprobante
                                 select q;
                    foreach (var item in Select)
                    {
                        XBAN_Rpt005_Info infoRpt = new XBAN_Rpt005_Info();
                        infoRpt.IdEmpresa        = item.IdEmpresa;
                        infoRpt.IdCbteCble       = item.IdCbteCble;
                        infoRpt.IdTipocbte       = item.IdTipocbte;
                        infoRpt.Cod_Cbtecble     = item.Cod_Cbtecble;
                        infoRpt.cb_Observacion   = item.cb_Observacion;
                        infoRpt.cb_secuencia     = item.cb_secuencia;
                        infoRpt.cb_Valor         = item.cb_Valor;
                        infoRpt.cb_Cheque        = item.cb_Cheque;
                        infoRpt.cb_ChequeImpreso = item.cb_ChequeImpreso;
                        infoRpt.cb_FechaCheque   = item.cb_FechaCheque;
                        infoRpt.Fecha_Transac    = item.Fecha_Transac;
                        infoRpt.Estado           = item.Estado;
                        infoRpt.cb_giradoA       = item.cb_giradoA;
                        infoRpt.cb_ciudadChq     = item.cb_ciudadChq;
                        infoRpt.CodTipoCbteBan   = item.CodTipoCbteBan;
                        infoRpt.cb_Fecha         = item.cb_Fecha;
                        infoRpt.con_Fecha        = item.con_Fecha;
                        infoRpt.con_Valor        = item.con_Valor;
                        infoRpt.con_Observacion  = item.con_Observacion;
                        infoRpt.con_IdCbteCble   = item.con_IdCbteCble;
                        infoRpt.IdCtaCble        = item.IdCtaCble;
                        infoRpt.pc_Cuenta        = item.pc_Cuenta;
                        infoRpt.ValorEnLetras    = item.ValorEnLetras;
                        infoRpt.dc_Valor         = item.dc_Valor;
                        infoRpt.nom_ciudad       = item.nom_ciudad;
                        if (infoRpt.dc_Valor < 0)
                        {
                            infoRpt.dc_ValorHaber = infoRpt.dc_Valor * -1;
                        }
                        else
                        {
                            infoRpt.dc_ValorDebe = infoRpt.dc_Valor;
                        }

                        Result.Add(infoRpt);
                    }

                    return(Result);
                }
            }
            catch (Exception ex)
            {
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", "", "", "", "", "", "", DateTime.Now);
                MensajeError = ex.ToString();
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);

                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Get_Data_Reporte", ex.Message), ex)
                      {
                          EntityType = typeof(XBAN_Rpt005_Data)
                      };
            }
        }