Пример #1
0
        private void stabilesteTotalOre()
        {
            //BDefinitiiGenerale.StructCheckInOut.GetDenumireTip(pElem.TipPontaj)
            int totalMinuteLucrate   = 0;
            int totalMinutePauza     = 0;
            int totalMinuteDeplasare = 0;

            BColectiePontaj lstPontaj = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit, null);

            foreach (var elem in lstPontaj)
            {
            }

            StringBuilder sb = new StringBuilder();

            if (totalMinuteLucrate > 0)
            {
                sb.Append("Ore lucrate: " + CUtil.GetTextDurataOreMinute(totalMinuteLucrate) + " ");
            }
            if (totalMinutePauza > 0)
            {
                sb.Append("Pauza: " + CUtil.GetTextDurataOreMinute(totalMinutePauza) + " ");
            }
            if (totalMinuteDeplasare > 0)
            {
                sb.Append("Deplasare: " + CUtil.GetTextDurataOreMinute(totalMinuteDeplasare) + " ");
            }
        }
        private void ConstruiesteRanduriDGVRezumat()
        {
            this.dgvListaPontaj.IncepeContructieRanduri();

            BColectiePontaj listaElem = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit, null);

            incarcaRandRezumat(this.dgvListaPontaj.Rows[this.dgvListaPontaj.Rows.Add()], listaElem);

            this.dgvListaPontaj.FinalizeazaContructieRanduri();
        }
        private void ConstruiesteRanduriDGVDetalii()
        {
            this.dgvListaPontaj.IncepeContructieRanduri();

            var listaElem = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit, null);

            foreach (var elem in listaElem)
            {
                incarcaRandDetalii(this.dgvListaPontaj.Rows[this.dgvListaPontaj.Rows.Add()], elem);
            }

            this.dgvListaPontaj.FinalizeazaContructieRanduri();
        }
        private void incarcaRandRezumat(DataGridViewRow pRand, BColectiePontaj pElem)
        {
            pRand.Tag = pElem;

            DataGridViewPersonalizat.InitCelulaEditare(pRand, this.lEcranInModificare);

            pRand.Cells[EnumColoaneDGVRezumat.colConcedii.ToString()].Value         = this.lUtilizator.NumarZileCOAgreate;
            pRand.Cells[EnumColoaneDGVRezumat.colZileNelucratoare.ToString()].Value = "0";
            pRand.Cells[EnumColoaneDGVRezumat.colZile.ToString()].Value             = CUtil.GetNumarZileLucratoareLuna(this.ctrlPerioada.DataInceput);

            pRand.Cells[EnumColoaneDGVRezumat.colTotal.ToString()].Value = CUtil.GetTextPrescurtatDurataOreMinute(getDurataTotalaPePerioada());

            int ultimaZiDinLuna = Convert.ToInt32(DateAndTime.DateDiff(DateInterval.Day, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit));

            DateTime dataInceput = this.ctrlPerioada.DataInceput;
            DateTime dataSfarsit = dataInceput.AddDays(1);

            for (int i = this.ctrlPerioada.DataInceput.Day; i <= this.ctrlPerioada.DataSfarsit.Day; i++)
            {
                this.dgvListaPontaj.Columns[0].Tag = pElem;

                long totalPontajZi = 0;

                var listaElem = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, dataInceput, dataSfarsit, null);

                foreach (var elem in listaElem)
                {
                    if (elem.TipPontaj == 1)
                    {
                        dataInceput = elem.DataPontaj;
                    }

                    if (elem.TipPontaj == 2)
                    {
                        totalPontajZi += getNrMinuteZi(dataInceput, elem.DataPontaj);
                    }
                }
                pRand.Cells[(dataInceput.Day).ToString()].Value = CUtil.GetTextPrescurtatDurataOreMinute(totalPontajZi);

                dataInceput = dataInceput.AddDays(1);
                dataSfarsit = dataSfarsit.AddDays(1);
            }
        }
        private long getDurataTotalaPePerioada()
        {
            long     totalMinute = 0;
            DateTime datCheckIn  = CConstante.DataNula;

            var listaElem = BPontaj.GetListByIdUtilizatorTotalPePerioada(this.lUtilizator.Id, this.ctrlPerioada.DataInceput, this.ctrlPerioada.DataSfarsit, null);

            foreach (var elem in listaElem)
            {
                if (elem.TipPontaj == 1)
                {
                    datCheckIn = elem.DataPontaj;
                }

                if (elem.TipPontaj == 2)
                {
                    totalMinute += getNrMinuteZi(datCheckIn, elem.DataPontaj);
                }
            }

            return(totalMinute);
        }