sales

package
v1.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SaleDocumentTypeInvWayBill    = "INVWAYBILL"
	SaleDocumentTypeCASHINVOICE   = "CASHINVOICE"
	SaleDocumentTypeWayBill       = "WAYBILL"
	SaleDocumentTypePrepayment    = "PREPAYMENT"
	SaleDocumentTypeOffer         = "OFFER"
	SaleDocumentTypeExportInvoice = "EXPORTINVOICE"
	SaleDocumentTypeReservation   = "RESERVATION"
	SaleDocumentTypeCreditInvoice = "CREDITINVOICE"
	SaleDocumentTypeOrder         = "ORDER"
	SaleDocumentTypeInvoice       = "INVOICE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssignmentsManger added in v1.9.1

type AssignmentsManger interface {
	SaveAssignment(ctx context.Context, filters map[string]string) (int64, error)
}

type BaseDocument

type BaseDocument struct {
	ID     int    `json:"id"`
	Number string `json:"number"`
	Type   string `json:"type"`
	Date   string `json:"date"`
}

type Client

type Client struct {
	*common.Client
}

func NewClient

func NewClient(client *common.Client) *Client

func (*Client) CalculateShoppingCart

func (cli *Client) CalculateShoppingCart(ctx context.Context, filters map[string]string) (*ShoppingCartTotals, error)

func (*Client) DeleteDocument

func (cli *Client) DeleteDocument(ctx context.Context, filters map[string]string) error

func (*Client) GetPayments

func (cli *Client) GetPayments(ctx context.Context, filters map[string]string) ([]PaymentInfo, error)

func (*Client) GetProjectStatus

func (cli *Client) GetProjectStatus(ctx context.Context, filters map[string]string) ([]ProjectStatus, error)

GetProjectStatus will list projects statuses according to specified filters.

func (*Client) GetProjects

func (cli *Client) GetProjects(ctx context.Context, filters map[string]string) ([]Project, error)

GetProjects will list projects according to specified filters.

func (*Client) GetSalesDocuments

func (cli *Client) GetSalesDocuments(ctx context.Context, filters map[string]string) ([]SaleDocument, error)

func (*Client) GetSalesDocumentsBulk added in v1.7.5

func (cli *Client) GetSalesDocumentsBulk(ctx context.Context, bulkFilters []map[string]interface{}, baseFilters map[string]string) (GetSaleDocumentResponseBulk, error)

func (*Client) GetVatRates

func (cli *Client) GetVatRates(ctx context.Context, filters map[string]string) (VatRates, error)

GetVatRatesByVatRateID ...

func (*Client) SaveAssignment added in v1.9.0

func (cli *Client) SaveAssignment(ctx context.Context, filters map[string]string) (int64, error)

GetVatRatesByVatRateID ...

func (*Client) SavePayment

func (cli *Client) SavePayment(ctx context.Context, filters map[string]string) (int64, error)

func (*Client) SavePurchaseDocument

func (cli *Client) SavePurchaseDocument(ctx context.Context, filters map[string]string) (PurchaseDocImportReports, error)

func (*Client) SaveSalesDocument

func (cli *Client) SaveSalesDocument(ctx context.Context, filters map[string]string) (SaleDocImportReports, error)

func (*Client) SaveVatRate added in v1.13.1

func (cli *Client) SaveVatRate(ctx context.Context, filters map[string]string) (*SaveVatRateResult, error)

func (*Client) SaveVatRateBulk added in v1.13.1

func (cli *Client) SaveVatRateBulk(ctx context.Context, bulkRequest []map[string]interface{}, baseFilters map[string]string) (SaveVatRateResponseBulk, error)

func (*Client) SaveVatRateComponent added in v1.13.1

func (cli *Client) SaveVatRateComponent(ctx context.Context, filters map[string]string) (*SaveVatRateComponentResult, error)

func (*Client) SaveVatRateComponentBulk added in v1.13.1

func (cli *Client) SaveVatRateComponentBulk(ctx context.Context, bulkRequest []map[string]interface{}, baseFilters map[string]string) (SaveVatRateComponentResponseBulk, error)

type DocumentManager

type DocumentManager interface {
	SaveSalesDocument(ctx context.Context, filters map[string]string) (SaleDocImportReports, error)
	GetSalesDocuments(ctx context.Context, filters map[string]string) ([]SaleDocument, error)
	GetSalesDocumentsBulk(ctx context.Context, bulkFilters []map[string]interface{}, baseFilters map[string]string) (GetSaleDocumentResponseBulk, error)
	DeleteDocument(ctx context.Context, filters map[string]string) error
	SavePurchaseDocument(ctx context.Context, filters map[string]string) (PurchaseDocImportReports, error)
}

