Ejemplo n.º 1
0
        public static bool GenerateUngeneratedReport()
        {
            try
            {
                DateTime minsalesdate = DataHandler.GetMinimumSaleDate();
                DateTime lastZread    = DataHandler.GetLastZReadDate();

                if (lastZread.Date == DateTime.Now.Date)
                {
                    return(true);
                }
                if (lastZread.Date == DateTime.Now.AddDays(-1).Date)
                {
                    return(true);
                }
                else
                {
                    DataBaseHelper.SetDB(@"DELETE FROM Reports WHERE transdate >= '" + lastZread.Date.ToString("yyyy-MM-dd") + "'");
                    foreach (DateTime day in EachDay(lastZread, DateTime.Now.AddDays(-1)))
                    {
                        GenerateReport.XRead(day);
                        GenerateReport.ZRead(day);
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static DateTime GetLastZReadDate()
        {
            DataTable dt = DataBaseHelper.GetDB(string.Format(@"SELECT MIN(date) as date FROM Reports WHERE readtype = 3"));

            if (dt.Rows.Count == 0 || dt == null)
            {
                return(DataHandler.GetMinimumSaleDate());
            }
            else
            {
                try
                {
                    return(Convert.ToDateTime(dt.Rows[0]["date"]));
                }
                catch { return(DataHandler.GetMinimumSaleDate()); }
            }
        }