示例#1
0
func ReadVenaplo(venaploFile string, invoices schema.Szamlak) (schema.Szamlak, error) {
	dbfFile, err := dbf.OpenFile(util.GetDbfFile(venaploFile), new(dbf.Win1250Decoder))
	if err != nil {
		return invoices, err
	}
	defer dbfFile.Close()

	for i := uint32(0); i < dbfFile.NumRecords(); i++ {
		err := dbfFile.GoTo(i)
		if err != nil {
			return invoices, err
		}
		deleted, err := dbfFile.Deleted()
		if err != nil {
			return invoices, err
		}
		if deleted {
			continue
		}

		invoice, err := createInvoice(util.NewNamedDbf(dbfFile))
		if err != nil {
			return invoices, err
		}
		invoices.Szamla = append(invoices.Szamla, invoice)
	}

	return invoices, nil
}
示例#2
0
func CreateInvoice(dateFrom, dateTo schema.Datum, invoiceFrom, invoiceTo string) schema.Szamlak {
	invoices := schema.Szamlak{}

	invoices.Export_datuma = getExportDate()
	invoices.Kezdo_ido = dateFrom
	invoices.Zaro_ido = dateTo
	invoices.Kezdo_szla_szam = invoiceFrom
	invoices.Zaro_szla_szam = invoiceTo

	args := os.Args[1:]
	if len(args) >= 5 {
		invoices, _ = parseArgDates(invoices, args[2:])
	}

	return invoices
}