type GetProjectStatusesResponse

type GetProjectStatusesResponse struct {
	Status          common2.Status  `json:"status"`
	ProjectStatuses []ProjectStatus `json:"records"`
}

type GetProjectsResponse

type GetProjectsResponse struct {
	Status   common2.Status `json:"status"`
	Projects []Project      `json:"records"`
}

type GetSaleDocumentBulkItem added in v1.7.5

type GetSaleDocumentBulkItem struct {
	Status        sharedCommon.StatusBulk `json:"status"`
	SaleDocuments []SaleDocument          `json:"records"`
}

type GetSaleDocumentResponseBulk added in v1.7.5

type GetSaleDocumentResponseBulk struct {
	Status    sharedCommon.Status       `json:"status"`
	BulkItems []GetSaleDocumentBulkItem `json:"requests"`
}

type GetSalesDocumentResponse

type GetSalesDocumentResponse struct {
	Status         sharedCommon.Status `json:"status"`
	SalesDocuments []SaleDocument      `json:"records"`
}

type InvoiceRow

type InvoiceRow struct {
	RowID             string      `json:"rowID"`
	StableRowID       string      `json:"stableRowID"`
	ProductID         string      `json:"productID"`
	ItemName          string      `json:"itemName"`
	Barcode           string      `json:"barcode"`
	VatrateID         string      `json:"vatrateID"`
	Amount            string      `json:"amount"`
	Price             string      `json:"price"`
	Discount          string      `json:"discount"`
	BillingStartDate  string      `json:"billingStartDate"`
	BillingEndDate    string      `json:"billingEndDate"`
	Code              string      `json:"code"`
	Code2             string      `json:"code2"`
	FinalNetPrice     float64     `json:"finalNetPrice"`
	FinalPriceWithVAT float64     `json:"finalPriceWithVAT"`
	RowNetTotal       float64     `json:"rowNetTotal"`
	RowVAT            float64     `json:"rowVAT"`
	RowTotal          float64     `json:"rowTotal"`
	CampaignIDs       string      `json:"campaignIDs"`
	Jdoc              interface{} `json:"jdoc"`
}

type Manager

type Manager interface {
	ProjectManager
	DocumentManager
	VatRateManager
	AssignmentsManger
	//payment requests
	SavePayment(ctx context.Context, filters map[string]string) (int64, error)
	GetPayments(ctx context.Context, filters map[string]string) ([]PaymentInfo, error)

	//shopping cart
	CalculateShoppingCart(ctx context.Context, filters map[string]string) (*ShoppingCartTotals, error)
}

type NetTotalsByTaxRate

type NetTotalsByTaxRate struct {
	VatrateID int     `json:"vatrateID"`
	Total     float64 `json:"total"`
}

type PaymentAttribute

type PaymentAttribute struct {
	AttributeName  string `json:"attributeName"`
	AttributeType  string `json:"attributeType"`
	AttributeValue string `json:"attributeValue"`
}

type PaymentInfo

type PaymentInfo struct {
	DocumentID   int    `json:"documentID"` // Invoice ID
	Type         string `json:"type"`       // CASH, TRANSFER, CARD, CREDIT, GIFTCARD, CHECK, TIP
	Date         string `json:"date"`
	Sum          string `json:"sum"`
	CurrencyCode string `json:"currencyCode"` // EUR, USD
	Info         string `json:"info"`         // Information about the payer or payment transaction
	Added        uint64 `json:"added"`
}

type PaymentStatus

type PaymentStatus string

type PaymentType

type PaymentType string

type PostSalesDocumentResponse

type PostSalesDocumentResponse struct {
	Status        sharedCommon.Status  `json:"status"`
	ImportReports SaleDocImportReports `json:"records"`
}

type Project

type Project struct {
	ProjectID    uint   `json:"projectID"`
	Name         string `json:"name"`
	CustomerID   uint   `json:"customerID"`
	CustomerName string `json:"customerName"`
	EmployeeID   uint   `json:"employeeID"`
	EmployeeName string `json:"employeeName"`
	TypeID       uint   `json:"typeID"`
	TypeName     string `json:"typeName"`
	StatusID     uint   `json:"statusID"`
	StatusName   string `json:"statusName"`
	StartDate    string `json:"startDate"`
	EndDate      string `json:"endDate"`
	Notes        string `json:"notes"`
	LastModified uint64 `json:"lastModified"`
}

type ProjectManager

