Files
backend_jupiter/models/delivery.go
2026-05-25 11:45:56 +05:30

444 lines
20 KiB
Go

package models
import "gorm.io/gorm"
type Deliveries struct {
Deliveryid int `json:"deliveryid" gorm:"Primary_Key"`
Orderheaderid int `json:"orderheaderid"`
Applocationid int `json:"applocationid"`
Configid int `json:"configid"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Moduleid int `json:"moduleid"`
Locationid int `json:"locationid"`
Categoryid int `json:"categoryid"`
Userid int `json:"userid"`
Subcategoryid int `json:"subcategoryid"`
Orderid string `json:"orderid"`
Deliverydate string `json:"deliverydate"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Acceptedtime string `json:"acceptedtime"`
Canceltime string `json:"canceltime"`
Itemcount int `json:"itemcount"`
Orderamount float64 `json:"orderamount" gorm:"type:numeric"`
Customerid int `json:"customerid"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocationid int `json:"pickuplocationid"`
Pickupaddress string `json:"Pickupaddress"`
Pickuplocation string `json:"pickuplocation"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"pickuplon"`
Deliverycustomerid int `json:"deliverycustomerid"`
Deliverylocationid int `json:"deliverylocationid"`
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverylocation string `json:"deliverylocation"`
Droplat string `json:"droplat"`
Droplon string `json:"droplon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Deliverycharges float64 `json:"deliverycharges" gorm:"type:numeric"`
Deliveryamt float64 `json:"deliveryamt" gorm:"type:numeric"`
Deliverytype string `json:"deliverytype"`
Notes string `json:"notes"`
Ordernotes string `json:"ordernotes"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Firstmilekm float64 `json:"firstmilekm" gorm:"type:numeric"`
Firstmilecharges float64 `json:"firstmilecharges" gorm:"type:numeric"`
Lastmilecharges float64 `json:"lastmilecharges" gorm:"type:numeric"`
Ridercharges float64 `json:"ridercharges" gorm:"type:numeric"`
Kms string `json:"kms"`
Actualkms string `json:"actualkms"`
Smsdelivery int `json:"smsdelivery"`
Paymenttype int `json:"paymenttype" gorm:"default:0"`
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 `josn:"quantity"`
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
Collectedamt float64 `json:"collectedamt" gorm:"type:numeric"`
Collectionstatus float64 `json:"collectionstatus" gorm:"type:numeric"`
Ridertime int `json:"ridertime"`
// GPS tracking fields (nullable — old app versions may not send these)
RawLatitude *string `json:"raw_latitude" gorm:"column:raw_latitude"`
RawLongitude *string `json:"raw_longitude" gorm:"column:raw_longitude"`
VelocityLat *string `json:"velocity_lat" gorm:"column:velocity_lat"`
VelocityLng *string `json:"velocity_lng" gorm:"column:velocity_lng"`
Speed *string `json:"speed" gorm:"column:speed"`
Heading *string `json:"heading" gorm:"column:heading"`
Expecteddeliverytime string `json:"expecteddeliverytime"`
Profit float64 `json:"profit"`
Transitminutes float64 `json:"transitminutes" gorm:"type:numeric"`
Calculationdistancekm float64 `json:"calculationdistancekm" gorm:"type:numeric"`
}
type UpdateDeliveryStatus struct {
Deliveryid int `json:"deliveryid"`
Deliverytype string `json:"deliverytype"`
Pickuplocationid int `json:"pickuplocationid"`
Deliverylocationid int `json:"deliverylocationid"`
Orderheaderid int `json:"orderheaderid"`
Userid int `json:"userid"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Acceptedtime string `json:"acceptedtime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"picklon"`
Pickupimage string `json:"pickupimage"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Dropimage string `json:"dropimage"`
Address string `json:"address" gorm:"<-:false"`
Suburb string `json:"suburb" gorm:"<-:false"`
City string `json:"city" gorm:"<-:false"`
State string `json:"state" gorm:"<-:false"`
Postcode string `json:"postcode" gorm:"<-:false"`
Deliveryamt float64 `json:"deliveryamt" gorm:"type:numeric"`
Kms string `json:"kms"`
// Actualkms string `json:"actualkms"`
Riderkms string `json:"riderkms"`
Ridercharges float64 `json:"ridercharges" gorm:"type:numeric"`
Kmcal string `json:"kmcal"`
Notes string `json:"notes"`
Feedback string `json:"feedback"`
Smsdelivery int `json:"smsdelivery"`
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"`
Quantity int `josn:"quantity"`
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
Collectedamt float64 `json:"collectedamt" gorm:"type:numeric"`
Collectionstatus int `json:"collectionstatus" gorm:"default:0"`
Ridertime int `json:"ridertime" gorm:"default:0"`
Bonuspts int `json:"bonuspts"`
Skippedtime string `json:"skippedtime"`
Activelat string `json:"activelat"`
Activelon string `json:"activelon"`
// GPS tracking fields (nullable — old app versions may not send these)
RawLatitude *string `json:"raw_latitude" gorm:"column:raw_latitude"`
RawLongitude *string `json:"raw_longitude" gorm:"column:raw_longitude"`
VelocityLat *string `json:"velocity_lat" gorm:"column:velocity_lat"`
VelocityLng *string `json:"velocity_lng" gorm:"column:velocity_lng"`
Speed *string `json:"speed" gorm:"column:speed"`
Heading *string `json:"heading" gorm:"column:heading"`
Expecteddeliverytime string `json:"expecteddeliverytime"`
Profit float64 `json:"profit"`
Transitminutes float64 `json:"transitminutes" gorm:"type:numeric"`
Calculationdistancekm float64 `json:"calculationdistancekm" gorm:"type:numeric"`
}
type Deliveryinfo struct {
Deliveryid int `json:"deliveryid"`
Orderheaderid int `json:"orderheaderid"`
Applocationid int `json:"applocationid"`
Applocation string `json:"applocation"`
Configid int `json:"configid"`
Partnerid int `json:"partnerid"`
Tenantid int `json:"tenantid"`
Moduleid int `json:"moduleid"`
Locationid int `json:"locationid"`
Categoryid int `json:"categoryid"`
Userid int `json:"userid"`
Subcategoryid int `json:"subcategoryid"`
Orderid string `json:"orderid"`
Deliverydate string `json:"deliverydate"`
Orderstatus string `json:"orderstatus"`
Assigntime string `json:"assigntime"`
Starttime string `json:"starttime"`
Arrivaltime string `json:"arrivaltime"`
Pickuptime string `json:"pickuptime"`
Acceptedtime string `json:"acceptedtime"`
Deliverytime string `json:"deliverytime"`
Canceltime string `json:"canceltime"`
Itemcount int `json:"itemcount"`
Orderamount float64 `json:"orderamount" gorm:"type:numeric"`
Customerid int `json:"customerid"`
Pickupcustomer string `json:"pickupcustomer"`
Pickupcontactno string `json:"pickupcontactno"`
Pickuplocationid int `json:"pickuplocationid"`
Pickupaddress string `json:"Pickupaddress"`
Pickuplocation string `json:"pickuplocation"`
Pickuplat string `json:"pickuplat"`
Pickuplon string `json:"pickuplon"`
Deliverycustomerid int `json:"deliverycustomerid"`
Deliverylocationid int `json:"deliverylocationid"`
Deliverycustomer string `json:"deliverycustomer"`
Deliverycontactno string `json:"deliverycontactno"`
Deliveryaddress string `json:"deliveryaddress"`
Deliverylocation string `json:"deliverylocation"`
Droplat string `json:"droplat"`
Droplon string `json:"droplon"`
Deliverylat string `json:"deliverylat"`
Deliverylong string `json:"deliverylong"`
Deliverycharges float64 `json:"deliverycharges" gorm:"type:numeric"`
Deliveryamt float64 `json:"deliveryamt" gorm:"type:numeric"`
Deliverytype string `json:"deliverytype"`
Notes string `json:"notes"`
Ordernotes string `json:"ordernotes"`
Riderslat string `json:"riderslat"`
Riderslon string `json:"riderslon"`
Firstmilekm float64 `json:"firstmilekm" gorm:"type:numeric"`
Firstmilecharges float64 `json:"firstmilecharges" gorm:"type:numeric"`
Lastmilecharges float64 `json:"lastmilecharges" gorm:"type:numeric"`
Ridercharges float64 `json:"ridercharges" gorm:"type:numeric"`
Kms string `json:"kms"`
Actualkms string `json:"actualkms"`
Riderkms string `json:"riderkms"`
Paymenttype int `json:"paymenttype"`
Tenantname string `json:"tenantname"`
Tenantcontactno string `json:"tenantcontactno"`
Tenanttoken string `json:"tenanttoken"`
Tenantsuburb string `json:"tenantsuburb"`
Tenantcity string `json:"tenantcity"`
Tenantaddress string `json:"tenantaddress"`
Locationname string `json:"locationname"`
Locationcontactno string `json:"locationcontactno"`
Locationsuburb string `json:"locationsuburb"`
Locationaddress string `json:"locationaddress"`
Ridername string `json:"ridername"`
Userfcmtoken string `json:"userfcmtoken"`
Queueid int `json:"queueid"`
Smsdelivery int `json:"smsdelivery"`
Customertoken string `json:"customertoken"`
Ridercontact string `json:"ridercontact"`
Previouskms int `json:"previouskms" `
Cumulativekms int `json:"cumulativekms" `
Step int `json:"step" gorm:"default:0"`
Eta string `json:"eta" gorm:"type:varchar(100);default:''"`
Quantity int `josn:"quantity"`
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
Collectedamt float64 `json:"collectedamt" gorm:"type:numeric"`
Collectionstatus float64 `json:"collectionstatus" gorm:"type:numeric"`
Ridertime int `json:"ridertime"`
Slab string `json:"slab"`
Pricingdate string `json:"pricingdate"`
Baseprice float64 `json:"baseprice" gorm:"type:numeric"`
Minkm int `json:"minkm"`
Priceperkm float64 `json:"priceperkm" gorm:"type:numeric"`
Maxkm int `json:"maxkm"`
Orders int `json:"orders"`
Othercharges float64 `json:"othercharges" gorm:"type:numeric"`
Surgecharges float64 `json:"surgecharges" gorm:"type:numeric"`
Expecteddeliverytime string `json:"expecteddeliverytime"`
Profit float64 `json:"profit"`
Transitminutes float64 `json:"transitminutes" gorm:"type:numeric"`
Calculationdistancekm float64 `json:"calculationdistancekm" gorm:"type:numeric"`
}
type Deliveryqueues struct {
Queueid int `json:"queueid" gorm:"Primary_Key"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Orderheaderid int `json:"orderheaderid"`
Deliveryid int `json:"deliveryid"`
Userid int `json:"userid"`
Partnerid int `json:"partnerid"`
Orderid string `json:"orderid"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Accept int `json:"accept"`
Decline int `json:"decline"`
Queuestatus int `json:"queuestatus"`
}
type Deliverylogs struct {
Logid int `json:"logid" gorm:"Primary_Key"`
Logdate string `json:"logdate"`
Tenantid int `json:"tenantid"`
Locationid int `json:"locationid"`
Orderheaderid int `json:"orderheaderid"`
Deliveryid int `json:"deliveryid"`
Userid int `json:"userid"`
Partnerid int `json:"partnerid"`
Orderid string `json:"orderid"`
Orderstatus string `json:"orderstatus"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
Logstatus *int `json:"logstatus" gorm:"default:0"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
// GPS tracking fields (nullable — old app versions may not send these)
RawLatitude *string `json:"raw_latitude" gorm:"column:raw_latitude"`
RawLongitude *string `json:"raw_longitude" gorm:"column:raw_longitude"`
VelocityLat *string `json:"velocity_lat" gorm:"column:velocity_lat"`
VelocityLng *string `json:"velocity_lng" gorm:"column:velocity_lng"`
Speed *string `json:"speed" gorm:"column:speed"`
Heading *string `json:"heading" gorm:"column:heading"`
}
type Deliverydet struct {
Deliveries int `json:"deliveries"`
Delivered int `json:"Delivered"`
Cancelled int `json:"cancelled"`
Kms float64 `json:"kms" gorm:"type:numeric"`
Amount float64 `json:"amount" gorm:"type:numeric"`
}
type DeliverySummary struct {
Total int `json:"total"`
Created int `json:"created"`
Pending int `json:"pending"`
Accepted int `json:"accepted"`
Arrived int `json:"arrived"`
Picked int `json:"picked"`
Active int `json:"active"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
Skipped int `json:"skipped"`
}
type DeliveryDetailsCount struct {
Assigned int `json:"assigned"`
Accepted int `json:"accepted"`
Arrived int `json:"Arrived"`
Picked int `json:"picked"`
Active int `json:"active"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
}
type ReportSummary struct {
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
Totalorders int `json:"totalorders"`
Orderscreated int `json:"orderscreated"`
Orderspending int `json:"Orderspending"`
Orderscompleted int `json:"orderscompleted"`
Orderscancelled int `json:"orderscancelled"`
Deliveriespending int `json:"deliveriespending"`
Deliveriescompleted int `json:"deliveriescompleted"`
Deliveriescancelled int `json:"deliveriescancelled"`
Paylater float64 `json:"paylater" gorm:"type:numeric"`
Payondelivery float64 `json:"payondelivery" gorm:"type:numeric"`
Kms float64 `json:"kms" gorm:"type:numeric"`
Actualkms float64 `json:"actualkms" gorm:"type:numeric"`
Charges float64 `json:"charges" gorm:"type:numeric"`
Previouskms int `json:"previouskms"`
Cumulativekms int `json:"cumulativekms"`
Deliveryamt float64 `json:"deliveryamt" gorm:"type:numeric"`
Riderkms float64 `json:"riderkms" gorm:"type:numeric"`
Quantity int `josn:"quantity"`
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
Collectedamt float64 `json:"collectedamt" gorm:"type:numeric"`
Collectionstatus float64 `json:"collectionstatus" gorm:"type:numeric"`
}
type UserReportSummary struct {
// 🔹 User (Rider) details
Userid int `json:"userid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Ridercontact string `json:"ridercontact"`
// 🔹 Tenant details
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
// 🔹 Location details
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
// 🔹 Order summary
Totalorders int `json:"totalorders"`
Orderscreated int `json:"orderscreated"`
Orderspending int `json:"orderspending"`
Orderscompleted int `json:"orderscompleted"`
Orderscancelled int `json:"orderscancelled"`
// 🔹 Delivery summary
Deliveriespending int `json:"deliveriespending"`
Deliveriescompleted int `json:"deliveriescompleted"`
Deliveriescancelled int `json:"deliveriescancelled"`
// 🔹 Payment summary
Paylater float64 `json:"paylater"`
Payondelivery float64 `json:"payondelivery"`
// 🔹 Distance summary
Kms float64 `json:"kms"`
Actualkms float64 `json:"actualkms"`
Previouskms float64 `json:"previouskms"`
Cumulativekms float64 `json:"cumulativekms"`
Riderkms float64 `json:"riderkms"`
// 🔹 Amount summary
Charges float64 `json:"charges"`
Deliveryamt float64 `json:"deliveryamt"`
// 🔹 Collection summary
Quantity int `json:"quantity"`
Collectionamt float64 `json:"collectionamt"`
Collectedamt float64 `json:"collectedamt"`
Collectionstatus int `json:"collectionstatus"`
}
type Ridersummary struct {
Userid int `json:"userid"`
Firstname string `json:"firstname"`
Lastname string `json:"lastname"`
Ridercontact string `json:"ridercontact"`
Tenantid int `json:"tenantid"`
Tenantname string `json:"tenantname"`
Locationid int `json:"locationid"`
Locationname string `json:"locationname"`
Totalorders int `json:"totalorders"`
Pending int `json:"pending"`
Assigned int `json:"assigned"`
Accepted int `json:"accepted"`
Picked int `json:"picked"`
Arrived int `json:"arrived"`
Active int `json:"active"`
Skipped int `json:"skipped"`
Delivered int `json:"delivered"`
Cancelled int `json:"cancelled"`
Kms float64 `json:"kms" gorm:"type:numeric"`
Actualkms float64 `json:"actualkms" gorm:"type:numeric"`
Previouskms int `json:"previouskms"`
Cumulativekms int `json:"cumulativekms"`
Payondelivery float64 `json:"payondelivery" gorm:"type:numeric"`
Paylater float64 `json:"Paylater" gorm:"type:numeric"`
Deliveryamt float64 `json:"deliveryamt" gorm:"type:numeric"`
Status string `json:"status"`
Quantity int `josn:"quantity"`
Collectionamt float64 `json:"collectionamt" gorm:"type:numeric"`
Collectedamt float64 `json:"collectedamt" gorm:"type:numeric"`
Collectionstatus float64 `json:"collectionstatus" gorm:"type:numeric"`
}
type DeliveryQuery struct {
Tenantid int
Partnerid int
UserID int
Appuserid int
Applocationid int
Locationid int
Configid int
Fromdate string
ToDate string
Status string
Pageno int
Pagesize int
Conn *gorm.DB
Keyword string `json:"keyword"`
}