示例#1
0
        /// <summary>
        /// Castea una instancia de dataRow a la clase recibosPImpresion
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        public DataTable castDT(IDataReader dr,DataTable dt)
        {
            DataRow fila;
            recibosPImpresion item = new recibosPImpresion();
            try
            {
                fila = dt.NewRow();
                if (dr["conRetenciones"] is System.DBNull)
                {
                    fila["conRetenciones"] = false;
                }
                else
                {
                    fila["conRetenciones"] = dr["conRetenciones"];
                }
                if (dr["Rec_Docid"] is System.DBNull)
                {
                    fila["Rec_Docid"] = 0;
                }
                else
                {
                    fila["Rec_Docid"] = dr["Rec_Docid"];
                }
                if (dr["ReciboId"] is System.DBNull)
                {
                    fila["ReciboId"] = 0;
                }
                else
                {
                    fila["ReciboId"] = dr["ReciboId"];
                }
                if (dr["fechaInforme"] is System.DBNull)
                {
                    fila["fechaInforme"] = "01/01/1950";
                }
                else
                {
                    fila["fechaInforme"] = dr["fechaInforme"];
                }
                if (dr["fechaDeposito"] is System.DBNull)
                {
                    fila["fechaDeposito"] = "01/01/1950";
                }
                else
                {
                    fila["fechaDeposito"] = dr["fechaDeposito"];
                }
                if (dr["fechaAcreditacion"] is System.DBNull)
                {
                    fila["fechaAcreditacion"] = "01/01/1950";
                }
                else
                {
                    fila["fechaAcreditacion"] = dr["fechaAcreditacion"];
                }
                if (dr["Importe"] is System.DBNull)
                {
                    fila["Importe"] = 0;
                }
                else
                {
                    fila["Importe"] = dr["Importe"];
                }
                if (dr["estado"] is System.DBNull)
                {
                    fila["estado"] = 0;
                }
                else
                {
                    fila["estado"] = dr["estado"];
                }
                if (dr["userId"] is System.DBNull)
                {
                    fila["userId"] = "";
                }
                else
                {
                    fila["userId"] = dr["userId"];
                }
                if (dr["monid"] is System.DBNull)
                {
                    fila["monid"] = "";
                }
                else
                {
                    fila["monid"] = dr["monid"];
                }
                if (dr["provId"] is System.DBNull)
                {
                    fila["provId"] = "";
                }
                else
                {
                    fila["provId"] = dr["provId"];
                }
                if (dr["listaFacturas"] is System.DBNull)
                {
                    fila["listaFacturas"] = "";
                }
                else
                {
                    fila["listaFacturas"] = dr["listaFacturas"];
                }
                if (dr["DestipoPago"] is System.DBNull)
                {
                    fila["DestipoPago"] = "sin definir";
                }
                else
                {
                    fila["DestipoPago"] = dr["DestipoPago"];
                }
                if (dr["tipoPago"] is System.DBNull)
                {
                    fila["tipoPago"] = 0;
                }
                else
                {
                    fila["tipoPago"] = dr["tipoPago"];
                }
                if (dr["observaciones"] is System.DBNull)
                {
                    fila["observaciones"] = "sin comentarios";
                }
                else
                {
                    if (dr["obsRec"] is System.DBNull)
                    {
                        fila["observaciones"] = (string)dr["observaciones"];
                    }
                    else
                        fila["observaciones"] =(string)dr["observaciones"] +(string)dr["obsRec"];

                }
                if (dr["importe"] is System.DBNull)
                {
                    fila["importe"] = 0;
                }
                else
                {
                    fila["importe"] = dr["importe"];
                }
                if (dr["transaccion"] is System.DBNull)
                {
                    fila["transaccion"] = "";
                }
                else
                {
                    fila["transaccion"] = dr["transaccion"];
                } if (dr["banco"] is System.DBNull)
                {
                    fila["banco"] = "";
                }
                else
                {
                    fila["banco"] = dr["banco"];
                }
                if (dr["nroCheque"] is System.DBNull)
                {
                    fila["nroCheque"] = "";
                }
                else
                {
                    fila["nroCheque"] = dr["nroCheque"];
                }
                if (dr["sucursal"] is System.DBNull)
                {
                    fila["sucursal"] = "";
                }
                else
                {
                    fila["sucursal"] = dr["sucursal"];
                }
                if (dr["bancoIddeDeposito"] is System.DBNull)
                {
                    fila["bancoIddeDeposito"] = "";
                }
                else
                {
                    fila["bancoIddeDeposito"] = dr["bancoIddeDeposito"];
                }
                if (dr["bancoIdDestino"] is System.DBNull)
                {
                    fila["bancoIdDestino"] = "";
                }
                else
                {
                    fila["bancoIdDestino"] = dr["bancoIdDestino"];
                }
                if (dr["nombre"] is System.DBNull)
                {
                    fila["nombre"] = "";
                }
                else
                {
                    fila["nombre"] = dr["nombre"];
                }
                if (dr["fechaaceptacion"] is System.DBNull)
                {
                    fila["fechaaceptacion"] = "";
                }
                else
                {
                    fila["fechaaceptacion"] = dr["fechaaceptacion"];
                }
                if (dr["importeneto"] is System.DBNull)
                {
                    fila["importeneto"] = "0";
                }
                else
                {
                    fila["importeneto"] = dr["importeneto"];
                }

                dt.Rows.Add(fila);
            }
            catch (Exception e)
            {

                throw new Exception(e.Message);
            }

            return dt;
        }
示例#2
0
        /// <summary>
        /// trae un recibo para poder imprimirlo en pdf retornando un dt
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="idRecibo">id del recibo a imprimir</param>
        /// <returns></returns>
        public DataTable getRecibos(ref DataTable dt, int idRecibo)
        {
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@Rec_Docid", idRecibo);

            recibosPImpresion ri = new recibosPImpresion();
            //DataTable dt = new DataTable();
            datosSQL.ConGenerico = false;
            datosSQL.Parametros = param;
            datosSQL.Stored = "COCG_FEBUY_Recibos";

            ri.crearDT(ref dt);

            lector = ebSQL.ExecuteSPReader(datosSQL);
            while (lector.Read())
            {
                dt = ri.castDT(lector, dt);
            }

            lector.Close();
            //EbuySqlFact.ExecuteSP(ref dt, "COCG_FEBUY_Recibos", param, false);
            return dt;
        }