type ProjectManager interface {
	GetProjects(ctx context.Context, filters map[string]string) ([]Project, error)
	GetProjectStatus(ctx context.Context, filters map[string]string) ([]ProjectStatus, error)
}

type ProjectStatus

type ProjectStatus struct {
	ProjectStatusID uint   `json:"projectStatusID"`
	Name            string `json:"name"`
	Finished        byte   `json:"finished"`
	Added           uint64 `json:"added"`
	LastModified    uint64 `json:"lastModified"`
}

type PurchaseDocImportReport

type PurchaseDocImportReport struct {
	InvoiceID    int     `json:"invoiceID"`
	CustomNumber string  `json:"customNumber"`
	Rounding     int     `json:"rounding"`
	Total        float64 `json:"total"`
}

type PurchaseDocImportReports

type PurchaseDocImportReports []PurchaseDocImportReport

type SaleDocImportReport

type SaleDocImportReport struct {
	InvoiceID    int     `json:"invoiceID"`
	InvoiceNo    string  `json:"invoiceNo"`
	CustomNumber string  `json:"customNumber"`
	InvoiceLink  string  `json:"invoiceLink"`
	ReceiptLink  string  `json:"receiptLink"`
	Net          float64 `json:"net"`
	Vat          float64 `json:"vat"`
	Rounding     float64 `json:"rounding"`
	Total        float64 `json:"total"`
}

type SaleDocImportReports

type SaleDocImportReports []SaleDocImportReport

type SaleDocument

type SaleDocument struct {
	ID            int    `json:"id"`
	CurrencyRate  string `json:"currencyRate"`
	WarehouseID   int    `json:"warehouseID"`
	WarehouseName string `json:"warehouseName"`
	Number        string `json:"number"`
	Date          string `json:"date"`
	DeliveryDate  string `json:"deliveryDate"`
	Time          string `json:"time"`

	//Payer if invoice_client_is_payer = 1
	ClientID    int    `json:"clientID"`
	ClientEmail string `json:"clientEmail"`
	//Recipient if invoice_client_is_payer = 1
	ShipToID int `json:"shipToID"`
	//Recipient if invoice_client_is_payer = 0
	CustomerID int `json:"customerID"`
	//Payer if invoice_client_is_payer = 0
	PayerID int `json:"payerID"`

	AddressID                int                 `json:"addressID"`
	PayerAddressID           int                 `json:"payerAddressID"`
	ShipToAddressID          string              `json:"shipToAddressID"`
	ContactID                int                 `json:"contactID"`
	EmployeeID               int                 `json:"employeeID"`
	PaymentDays              string              `json:"paymentDays"`
	Confirmed                string              `json:"confirmed"`
	Notes                    string              `json:"notes"`
	InternalNotes            string              `json:"internalNotes"`
	LastModified             int                 `json:"lastModified"`
	PackingUnitsDescription  string              `json:"packingUnitsDescription"`
	InventoryTransactionDate string              `json:"inventoryTransactionDate"`
	CurrencyCode             string              `json:"currencyCode"`
	ContactName              string              `json:"contactName"`
	ClientName               string              `json:"clientName"`
	ClientCardNumber         string              `json:"clientCardNumber"`
	Type                     string              `json:"type"`
	InvoiceState             string              `json:"invoiceState"`
	PaymentType              string              `json:"paymentType"`
	BaseDocuments            []BaseDocument      `json:"baseDocuments"`
	NetTotal                 float64             `json:"netTotal"`
	VatTotal                 float64             `json:"vatTotal"`
	VatTotalsByTaxRates      VatTotalsByTaxRates `json:"vatTotalsByTaxRate"`
	Rounding                 float64             `json:"rounding"`
	Total                    float64             `json:"total"`
	Paid                     string              `json:"paid"`
	PrintDiscounts           int                 `json:"printDiscounts"`
	ReferenceNumber          string              `json:"referenceNumber"`
	CustomReferenceNumber    string              `json:"customReferenceNumber"`
	PaymentStatus            string              `json:"paymentStatus"`
	Penalty                  string              `json:"penalty"`
	InvoiceLink              string              `json:"invoiceLink"`
	EmployeeName             string              `json:"employeeName"`
	TransportTypeName        string              `json:"transportTypeName"`
	ShipToName               string              `json:"shipToName"`
	ShippingDate             string              `json:"shippingDate"`
	InvoiceRows              []InvoiceRow        `json:"rows"`
	Attributes               []PaymentAttribute  `json:"attributes"`
}

type SaleDocumentsListingDataProvider added in v1.7.5

type SaleDocumentsListingDataProvider struct {
	// contains filtered or unexported fields
}

func NewSaleDocumentsListingDataProvider added in v1.7.5

