lib/app/quote-helpers.go

97 lines
3.7 KiB
Go

package app
import (
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
)
func (obj *Quote) marshalToSwagger() *ops_models.Quote {
var items []*ops_models.QuoteItem
if obj.Items != nil {
items = []*ops_models.QuoteItem{}
for _, itm := range obj.Items {
items = append(items, itm.MarshalToSwagger())
}
}
var taxTransactions []*ops_models.TaxTransaction
if obj.TaxTransactions != nil {
taxTransactions = []*ops_models.TaxTransaction{}
for _, itm := range obj.TaxTransactions {
taxTransactions = append(taxTransactions, itm.MarshalToSwagger())
}
}
return &ops_models.Quote{
ID: obj.ID,
AccountID: obj.AccountID,
AdditionalAddress: obj.AdditionalAddress.MarshalToOps(),
AdditionalName: obj.AdditionalName,
Amount: obj.Amount,
BillingAddress: obj.BillingAddress.MarshalToOps(),
BillingContactID: obj.BillingContactID,
BillingName: obj.BillingName,
BusinessAddress: obj.BusinessAddress.MarshalToOps(),
BusinessTax: obj.BusinessTax,
CannabisTax: obj.CannabisTax,
ContactID: obj.ContactID,
ContractID: obj.ContractID,
CoordinateID: obj.CoordinateID,
CreatedByID: obj.CreatedByID,
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
CreditTerms: obj.CreditTerms,
CustomerID: obj.CustomerID,
QuoteDate: obj.QuoteDate.Time.Format(dateTimeFormat),
Description: obj.Description,
Discount: obj.Discount,
DiscountAmount: obj.DiscountAmount,
Email: obj.Email,
EndUserID: obj.EndUserID,
EstimatedAmount: obj.EstimatedAmount,
EstimatedBusinessTax: obj.EstimatedBusinessTax,
EstimatedCannabisTax: obj.EstimatedCannabisTax,
EstimatedCOGS: obj.EstimatedCOGS,
EstimatedDiscount: obj.EstimatedDiscount,
EstimatedSalesTax: obj.EstimatedSalesTax,
EstimatedSubtotal: obj.EstimatedSubtotal,
ExpirationDate: obj.ExpirationDate.Time.Format(dateTimeFormat),
Fax: obj.Fax,
GrandTotal: obj.GrandTotal,
IngestID: obj.IngestID,
InstallationDate: obj.InstallationDate.Time.Format(dateTimeFormat),
Items: items,
LastModifiedByID: obj.LastModifiedByID,
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
JobID: obj.JobID,
MonthlyAmount: obj.MonthlyAmount,
Name: obj.Name,
OpportunityID: obj.OpportunityID,
OwnerID: obj.OwnerID,
ParentFK: obj.ParentFK,
PaymentTerms: obj.PaymentTerms,
PeriodID: obj.PeriodID,
Phone: obj.Phone,
PlaceGeoCode: obj.PlaceGeoCode,
PurchaseAmount: obj.PurchaseAmount,
QuoteAmount: obj.QuoteAmount,
QuoteNumber: obj.QuoteNumber,
QuoteToAddress: obj.QuoteToAddress.MarshalToOps(),
QuoteToName: obj.QuoteToName,
Ref: obj.Ref,
SalesRegulation: obj.SalesRegulation,
SalesTax: obj.SalesTax,
ServiceTerm: obj.ServiceTerm,
ShippingAddress: obj.ShippingAddress.MarshalToOps(),
ShippingContactID: obj.ShippingContactID,
ShippingHandling: obj.ShippingHandling,
ShippingName: obj.ShippingName,
Status: obj.Status,
Subtotal: obj.Subtotal,
Tax: obj.Tax,
TaxTransactions: taxTransactions,
TelecomTax: obj.TelecomTax,
TemplateID: obj.TemplateID,
TenantID: obj.TenantID,
Total: obj.Total.MarshalToSwagger(),
TotalPrice: obj.TotalPrice,
Type: obj.Type,
}
}