Added cost import via web

This commit is contained in:
Deon George
2022-08-19 15:12:56 +10:00
parent 798608cebd
commit 73d92f25c1
9 changed files with 111 additions and 17 deletions

View File

@@ -22,6 +22,7 @@ class ImportCosts implements ShouldQueue
private const LOGKEY = 'JIC';
private Cost $co;
private Site $site;
private string $file;
protected Collection $columns;
@@ -33,7 +34,7 @@ class ImportCosts implements ShouldQueue
public function __construct(Site $site,Supplier $so,Carbon $invoice_date,string $file)
{
$this->file = $file;
Config::set('site',$site);
$this->site = $site;
$this->co = Cost::where('site_id',$site->site_id)
->where('supplier_id',$so->id)
@@ -72,9 +73,10 @@ class ImportCosts implements ShouldQueue
*/
public function handle()
{
Config::set('site',$this->site);
$skip = 7; // @todo to be stored in supplier config
$file = fopen($this->file,'r');
$file = fopen('storage/app/'.$this->file,'r');
$haveHeader = FALSE;
$c = 0;