func NewSaleDocumentsListingDataProvider(erplyClient Manager) *SaleDocumentsListingDataProvider

func (*SaleDocumentsListingDataProvider) Count added in v1.7.5

func (l *SaleDocumentsListingDataProvider) Count(ctx context.Context, filters map[string]interface{}) (int, error)

func (*SaleDocumentsListingDataProvider) Read added in v1.7.5

func (l *SaleDocumentsListingDataProvider) Read(ctx context.Context, bulkFilters []map[string]interface{}, callback func(item interface{})) error

type SavePurchaseDocumentResponse

type SavePurchaseDocumentResponse struct {
	Status        sharedCommon.Status      `json:"status"`
	ImportReports PurchaseDocImportReports `json:"records"`
}

type SaveVatRateBulkItem added in v1.13.1

type SaveVatRateBulkItem struct {
	Status  sharedCommon.StatusBulk `json:"status"`
	Records []SaveVatRateResult     `json:"records"`
}

type SaveVatRateComponentBulkItem added in v1.13.1

type SaveVatRateComponentBulkItem struct {
	Status  sharedCommon.StatusBulk      `json:"status"`
	Records []SaveVatRateComponentResult `json:"records"`
}

type SaveVatRateComponentResponseBulk added in v1.13.1

type SaveVatRateComponentResponseBulk struct {
	Status    sharedCommon.Status            `json:"status"`
	BulkItems []SaveVatRateComponentBulkItem `json:"requests"`
}

type SaveVatRateComponentResult added in v1.13.1

type SaveVatRateComponentResult struct {
	VatRateComponentID int `json:"vatRateComponentID"`
}

type SaveVatRateComponentResultResponse added in v1.13.1

type SaveVatRateComponentResultResponse struct {
	Status                     sharedCommon.Status          `json:"status"`
	SaveVatRateComponentResult []SaveVatRateComponentResult `json:"records"`
}

type SaveVatRateResponseBulk added in v1.13.1

type SaveVatRateResponseBulk struct {
	Status    sharedCommon.Status   `json:"status"`
	BulkItems []SaveVatRateBulkItem `json:"requests"`
}

type SaveVatRateResult added in v1.13.1

type SaveVatRateResult struct {
	VatRateID int `json:"vatRateID"`
}

type SaveVatRateResultResponse added in v1.13.1

type SaveVatRateResultResponse struct {
	Status            sharedCommon.Status `json:"status"`
	SaveVatRateResult []SaveVatRateResult `json:"records"`
}

type ShoppingCartProduct

type ShoppingCartProduct struct {
	ProductID            string  `json:"productID"`
	Amount               string  `json:"amount"`
	OriginalPrice        float64 `json:"originalPrice"`
	OriginalPriceWithVAT float64 `json:"originalPriceWithVAT"`
	FinalPrice           float64 `json:"finalPrice"`
	FinalPriceWithVAT    float64 `json:"finalPriceWithVAT"`
	RowNetTotal          float64 `json:"rowNetTotal"`
	RowTotal             float64 `json:"rowTotal"`
	Discount             float64 `json:"discount"`
}

type ShoppingCartTotals

type ShoppingCartTotals struct {
	Rows     []ShoppingCartProduct `json:"rows"`
	NetTotal float64               `json:"netTotal"`
	VATTotal float64               `json:"vatTotal"`
	Total    float64               `json:"total"`
}

type VatRate

type VatRate struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Rate   string `json:"rate"`
	Code   string `json:"code"`
	Active string `json:"active"`
	//Added        string `json:"added"`
	LastModified string `json:"lastModified"`
}

type VatRateManager

type VatRateManager interface {
	GetVatRates(ctx context.Context, filters map[string]string) (VatRates, error)
	SaveVatRate(ctx context.Context, filters map[string]string) (*SaveVatRateResult, error)
	SaveVatRateBulk(ctx context.Context, bulkRequest []map[string]interface{}, baseFilters map[string]string) (SaveVatRateResponseBulk, error)
	SaveVatRateComponent(ctx context.Context, filters map[string]string) (*SaveVatRateComponentResult, error)
	SaveVatRateComponentBulk(ctx context.Context, bulkRequest []map[string]interface{}, baseFilters map[string]string) (SaveVatRateComponentResponseBulk, error)
}

type VatRates

type VatRates []VatRate

type VatTotalsByTaxRate

type VatTotalsByTaxRate struct {
	VatrateID int     `json:"vatrateID"`
	Total     float64 `json:"total"`
}

type VatTotalsByTaxRates

type VatTotalsByTaxRates []VatTotalsByTaxRate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL