public static FormasDePagos GetComprobantesTesoreria(string IdCondicionDeVenta)
        {
            FormasDePagos             result = new FormasDePagos();
            tfi_FormasDePagoExDataset data   = new tfi_FormasDePagoExDataset();

            System.Data.DataRowCollection comprobantes = GetComprobantesTesoreria(data, IdCondicionDeVenta);
            foreach (System.Data.DataRow rowCompTesoreria in comprobantes)
            {
                string IdMoneda      = "";
                string IdComp        = "";
                string descComp      = (string)rowCompTesoreria["Descripcion"];
                string IdFormaDePago = "";
                if ((bool)rowCompTesoreria["Agrupado"])
                {
                    string aux = (string)rowCompTesoreria["IdTDCompTesoreria"];
                    IdComp   = aux.Substring(0, aux.IndexOf("#"));
                    IdMoneda = aux.Substring(aux.IndexOf("#") + 1);
                }
                else
                {
                    IdComp = (string)rowCompTesoreria["IdTDCompTesoreria"];
                }
                ArrayList master = new ArrayList();
                result.Add(Factory.GetFormaDePagoMaster(IdComp, descComp, IdMoneda, IdFormaDePago));
            }
            return(result);
        }
        public static System.Data.DataRowCollection GetComprobantesTesoreria(tfi_FormasDePagoExDataset data, string IdCondicionDeVenta, string IdCuenta, string IdTipoDeComprobante)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "Pr_tfi_GetComprobantesTesoreria");

            SqlCommand cmd = new SqlCommand("Pr_tfi_TDCompTesoreria_GetListBy", dbhelper.Connection.GetConnection());

            cmd.Parameters.Add(new SqlParameter("@IdCondicionDeVenta", SqlDbType.VarChar));
            cmd.Parameters["@IdCondicionDeVenta"].Value = IdCondicionDeVenta;
            cmd.Parameters.Add(new SqlParameter("@IdTipoDeComprobante", SqlDbType.VarChar));
            if (IdTipoDeComprobante == null || IdTipoDeComprobante.Equals(string.Empty))
            {
                cmd.Parameters["@IdTipoDeComprobante"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdTipoDeComprobante"].Value = IdTipoDeComprobante;
            }
            cmd.Parameters.Add(new SqlParameter("@IdCuenta", SqlDbType.VarChar));
            if (IdCuenta == null || IdCuenta.Equals(string.Empty))
            {
                cmd.Parameters["@IdCuenta"].Value = System.DBNull.Value;
            }
            else
            {
                cmd.Parameters["@IdCuenta"].Value = IdCuenta;
            }
            cmd.CommandType       = CommandType.StoredProcedure;
            adapter.SelectCommand = cmd;
            adapter.Fill(data);
            return(data.Pr_tfi_GetComprobantesTesoreria.Rows);
        }
        public static FormasDePagos GetFormasDePago(string IdCondicionDeVenta, string IdCuenta, string IdTipoDeComprobante)        //string IdMonedaReferencia
        {
            FormasDePagos             result = new FormasDePagos();
            tfi_FormasDePagoExDataset data   = new tfi_FormasDePagoExDataset();

            System.Data.DataRowCollection comprobantes     = GetComprobantesTesoreria(data, IdCondicionDeVenta, IdCuenta, IdTipoDeComprobante);
            System.Data.DataRowCollection formasDePagosGen = GetFormasDePagosGenerales(data);
            System.Data.DataRowCollection formasDePagosEsp = GetFormasDePagosEspecificas(data);
            FormasDePagos res = new FormasDePagos();

            foreach (System.Data.DataRow rowCompTesoreria in comprobantes)
            {
                string IdMoneda      = "";
                string IdComp        = "";
                string descComp      = (string)rowCompTesoreria["Descripcion"];
                string IdFormaDePago = "";
                bool   Agrupado      = (bool)rowCompTesoreria["Agrupado"];
                if (Agrupado)
                {
                    string aux = (string)rowCompTesoreria["IdTDCompTesoreria"];
                    IdComp   = aux.Substring(0, aux.IndexOf("#"));
                    IdMoneda = aux.Substring(aux.IndexOf("#") + 1);
                }
                else
                {
                    IdComp = (string)rowCompTesoreria ["IdTDCompTesoreria"];
                }
                ArrayList master = new ArrayList();
                if (Agrupado)
                {
                    master.AddRange(ProcesarFormasDePagoEspBilletes(formasDePagosEsp, IdComp, descComp, IdMoneda));
                }
                else
                {
                    master.AddRange(ProcesarFormasDePagoEsp(formasDePagosEsp, IdComp, descComp));
                }
                if (Agrupado)
                {
                    master.AddRange(ProcesarFormasDePagoGenBilletes(formasDePagosGen, IdComp, descComp, IdMoneda));
                }
                else
                {
                    master.AddRange(ProcesarFormasDePagoGen(formasDePagosGen, IdComp, descComp));
                }
                if (master.Count == 0)
                {
                    master.Add(Factory.GetFormaDePagoMaster(IdComp, descComp, IdMoneda, IdFormaDePago));
                }
                foreach (FormaDePago fdp in master)
                {
                    fdp.Agrupado = Agrupado;
                }

                result.AddRange(master);
            }
            return(result);
        }
        public static System.Data.DataRowCollection  GetComprobantesTesoreria(tfi_FormasDePagoExDataset data)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "Pr_tfi_GetComprobantesTesoreria");

            SqlCommand cmd = new SqlCommand("Pr_tfi_GetComprobantesTesoreria", dbhelper.Connection.GetConnection());

            cmd.CommandType       = CommandType.StoredProcedure;
            adapter.SelectCommand = cmd;
            adapter.Fill(data);
            return(data.Pr_tfi_GetComprobantesTesoreria.Rows);
        }
        public static System.Data.DataRowCollection GetFormasDePagosGenerales(tfi_FormasDePagoExDataset data1)
        {
            DataSet        data    = new DataSet();
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "Pr_tfi_GetFormasDePagosGenerales");

            SqlCommand cmd = new SqlCommand("Pr_tfi_GetFormasDePagosGenerales", dbhelper.Connection.GetConnection());

            cmd.CommandType       = CommandType.StoredProcedure;
            adapter.SelectCommand = cmd;
            adapter.Fill(data);
            return(data.Tables[0].Rows);
        }
        public static System.Data.DataRowCollection  GetComprobantesTesoreria(tfi_FormasDePagoExDataset data, string IdCondicionDeVenta)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.TableMappings.Add("Table", "Pr_tfi_GetComprobantesTesoreria");

            SqlCommand cmd = new SqlCommand("Pr_tfi_GetComprobantesTesoreria_ByIdCondicionDeVenta", dbhelper.Connection.GetConnection());

            cmd.Parameters.Add(new SqlParameter("@IdCondicionDeVenta", SqlDbType.VarChar));
            cmd.Parameters["@IdCondicionDeVenta"].Value = IdCondicionDeVenta;
            cmd.CommandType       = CommandType.StoredProcedure;
            adapter.SelectCommand = cmd;
            adapter.Fill(data);
            return(data.Pr_tfi_GetComprobantesTesoreria.Rows);
        }
 /// <summary>
 /// This function has been deprecated momentarily
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static System.Data.DataRowCollection GetFormasDePagosEspecificas(tfi_FormasDePagoExDataset data)
 {
     return(mz.erp.dataaccess.tfi_FormasDePagoEx.GetFormasDePagosEspecificas(data));
 }
 public static System.Data.DataRowCollection GetComprobantesTesoreria(tfi_FormasDePagoExDataset data, string IdCondicionDeVenta, string IdCuenta, string IdTipoDeComprobante)
 {
     return(mz.erp.dataaccess.tfi_FormasDePagoEx.GetComprobantesTesoreria(data, IdCondicionDeVenta, IdCuenta, IdTipoDeComprobante));
 }
 /// <summary>
 /// This function has been deprecated momentarily
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static System.Data.DataRowCollection GetComprobantesTesoreria(tfi_FormasDePagoExDataset data)
 {
     return(mz.erp.dataaccess.tfi_FormasDePagoEx.GetComprobantesTesoreria(data));
 }
        /// <summary>
        /// This function has been deprecated momentarily
        /// </summary>
        /// <param name="data"></param>
        /// <param name="IdMonedaOrigen"></param>
        /// <param name="IdMonedaDestino"></param>
        /// <returns></returns>
        public static System.Data.DataRow GetValorCotizacion(tfi_FormasDePagoExDataset data, string IdMonedaOrigen, string IdMonedaDestino)
        {
            System.Data.DataRow row = null;              //mz.erp.dataaccess.tfi_FormasDePagoEx.GetValorCotizacion(data, IdMonedaOrigen, IdMonedaDestino);

            return(row);
        }
        public static FormasDePagos GetFormasDePago(ArrayList ListaTDComTesoreria)         //string IdMonedaReferencia
        {
            FormasDePagos             result = new FormasDePagos();
            tfi_FormasDePagoExDataset data   = new tfi_FormasDePagoExDataset();

            System.Data.DataRowCollection comprobantes     = GetComprobantesTesoreria(data);
            System.Data.DataRowCollection formasDePagosGen = GetFormasDePagosGenerales(data);
            System.Data.DataRowCollection formasDePagosEsp = GetFormasDePagosEspecificas(data);
            FormasDePagos res = new FormasDePagos();

            foreach (System.Data.DataRow rowCompTesoreria in comprobantes)
            {
                string IdMoneda      = "";
                string IdComp        = "";
                string descComp      = (string)rowCompTesoreria["Descripcion"];
                string IdFormaDePago = "";
                int    Orden         = int.MaxValue;
                bool   Agrupado      = (bool)rowCompTesoreria["Agrupado"];

                if (Agrupado)
                {
                    string aux = (string)rowCompTesoreria["IdTDCompTesoreria"];
                    IdComp   = aux.Substring(0, aux.IndexOf("#"));
                    IdMoneda = aux.Substring(aux.IndexOf("#") + 1);
                }
                else
                {
                    IdComp = (string)rowCompTesoreria ["IdTDCompTesoreria"];
                }
                if (!rowCompTesoreria.IsNull("Orden"))
                {
                    Orden = Convert.ToInt32(rowCompTesoreria["Orden"]);
                }
                if (ListaTDComTesoreria.Contains(IdComp))
                {
                    ArrayList master = new ArrayList();
                    if (Agrupado)
                    {
                        master.AddRange(ProcesarFormasDePagoEspBilletes(formasDePagosEsp, IdComp, descComp, IdMoneda));
                    }
                    else
                    {
                        master.AddRange(ProcesarFormasDePagoEsp(formasDePagosEsp, IdComp, descComp));
                    }
                    if (Agrupado)
                    {
                        master.AddRange(ProcesarFormasDePagoGenBilletes(formasDePagosGen, IdComp, descComp, IdMoneda));
                    }
                    else
                    {
                        master.AddRange(ProcesarFormasDePagoGen(formasDePagosGen, IdComp, descComp));
                    }
                    if (master.Count == 0)
                    {
                        master.Add(Factory.GetFormaDePagoMaster(IdComp, descComp, IdMoneda, IdFormaDePago));
                    }
                    foreach (FormaDePago fdp in master)
                    {
                        fdp.Agrupado = Agrupado;
                        fdp.Orden    = Orden;
                        fdp.Cuotas   = Convert.ToUInt16(rowCompTesoreria["Cuotas"]);
                    }
                    result.AddRange(master);
                }
            }
            return(result);
        }