Documentation ¶
Index ¶
- func DeleteInvoice(id primitive.ObjectID) error
- func DeleteTransport(id primitive.ObjectID) error
- func DeleteTransporter(id primitive.ObjectID) error
- func ModifyInvoice(id primitive.ObjectID, ni Invoice) error
- func ModifyTransport(id primitive.ObjectID, nt Transport) error
- func ModifyTransporter(id primitive.ObjectID, nt Transporter) error
- func SaveInvoice(i Invoice) (primitive.ObjectID, error)
- func SaveTransport(t *Transport) (primitive.ObjectID, error)
- func SaveTransporter(t Transporter) (primitive.ObjectID, error)
- type Invoice
- type Transport
- type Transporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteInvoice ¶ added in v1.0.0
Delete invoice from DB
func DeleteTransport ¶ added in v1.0.0
Delete transport vehicle from DB
func DeleteTransporter ¶ added in v1.0.0
Delete transporter from DB
func ModifyInvoice ¶ added in v1.0.0
modify invoice in DB
func ModifyTransport ¶ added in v1.0.0
modify transport in DB
func ModifyTransporter ¶ added in v1.0.0
func ModifyTransporter(id primitive.ObjectID, nt Transporter) error
modify transporter in DB
func SaveInvoice ¶ added in v1.0.0
add invoice to db
func SaveTransport ¶ added in v1.0.0
add transport vehicle to db
func SaveTransporter ¶ added in v1.0.0
func SaveTransporter(t Transporter) (primitive.ObjectID, error)
add transporter to db
Types ¶
type Invoice ¶
type Invoice struct { Id primitive.ObjectID `bson:"_id,omitempty" json:"Id"` // not the same as invoice number InvoiceNumber int `bson:"InvoiceNumber" json:"InvoiceNumber"` CreatedAt time.Time `bson:"CreatedAt" json:"CreatedAt"` LastUpdated time.Time `bson:"LastUpdated,omitempty" json:"LastUpdated"` Recipient client.Client `bson:"Recipient" json:"Recipient"` Paid bool `bson:"Paid" json:"Paid"` TransactionId string `bson:"TransactionId" json:"TransactionId"` Transport Transport `bson:"Transport" json:"Transport"` // user can apply a discount on the whole invoice // TODO: float64 isn't the best for this DiscountPercentage float64 `bson:"DiscountPercentage" json:"DiscountPercentage"` /* client may have multiple shipping * addresses but invoice only has one. * Empty ShippingAddress means shipping * address same as billing address */ BillingAddress client.Address `bson:"BillingAddress" json:"BillingAddress"` ShippingAddress client.Address `bson:"ShippingAddress,omitempty" json:"ShippingAddress"` Items []item.InvoiceItem `bson:"Items" json:"Items"` // user can attach notes to the invoice // frontend decides if recipient sees this or not Note string `bson:"Note" json:"Note"` /* Invoices can be drafts * I personally like this functionality * because we can constantly save the * invoice to the DB as a draft * and if OpenBills crashes or is disconnected * we still have the progress */ Draft bool `bson:"Draft" json:"Draft"` }
The *legendary* Invoice struct * Each Recipient, Item in invoice, Address * every detail that can change in the future is * saved in the database so even if values change * the invoice will have the old details * * The _id of the items/recipients will also be stored * so user can look at the new values of those fields * if needed. This system is better because if * item is deleted from the Db it won't mess * up the invoice collection * * Things like IGST, CGST, Discount, Quantity, etc * should be calculated on runtime. * * usually an invoice would store the currency * for payment. OpenBills does NOT support * international billing. The Db will hold the config * for the default currency, etc.
TODO: add place of supply
type Transport ¶
type Transport struct { Id primitive.ObjectID `bson:"_id,omitempty" json:"Id"` Transporter Transporter `bson:"Transporter,omitempty" json:"Transporter"` VehicleNum string `bson:"VehicleNum" json:"VehicleNum"` Note string `bson:"Note" json:"Note"` TransportMethod string `bson:"TransportMethod" json:"TransportMethod"` }
transport vehicle details
type Transporter ¶
type Transporter struct { Id primitive.ObjectID `bson:"_id,omitempty" json:"Id"` Name string `bson:"Name" json:"Name"` GSTIN string `bson:"GSTIN" json:"GSTIN"` // Issued ID for the transporter if any TransporterId string `bson:"TransporterId,omitempty" json:"TransporterId"` }
Transporter details can be stored in * the DB. That is decided by the frontend. * You can optionally store Transporter * and Transport details which are often used
func GetTransporters ¶ added in v0.0.2
func GetTransporters(filter bson.M) ([]Transporter, error)
Click to show internal directories.
Click to hide internal directories.