コード例 #1
0
ファイル: scontrino.cs プロジェクト: stonetempledev/root
  public static List <scontrino> scontrini(utente u, view_filter vs = null, tipo_spesa tp = null, bool last_ins = false, int?id = null)
  {
      return(dal.dt_sql($@"select {(last_ins ? "top 1" : "")} {(vs != null && vs.top_rows.HasValue ? $"top {vs.top_rows}" : "")} 
 s.id_scontrino, s.cosa, s.qta, s.dt_scontrino, s.importo
  , ts.id_tipo_spesa as ts_id_tipo_spesa, ts.title as ts_title, ts.note as ts_note
  , e.id_evento as ev_id_evento, e.title as ev_title, e.dt_da as ev_dt_da, e.dt_a as ev_dt_a, e.note as ev_note
  , te.id_tipo_evento as te_id_tipo_evento, te.title as te_title, te.note as te_note
  , (select top 1 1 from scontrino with(nolock) where id_scontrino <> s.id_scontrino and dt_scontrino = s.dt_scontrino
      and id_tipo_spesa = s.id_tipo_spesa and importo = s.importo and id_utente = s.id_utente) as doppio
 from scontrino s with(nolock)
 join tipo_spesa ts with(nolock) on ts.id_tipo_spesa = s.id_tipo_spesa
 left join evento e with(nolock) on e.id_evento = s.id_evento
 left join tipo_evento te with(nolock) on te.id_tipo_evento = e.id_tipo_evento
 where s.id_utente = {u.id} {(id.HasValue ? $" and s.id_scontrino = {id}" : "")} 
  {(vs != null && vs.last_days.HasValue ? $" and datediff(day, dt_scontrino, getdate()) <= {vs.last_days}" : "")}
  {(tp != null && tp.id.HasValue ? $" and ts.id_tipo_spesa = {tp.id}" : "")}
 order by {(!last_ins ? (vs != null && vs.has_order_by ? vs.get_order_by("s") : "s.dt_scontrino desc") : "s.dt_ins desc")}")
             .Rows.Cast <DataRow>().Select(r => dl.from_dr(u, r, "ts_", "", "ev_", "te_")).ToList());
  }
コード例 #2
0
ファイル: web_scontrini.cs プロジェクト: stonetempledev/root
        protected override void load_objects(object data = null)
        {
            base.load_objects(data);

            view_filter vf = new view_filter("Ultimi 6 mesi", last_days: 180);

            // title
            this.add_html($@"<div class='row mb-5'>
            <div class='col-sm-12'>
              <span class='fs-160 d-block'>
                <span class='fs-60 mr-1 fc-1'>vista:</span>
                <span>{vf.title}</span></span>
              <span class='fs-80 d-block op-6'>scontrini ordinati per data decrescente</span>
            </div>
          </div><hr/>");

            // scontrini
            add_html($@"<div web-element='scontrini'>");
            foreach (scontrino s in scontrino.dl.scontrini(logged.utente(), vf))
            {
                this.add_element(new web_scontrino_row(s));
            }
            add_html("</div>");
        }