// downloadStockItemsReport() downloads the Stock Items report. func downloadStockItemsReport(d *download.Downloader) { log.Println("Inside downloadStockItemsReport") err := d.GetStockItemsReport(path.Join(*directory, "stock_items.csv")) if err != nil { log.Println("Failed to download stock items report. Error: " + err.Error()) } }
// downloadSoldItemsReport() downloads the Sold Items report for the past week. // This may need to be adjusted for more configurability. func downloadSoldItemsReport(d *download.Downloader) { log.Println("Inside downloadSoldItemsReport") // Calculate and format the date a week ago and today. const timeLayout = "2006-01-02" t := time.Now() today := t.Format(timeLayout) aWeekAgo := t.AddDate(0, 0, -7).Format(timeLayout) err := d.GetSoldItemsReport(path.Join(*directory, "sold_items.csv"), aWeekAgo, today) if err != nil { log.Println("Failed to download sold items report. Error: " + err.Error()) } }