461 lines
20 KiB
Go
461 lines
20 KiB
Go
package models
|
|
|
|
type OrderInfo struct {
|
|
Orderheaderid int `json:"orderheaderid"`
|
|
Applocationid int `json:"applocationid"`
|
|
Applocation string `json:"applocation"`
|
|
Tenantid int `json:"tenantid"`
|
|
Partnerid int `json:"partnerid"`
|
|
Locationid int `json:"locationid"`
|
|
Categoryid int `json:"categoryid"`
|
|
Subcategoryid int `json:"subcategoryid"`
|
|
Moduleid int `json:"moduleid"`
|
|
Configid int `json:"configid"`
|
|
Orderid string `json:"orderid"`
|
|
Orderdate string `json:"orderdate"`
|
|
Deliverydate string `json:"deliverydate"`
|
|
Orderstatus string `json:"orderstatus"`
|
|
Deliverystatus string `json:"deliverystatus"`
|
|
Deliveryamt float64 `json:"deliveryamt"`
|
|
Itemcount int `json:"itemcount"`
|
|
Ordernotes string `json:"ordernotes"`
|
|
Kms string `json:"kms"`
|
|
Actualkms string `json:"actualkms"`
|
|
Pending string `json:"Pending"`
|
|
Processing string `json:"processing"`
|
|
Ready string `json:"ready"`
|
|
Cancelled string `json:"cancelled"`
|
|
Delivered string `json:"delivered"`
|
|
Assigntime string `json:"assigntime"`
|
|
Starttime string `json:"starttime"`
|
|
Arrivaltime string `json:"arrivaltime"`
|
|
Pickuptime string `json:"pickuptime"`
|
|
Deliverytime string `json:"deliverytime"`
|
|
Canceltime string `json:"canceltime"`
|
|
Deliverycharge float64 `json:"deliverycharge"`
|
|
Orderamount float64 `json:"orderamount"`
|
|
Customerid int `json:"customerid"`
|
|
Pickupcustomer string `json:"pickupcustomer"`
|
|
Pickupcontactno string `json:"pickupcontactno"`
|
|
Pickuplocationid int `json:"pickuplocationid"`
|
|
Pickupaddress string `json:"pickupaddress"`
|
|
Pickupsuburb string `json:"pickupsuburb"`
|
|
Pickupcity string `json:"pickupcity"`
|
|
Pickuplat string `json:"pickuplat"`
|
|
Pickuplong string `json:"pickuplong"`
|
|
Pickupslot string `json:"pickupslot"`
|
|
Deliveryid int `json:"deliveryid"`
|
|
Deliverycustomerid int `json:"deliverycustomerid"`
|
|
Deliverycustomer string `json:"deliverycustomer"`
|
|
Deliverycontactno string `json:"deliverycontactno"`
|
|
Deliverylocationid int `json:"deliverylocationid"`
|
|
Deliveryaddress string `json:"deliveryaddress"`
|
|
Deliverysuburb string `json:"deliverysuburb"`
|
|
Droplat string `json:"droplat"`
|
|
Droplon string `json:"droplon"`
|
|
Deliverylat string `json:"deliverylat"`
|
|
Deliverylong string `json:"deliverylong"`
|
|
Deliverytype string `json:"deliverytype"`
|
|
Paymenttype int `json:"paymenttype"`
|
|
Tenantname string `json:"tenantname"`
|
|
Tenanttoken string `json:"tenanttoken"`
|
|
Tenantsuburb string `json:"tenantsuburb"`
|
|
Tenantcity string `json:"tenantcity"`
|
|
Tenantcontactno string `json:"tenantcontactno"`
|
|
Tenantpostcode string `json:"tenantpostcode"`
|
|
Tenantaddress string `json:"tenantaddress"`
|
|
Locationname string `json:"locationname"`
|
|
Locationsuburb string `json:"locationsuburb"`
|
|
Locationcity string `json:"locationcity"`
|
|
Locationcontactno string `json:"locationcontactno"`
|
|
Locationaddress string `json:"locationaddress"`
|
|
Rider string `json:"rider"`
|
|
Ridercontactno string `json:"ridercontactno"`
|
|
Riderkms string `json:"riderkms"`
|
|
Smsdelivery int `json:"smsdelivery"`
|
|
Customertoken string `json:"customertoken"`
|
|
Ridertoken string `json:"ridertoken"`
|
|
Previouskms int `json:"previouskms" gorm:"default:0"`
|
|
Cumulativekms int `json:"cumulativekms" gorm:"default:0"`
|
|
Step int `json:"step" gorm:"default:0"`
|
|
Eta string `json:"eta" gorm:"type:varchar(100);default:''"`
|
|
Quantity int `json:"quantity" gorm:"default:0"`
|
|
Collectionamt float64 `json:"collectionamt" gorm:"default:0"`
|
|
Slab string `json:"slab"`
|
|
Pricingdate string `json:"pricingdate"`
|
|
Baseprice float64 `json:"baseprice"`
|
|
Minkm int `json:"minkm"`
|
|
Priceperkm float64 `json:"priceperkm"`
|
|
Maxkm int `json:"maxkm"`
|
|
Orders int `json:"orders"`
|
|
Othercharges float64 `json:"othercharges"`
|
|
Surgecharges float64 `json:"surgecharges"`
|
|
}
|
|
|
|
// type TenantOrders struct {
|
|
// Orderheaderid int `json:"orderheaderid"`
|
|
// Tenantid int `json:"tenantid"`
|
|
// Locationid int `json:"locationid"`
|
|
// Categoryid int `json:"categoryid"`
|
|
// Subcategoryid int `json:"subcategoryid"`
|
|
// Moduleid int `json:"moduleid"`
|
|
// Configid int `json:"configid"`
|
|
// Orderid string `json:"orderid"`
|
|
// Customerid int `json:"customerid"`
|
|
// Customername string `json:"customername"`
|
|
// Contactno string `json:"contactno"`
|
|
// Deliverydate string `json:"deliverydate"`
|
|
// Orderstatus string `json:"orderstatus"`
|
|
// Starttime string `json:"starttime"`
|
|
// Arrivaltime string `json:"arrivaltime"`
|
|
// Pickuptime string `json:"pickuptime"`
|
|
// Deliverytime string `json:"deliverytime"`
|
|
// Deliveryaddress string `json:"deliveryaddress"`
|
|
// Deliverylat string `json:"deliverylat"`
|
|
// Deliverylong string `json:"deliverylong"`
|
|
// Pickupaddress string `json:"pickupaddress"`
|
|
// Pickuplat string `json:"pickuplat"`
|
|
// Pickuplong string `json:"pickuplong"`
|
|
// Droplat string `json:"droplat"`
|
|
// Droplon string `json:"droplon"`
|
|
// Notes string `json:"notes"`
|
|
// Ordernotes string `json:"ordernotes"`
|
|
// Locationname string `json:"locationname"`
|
|
// }
|
|
|
|
type Ordersequences struct {
|
|
Sequenceid int `json:"sequenceid" gorm:"Primary_Key"`
|
|
Tenantid int `json:"tenantid"`
|
|
Orderprefix string `json:"orderprefix" gorm:"default:ORD"`
|
|
Customerprefix string `json:"customerprefix" gorm:"default:CUS"`
|
|
Appointmentprefix string `json:"appointmentprefix" gorm:"default:ORD"`
|
|
Receiptprefix string `json:"receiptprefix" gorm:"default:REC"`
|
|
Paymentprefix string `json:"paymentprefix" gorm:"default:PAY"`
|
|
}
|
|
|
|
type Orders struct {
|
|
Orderheaderid int `json:"orderheaderid" gorm:"Primary_Key"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Applocationid int `json:"applocationid"`
|
|
Moduleid int `json:"moduleid"`
|
|
Partnerid int `json:"partnerid"`
|
|
Configid int `json:"configid"`
|
|
Categoryid int `json:"categoryid"`
|
|
Subcategoryid int `json:"subcategoryid"`
|
|
Orderid string `json:"orderid"`
|
|
Orderdate string `json:"orderdate,omitempty"`
|
|
Deliverytime string `json:"deliverytime"`
|
|
Deliverytype string `json:"deliverytype"`
|
|
Orderstatus string `json:"orderstatus"`
|
|
Pending string `json:"pending"`
|
|
Processing string `json:"processing"`
|
|
Ready string `json:"ready"`
|
|
Delivered string `json:"delivered"`
|
|
Cancelled string `json:"cancelled"`
|
|
Customerid int `json:"customerid"`
|
|
Pickupcustomer string `json:"pickupcustomer"`
|
|
Pickupcontactno string `json:"pickupcontactno"`
|
|
Pickuplandmark string `json:"pickuplandmark"`
|
|
Pickuplocationid int `json:"pickuplocationid"`
|
|
Pickupaddress string `json:"pickupaddress"`
|
|
Pickuplocation string `json:"pickuplocation"`
|
|
Pickupcity string `json:"pickupcity"`
|
|
Pickuplat string `json:"pickuplat"`
|
|
Pickuplong string `json:"pickuplong"`
|
|
Pickupslot string `json:"pickupslot"`
|
|
Deliveryid int `json:"deliveryid"`
|
|
Deliverylocationid int `json:"deliverylocationid"`
|
|
Deliverycustomer string `json:"deliverycustomer"`
|
|
Deliverycontactno string `json:"deliverycontactno"`
|
|
Deliverylandmark string `json:"deliverylandmark"`
|
|
Deliverylocation string `json:"deliverylocation"`
|
|
Deliverycity string `json:"deliverycity"`
|
|
Deliveryaddress string `json:"deliveryaddress"`
|
|
Deliverylat string `json:"deliverylat"`
|
|
Deliverylong string `json:"deliverylong"`
|
|
Promotionid int `json:"promotionid"`
|
|
Promoname string `json:"promoname"`
|
|
Promoterms string `json:"promoterms"`
|
|
Promovalue int `json:"promovalue"`
|
|
Promoamount float64 `json:"promoamount" gorm:"type:numeric"`
|
|
Orderamount float64 `json:"orderamount" gorm:"type:numeric"`
|
|
Taxamount float64 `json:"taxamount" gorm:"type:numeric"`
|
|
Ordercharges float64 `json:"ordercharges" gorm:"type:numeric"`
|
|
Ordervalue float64 `json:"ordervalue" gorm:"type:numeric"`
|
|
Itemcount int `json:"itemcount"`
|
|
Paymenttype int `json:"paymenttype"`
|
|
Paymentstatus int `json:"paymentstatus"`
|
|
Deliverycharge float64 `json:"deliverycharge" gorm:"type:numeric"`
|
|
Ordernotes string `json:"ordernotes"`
|
|
Kms string `json:"kms"`
|
|
Remarks string `json:"remarks"`
|
|
Tenantuserid int `json:"tenantuserid"`
|
|
Partneruserid int `json:"partneruserid"`
|
|
Smsdelivery int `json:"smsdelivery" gorm:"default:0"`
|
|
Quantity int `josn:"quantity"`
|
|
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
|
|
Items []OrderDetail `json:"items" gorm:"-"`
|
|
}
|
|
|
|
type OrderDetail struct {
|
|
Orderdetailid int `json:"orderdetailid" gorm:"primaryKey;autoIncrement"`
|
|
Orderheaderid int `json:"orderheaderid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Productid int `json:"productid"`
|
|
Productname string `json:"productname"`
|
|
Productdescription string `json:"productdescription"`
|
|
Supplyqty float64 `json:"supplyqty"`
|
|
Balanceqty float64 `json:"balanceqty"`
|
|
Orderqty float64 `json:"orderqty"`
|
|
Price float64 `json:"price"`
|
|
Unitid int `json:"unitid"`
|
|
Unitname string `json:"unitname"`
|
|
Productaddonid int `json:"productaddonid"`
|
|
Addontypeid int `json:"addontypeid"`
|
|
Productmapid int `json:"productmapid"`
|
|
Productvariantid int `json:"productvariantid"`
|
|
Productaddondescription string `json:"productaddondescription"`
|
|
Discountid int `json:"discountid"`
|
|
Discountname string `json:"discountname"`
|
|
Discountcode string `json:"discountcode"`
|
|
Discountterms string `json:"discountterms"`
|
|
Discountpercentage float64 `json:"discountpercentage"`
|
|
Discountamount float64 `json:"discountamount"`
|
|
Landingamount float64 `json:"landingamount"`
|
|
Taxpercentage float64 `json:"taxpercentage"`
|
|
Taxamount float64 `json:"taxamount"`
|
|
Productsumprice float64 `json:"productsumprice"`
|
|
Itemstatus string `json:"itemstatus"`
|
|
Delivered string `json:"delivered"`
|
|
Orderamount float64 `json:"-" gorm:"-"`
|
|
Productimage string `json:"productimage" gorm:"-"` // only for JSON
|
|
}
|
|
|
|
// ✅ GORM will now use `orderdetails` instead of `order_details`
|
|
func (OrderDetail) TableName() string {
|
|
return "orderdetails"
|
|
}
|
|
|
|
type OrderDetails struct {
|
|
Orderdetailid int `json:"orderdetailid" gorm:"primaryKey;autoIncrement"`
|
|
Orderheaderid int `json:"orderheaderid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Productid int `json:"productid"`
|
|
Productname string `json:"productname"`
|
|
Productdescription string `json:"productdescription"`
|
|
Supplyqty float64 `json:"supplyqty"`
|
|
Balanceqty float64 `json:"balanceqty"`
|
|
Orderqty float64 `json:"orderqty"`
|
|
Price float64 `json:"price"`
|
|
Unitid int `json:"unitid"`
|
|
Unitname string `json:"unitname"`
|
|
Productaddonid int `json:"productaddonid"`
|
|
Addontypeid int `json:"addontypeid"`
|
|
Productmapid int `json:"productmapid"`
|
|
Productvariantid int `json:"productvariantid"`
|
|
Productaddondescription string `json:"productaddondescription"`
|
|
Discountid int `json:"discountid"`
|
|
Discountname string `json:"discountname"`
|
|
Discountcode string `json:"discountcode"`
|
|
Discountterms string `json:"discountterms"`
|
|
Discountpercentage float64 `json:"discountpercentage"`
|
|
Discountamount float64 `json:"discountamount"`
|
|
Landingamount float64 `json:"landingamount"`
|
|
Taxpercentage float64 `json:"taxpercentage"`
|
|
Taxamount float64 `json:"taxamount"`
|
|
Totaltaxamount float64 `json:"totaltaxamount"`
|
|
Productsumprice float64 `json:"productsumprice"`
|
|
Itemstatus string `json:"itemstatus"`
|
|
Delivered string `json:"delivered"`
|
|
Orderamount float64 `json:"Orderamount"` // 👈 Correct way
|
|
Productimage string `json:"productimage"` // only for JSON
|
|
}
|
|
|
|
func (OrderDetails) TableName() string {
|
|
return "orderdetails"
|
|
}
|
|
|
|
type Customerorder struct {
|
|
Orders Orders `json:"orders"`
|
|
Pickup Customers `json:"pickup"`
|
|
Drop Customers `json:"drop"`
|
|
}
|
|
|
|
type CustomerorderV2 struct {
|
|
Orders Orders `json:"orders"`
|
|
}
|
|
|
|
type Updateorderstatus struct {
|
|
Orderheaderid int `json:"Orderheaderid"`
|
|
Orderstatus string `json:"Orderstatus"`
|
|
Pending string `json:"pending"`
|
|
Processing string `json:"processing"`
|
|
Cancelled string `json:"cancelled"`
|
|
Delivered string `json:"delivered"`
|
|
Userid int `json:"userid"`
|
|
}
|
|
|
|
type Ordersummary struct {
|
|
Total int `json:"total"`
|
|
Created int `json:"created"`
|
|
Pending int `json:"pending"`
|
|
Processing int `json:"processing"`
|
|
Delivered int `json:"delivered"`
|
|
Cancelled int `json:"cancelled"`
|
|
Locationname string `json:"locationname"`
|
|
Applocationid string `json:"applocationid"`
|
|
}
|
|
|
|
type Ordersummarydaily struct {
|
|
Total int `json:"total"`
|
|
Created int `json:"created"`
|
|
Pending int `json:"pending"`
|
|
Processing int `json:"processing"`
|
|
Delivered int `json:"delivered"`
|
|
Cancelled int `json:"cancelled"`
|
|
Tenantid int `json:"tenantid"`
|
|
Tenantname string `json:"tenantname"`
|
|
}
|
|
|
|
type Ordersummarylocation struct {
|
|
Total int `json:"total"`
|
|
Created int `json:"created"`
|
|
Pending int `json:"pending"`
|
|
Processing int `json:"processing"`
|
|
Delivered int `json:"delivered"`
|
|
Cancelled int `json:"cancelled"`
|
|
Locationid int `json:"locationid"`
|
|
Locationname string `json:"locationname"`
|
|
}
|
|
type OrderInsight struct {
|
|
Applocationid int `json:"applocationid" gorm:"Primary_Key"`
|
|
Locationname string `json:"locationname"`
|
|
Ordermonths *Ordermonths `json:"ordermonths" gorm:"-"`
|
|
}
|
|
|
|
type OrderInsightv1 struct {
|
|
Locationid int `json:"locationid" gorm:"Primary_Key"`
|
|
Locationname string `json:"locationname"`
|
|
Ordermonths *Ordermonths `json:"ordermonths" gorm:"-"`
|
|
}
|
|
|
|
type Ordermonths struct {
|
|
Jan int `json:"jan"`
|
|
Feb int `json:"feb"`
|
|
Mar int `json:"mar"`
|
|
Apr int `json:"apr"`
|
|
May int `json:"may"`
|
|
Jun int `json:"jun"`
|
|
Jul int `json:"jul"`
|
|
Aug int `Json:"aug"`
|
|
Sep int `Json:"sep"`
|
|
Oct int `Json:"oct"`
|
|
Nov int `Json:"nov"`
|
|
Dece int `Json:"dece"`
|
|
// Applocationid int `json:"applocationid"`
|
|
}
|
|
|
|
type CustomerOrder struct {
|
|
Orderheaderid int `json:"orderheaderid" gorm:"Primary_Key"`
|
|
Applocationid int `json:"applocationid"`
|
|
Tenantid int `json:"tenantid"`
|
|
Locationid int `json:"locationid"`
|
|
Partnerid int `json:"partnerid"`
|
|
Configid int `json:"configid"`
|
|
Categoryid int `json:"categoryid"`
|
|
Subcategoryid int `json:"subcategoryid"`
|
|
Moduleid int `json:"moduleid"`
|
|
Orderid string `json:"orderid"`
|
|
Orderstatus string `json:"orderstatus"`
|
|
Orderdate string `json:"orderdate,omitempty"`
|
|
Ordernotes string `json:"ordernotes"`
|
|
Itemcount int `json:"itemcount"`
|
|
Deliverytime string `json:"deliverytime"` // alias for delivered
|
|
Pending string `json:"pending"`
|
|
Processing string `json:"processing"`
|
|
Ready string `json:"ready"`
|
|
Delivered string `json:"delivered"` // original delivered column
|
|
Cancelled string `json:"cancelled"`
|
|
Deliverycharge float32 `json:"deliverycharge"`
|
|
Kms string `json:"kms"`
|
|
|
|
Customerid int `json:"customerid"`
|
|
Pickupaddress string `json:"pickupaddress"`
|
|
Pickuplat string `json:"pickuplat"`
|
|
Pickuplong string `json:"pickuplong"`
|
|
Pickupcustomer string `json:"pickupcustomer"`
|
|
Pickupcontactno string `json:"pickupcontactno"`
|
|
Pickuplocation string `json:"pickupsuburb"` // alias
|
|
Pickupcity string `json:"pickupcity"`
|
|
|
|
Deliveryid int `json:"deliverycustomerid"` // alias
|
|
Deliveryaddress string `json:"deliveryaddress"`
|
|
Deliverylat string `json:"deliverylat"`
|
|
Deliverylong string `json:"deliverylong"`
|
|
Deliverytype string `json:"deliverytype"`
|
|
Deliverycustomer string `json:"deliverycustomer"`
|
|
Deliverycontactno string `json:"deliverycontactno"`
|
|
Deliverylocation string `json:"deliverysuburb"` // alias
|
|
Deliverycity string `json:"deliverycity"`
|
|
Paymenttype int `json:"paymenttype"`
|
|
Smsdelivery int `json:"smsdelivery"`
|
|
|
|
// Tenant Info
|
|
Tenantname string `json:"tenantname"`
|
|
Tenanttoken string `json:"tenanttoken"`
|
|
Tenantcontactno string `json:"tenantcontactno"`
|
|
Tenantpostcode string `json:"tenantpostcode"`
|
|
Tenantsuburb string `json:"tenantsuburb"`
|
|
Tenantcity string `json:"tenantcity"`
|
|
|
|
// Location Info
|
|
Locationname string `json:"locationname"`
|
|
Locationcontactno string `json:"locationcontactno"`
|
|
Locationpostcode string `json:"locationpostcode"`
|
|
Locationsuburb string `json:"locationsuburb"`
|
|
Locationcity string `json:"locationcity"`
|
|
|
|
// App Location
|
|
Applocation string `json:"applocation"`
|
|
|
|
// Delivery Info (from `deliveries` table)
|
|
Deliverystatus string `json:"deliverystatus"`
|
|
DeliveryUserID int `json:"deliveryid"` // alias
|
|
Assigntime string `json:"assigntime"`
|
|
Starttime string `json:"starttime"`
|
|
Arrivaltime string `json:"arrivaltime"`
|
|
Pickuptime string `json:"pickuptime"`
|
|
Finaldeliverytime string `json:"finaldeliverytime"` // alias for f.deliverytime
|
|
Canceltime string `json:"canceltime"`
|
|
|
|
// Actualkms sql.NullFloat64 `json:"actualkms"`
|
|
// Riderkms sql.NullFloat64 `json:"riderkms"`
|
|
// Deliveryamt sql.NullFloat64 `json:"deliveryamt"`
|
|
Droplat string `json:"droplat"`
|
|
Droplon string `json:"droplon"`
|
|
|
|
// Rider
|
|
Rider string `json:"rider"`
|
|
Orderamount float64 `json:"orderamount"`
|
|
Taxamount float64 `json:"taxamount"`
|
|
|
|
// Items if applicable
|
|
OrderDetails []OrderDetails `json:"orderdetails" gorm:"-"`
|
|
}
|
|
|
|
type CustomerOrderLocation struct {
|
|
Locationname string `json:"locationname" gorm:"column:locationname"`
|
|
Ordercount int `json:"ordercount" gorm:"column:ordercount"`
|
|
Contactno string `json:"contactno" gorm:"column:contactno"`
|
|
Address string `json:"address" gorm:"column:address"`
|
|
Suburb string `json:"suburb" gorm:"column:suburb"`
|
|
City string `json:"city" gorm:"column:city"`
|
|
State string `json:"state" gorm:"column:state"`
|
|
Postcode string `json:"postcode" gorm:"column:postcode"`
|
|
Latitude float64 `json:"latitude" gorm:"column:latitude"`
|
|
Longitude float64 `json:"longitude" gorm:"column:longitude"`
|
|
}
|