public RaportCumulatMuncitorIMO(RaportMuncitorIMO r,RaportDataIMO d, RaportDetaliiMuncitorIMO det)
 {
     this.Nume = r.persoana.Nume + " " + r.persoana.Prenume;
     this.DataStart = r.DataStart;
     this.DataEnd = r.DataEnd;
     this.Numar = r.persoana.Numar;
     this.TotalGreutatePerioada = r.TotalGreutatePerioada;
     this.DataScanare = d.Data.Date;
     this.TotalGreutateZi = d.TotalGreutateZi;
     this.Ambalaj=det.Denumire;
     this.Buc=det.Buc;
     this.Greutate = det.Greutate;
     this.Firma = r.persoana.Firma.Denumire;
 }
Beispiel #2
0
        private RaportMuncitorIMO GetRaportTotalDetaliiMuncitor(Persoana p, DateTime dataStart, DateTime dataEnd)
        {
            IList<RaportDetaliiMuncitorIMO> list = null;
            RaportDataIMO dataScanare = null;
            RaportMuncitorIMO ret = null;
            decimal totalGreutate = 0;
            decimal totalGreutatePerioada = 0;

            try
            {

                ret = new RaportMuncitorIMO();

                    IList param = new ArrayList();
                    param.Add(new QueryParameter("xDataS", dataStart.Date, "s.DataScanare", OperatorType.GreatherOrEquals, OperatorJoinType.AND));
                    param.Add(new QueryParameter("xDataE", dataEnd.Date.AddDays(1).AddMilliseconds(-1), "s.DataScanare", OperatorType.LessOrEquals, OperatorJoinType.AND));
                    param.Add(new QueryParameter("xPId", p.Id, "m.Id", OperatorType.Equals, OperatorJoinType.AND));
                    list = dao.ExecuteHql("select new RaportDetaliiMuncitorIMO(count(s.Id),sum(a.Greutate),a.Denumire) " +
                    " from Scanare s inner join s.Muncitor m inner join s.Ambalaj a group by a.Denumire", param).Cast<RaportDetaliiMuncitorIMO>().ToList().AsReadOnly();

                    if (list.Count != 0)
                    {
                        ret.persoana = p;
                        ret.Numar = p.Numar;
                        ret.DataStart = dataStart;
                        ret.DataEnd = dataEnd;
                        dataScanare = new RaportDataIMO(dataStart);
                        foreach (RaportDetaliiMuncitorIMO det in list)
                        {
                            dataScanare.Detalii.Add(det);
                            totalGreutate += det.Greutate;
                        }
                        dataScanare.TotalGreutateZi = totalGreutate;
                        totalGreutatePerioada += totalGreutate;
                        ret.DataScanare.Add(dataScanare);
                    }
                    ret.TotalGreutatePerioada = totalGreutatePerioada;

                    param = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }