Documentation
¶
Index ¶
- Constants
- Variables
- func CalcSum(tkm toolkit.M, masters toolkit.M)
- func CalculateLedgerSummary(payload *PivotParam) ([]*toolkit.M, error)
- func CalculateLedgerSummaryAnalysisIdea(payload *PivotParam) ([]*toolkit.M, error)
- func CloseDb()
- func DB() *orm.DataContext
- func Delete(o orm.IModel) error
- func Find(o orm.IModel, filter *dbox.Filter, config toolkit.M) (dbox.ICursor, error)
- func Get(o orm.IModel, id interface{}) error
- func GetBaseAllocationParams() []string
- func GetDecreasedQty(payload *CompFinderParam) (toolkit.Ms, error)
- func GetModelData(docname string) orm.IModel
- func GetUniqueBreakDown(breakdown string) []string
- func Mapautotype(m toolkit.M)
- func Mapstructtype(m toolkit.M, omod orm.IModel)
- func Save(o orm.IModel) error
- func SaveDiv(a float64, b float64) float64
- func SetDb(conn dbox.IConnection) error
- func SummarizeLedgerSum(filter *dbox.Filter, columns []string, datapoints []string, ...) ([]*toolkit.M, error)
- type Ads
- type AllocationFlow
- type Branch
- type BranchTypeEnum
- type Brand
- type COGSConsolidate
- type Channel
- type ChannelTypeEnum
- type CompFinderParam
- func (s *CompFinderParam) ConnectToDB() (*mgo.Database, *mgo.Session, error)
- func (s *CompFinderParam) CountCompData() (bool, error)
- func (s *CompFinderParam) DeletePLCollection(table []string) error
- func (s *CompFinderParam) GenerateCompData() error
- func (s *CompFinderParam) GetCompCollection() ([]*toolkit.M, error)
- func (s *CompFinderParam) GetCompTableName()
- type CostCenter
- type CostCenterType
- type CsvReport
- type Customer
- type CustomerGroup
- type Date
- type DetailParam
- type DirectSalesPL
- type DiscountActivity
- type Entity
- type Filter
- type GDRJModel
- type HBrandCategory
- type HCostCenterGroup
- type HGeographi
- type HeadCount
- type IndirectSalesPL
- type InventoryLevel
- type KeyAccount
- type KeyCustName
- type LedgerAccount
- type LedgerMaster
- type LedgerSummary
- type LedgerTrx
- type MappingInventory
- type MappingProfitCenter
- type MasterArea
- type MasterBranch
- type MasterBranchGroup
- type MasterBranchLvl2
- type MasterChannel
- type MasterCustomerRD
- type MasterFunction
- type MasterReportSubChannel
- type Module
- func (m *Module) BuildFile(filename string, basepath string) error
- func (m *Module) CompileFile(fullpath string) error
- func (m *Module) ExtractFile(compressedSource string, fileName string) error
- func (m *Module) Get(search string) ([]Module, error)
- func (m *Module) PreSave() error
- func (m *Module) RecordID() interface{}
- func (m *Module) TableName() string
- type Organization
- type OutletGeo
- type PLData
- type PLDataModel
- type PLFinderDetail
- type PLFinderParam
- func (s *PLFinderParam) CalculateOutlet(data *[]*toolkit.M) *[]*toolkit.M
- func (s *PLFinderParam) CalculatePL(data *[]*toolkit.M) *[]*toolkit.M
- func (s *PLFinderParam) ConnectToDB() (*mgo.Database, *mgo.Session, error)
- func (s *PLFinderParam) CountOutletData() (bool, string, error)
- func (s *PLFinderParam) CountPLData() (bool, error)
- func (s *PLFinderParam) DeletePLCollection(table []string) error
- func (s *PLFinderParam) GeneratePLData() error
- func (s *PLFinderParam) GetOutletData() ([]*toolkit.M, error)
- func (s *PLFinderParam) GetOutletTable() string
- func (s *PLFinderParam) GetPLCollections() ([]*toolkit.M, error)
- func (s *PLFinderParam) GetPLData() ([]*toolkit.M, error)
- func (s *PLFinderParam) GetPLModelsFollowPLS() ([]*PLModel, error)
- func (s *PLFinderParam) GetPayload(r *knot.WebContext) error
- func (s *PLFinderParam) GetTableName() string
- func (s *PLFinderParam) ParseFilter() *dbox.Filter
- func (s *PLFinderParam) Sum(raw *toolkit.M, i ...string) float64
- func (s *PLFinderParam) TakeTop4FromCustomerDataBy(salesInvoices []*toolkit.M) ([]*toolkit.M, error)
- type PLModel
- type PLStructure
- type PivotParam
- type PivotParamDataPoint
- type PivotParamDimensions
- type Product
- type ProfitCenter
- type Promo
- type PromotionPL
- type RawCustSAPBranch
- type RawCustSAPRD
- type RawCustomerAddressVdist
- type RawDataPL
- type RawSalesExpVdist
- type SGA
- type SGAPL
- type SGAPayload
- type Sales
- type SalesDetail
- type SalesHeader
- type SalesLineRatio
- type SalesMonthly
- type SalesPL
- func (pl *SalesPL) AddData(plcode string, amount float64, models map[string]*PLModel)
- func (pl *SalesPL) AddDataCC(plcode string, amount float64, ccgroup string, models map[string]*PLModel)
- func (pl *SalesPL) CalcCOGSRev(masters toolkit.M)
- func (pl *SalesPL) CalcDamage(masters toolkit.M)
- func (pl *SalesPL) CalcDepre(masters toolkit.M)
- func (pl *SalesPL) CalcDiscountActivity(masters toolkit.M)
- func (pl *SalesPL) CalcFreight(masters toolkit.M)
- func (pl *SalesPL) CalcPromo(masters toolkit.M)
- func (pl *SalesPL) CalcRoyalties(masters toolkit.M)
- func (pl *SalesPL) CalcRoyalties2015(masters toolkit.M)
- func (pl *SalesPL) CalcRoyalties2016(masters toolkit.M)
- func (pl *SalesPL) CalcSGARev(masters toolkit.M)
- func (pl *SalesPL) CalcSales(masters toolkit.M)
- func (pl *SalesPL) CalcSum(masters toolkit.M)
- func (spl *SalesPL) CleanAndClasify(masters toolkit.M)
- func (s *SalesPL) PrepareID() interface{}
- func (pl *SalesPL) RatioCalc(masters toolkit.M)
- func (s *SalesPL) RecordID() interface{}
- func (s *SalesPL) Save() error
- func (s *SalesPL) TableName() string
- type SalesPLDetailParam
- type SalesPLParam
- type SalesRD
- type SalesRDClean
- type SalesRDManeh
- type SalesRatio
- type SalesResource
- type SalesTrx
- type SubChannel
- type SummaryBPS
- type Truck
- type TruckAssignment
- type TruckCost
- type TruckOutlet
- type TruckOutletKey
- type TruckOutletPayload
- type UploadData
Constants ¶
View Source
const ( TypeBranch BranchTypeEnum = 1 OfficeBranch = 2 FactoryBranch = 3 )
View Source
const ( ExportChannel ChannelTypeEnum = 1 GeneralTradeChannel = 2 ModernTradeChannel = 3 IndustrialTradeChannel = 4 MotoristChannel = 5 RegionalDistributorChannel = 6 )
Variables ¶
View Source
var ( NetMarginPLCode string = "PL74D" NetMarginPLHeader string = "Net Margin" )
View Source
var (
BaseParams = []string{"startperiode", "endperiode", "outletid", "skuid"}
)
Functions ¶
func CalculateLedgerSummary ¶
func CalculateLedgerSummary(payload *PivotParam) ([]*toolkit.M, error)
func CalculateLedgerSummaryAnalysisIdea ¶
func CalculateLedgerSummaryAnalysisIdea(payload *PivotParam) ([]*toolkit.M, error)
func DB ¶
func DB() *orm.DataContext
func GetBaseAllocationParams ¶
func GetBaseAllocationParams() []string
func GetDecreasedQty ¶
func GetDecreasedQty(payload *CompFinderParam) (toolkit.Ms, error)
func GetModelData ¶
func GetUniqueBreakDown ¶
func Mapautotype ¶
func SetDb ¶
func SetDb(conn dbox.IConnection) error
Types ¶
type Ads ¶
type AllocationFlow ¶
type AllocationFlow struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Name string
Description string
Params toolkit.M
Modules []*Module
StartExec time.Time
EndExec time.Time
Logfile string
ExecBy string //User login
}
func (*AllocationFlow) Exec ¶
func (m *AllocationFlow) Exec()
func (*AllocationFlow) PreSave ¶
func (m *AllocationFlow) PreSave()
func (*AllocationFlow) RecordID ¶
func (m *AllocationFlow) RecordID() interface{}
func (*AllocationFlow) TableName ¶
func (m *AllocationFlow) TableName() string
type Branch ¶
type Branch struct {
GDRJModel `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BranchID
Name string
Location string
Other string
}
func BranchGetAll ¶
func BranchGetByID ¶
type BranchTypeEnum ¶
type BranchTypeEnum int
func (BranchTypeEnum) String ¶
func (b BranchTypeEnum) String() string
type Brand ¶
type Brand struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func BrandGetAll ¶
func BrandGetByID ¶
type COGSConsolidate ¶
type COGSConsolidate struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Month time.Month
Year int
BrandCategory, SubCategory, DistributionChannel, SAPCode, ProductDescription string
GPS_Quantity, GPS_PriceUnit, GPS_Amount, Discount_Amount, NPS_Quantity float64
NPS_PriceUnit, NPS_Amount, RM_PerUnit, RM_Amount, LC_PerUnit, LC_Amount float64
PF_PerUnit, PF_Amount, Other_PerUnit, Other_Amount, Fixed_PerUnit, Fixed_Amount float64
Depre_PerUnit, Depre_Amount, COGS_PerUnit, COGS_Amount, GP_PerUnit, GPN_Amount float64
GPN_Percent, GPG_PerUnit, GPG_Amount, GPG_Percent, Advt_Amount, Promo_Amount float64
TotalAP_Amount, NetProfit_Amount, NetProfit_Percent float64
}
func COGSConsolidateGetByID ¶
func COGSConsolidateGetByID(id string) *COGSConsolidate
func (*COGSConsolidate) Delete ¶
func (co *COGSConsolidate) Delete() error
func (*COGSConsolidate) RecordID ¶
func (co *COGSConsolidate) RecordID() interface{}
func (*COGSConsolidate) Save ¶
func (co *COGSConsolidate) Save() error
func (*COGSConsolidate) TableName ¶
func (co *COGSConsolidate) TableName() string
type Channel ¶
type Channel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func ChannelGetAll ¶
func ChannelGetByID ¶
type ChannelTypeEnum ¶
type ChannelTypeEnum int
func ToChannelEnum ¶
func ToChannelEnum(d int) ChannelTypeEnum
func (ChannelTypeEnum) String ¶
func (c ChannelTypeEnum) String() string
type CompFinderParam ¶
type CompFinderParam struct {
PLs []string `json:"pls"`
Breakdowns []string `json:"groups"`
Filters []*Filter `json:"filters"`
Aggr string `json:"aggr"`
Flag string `json:"flag"`
Tablename string
}
func (*CompFinderParam) ConnectToDB ¶
func (*CompFinderParam) CountCompData ¶
func (s *CompFinderParam) CountCompData() (bool, error)
func (*CompFinderParam) DeletePLCollection ¶
func (s *CompFinderParam) DeletePLCollection(table []string) error
func (*CompFinderParam) GenerateCompData ¶
func (s *CompFinderParam) GenerateCompData() error
func (*CompFinderParam) GetCompCollection ¶
func (s *CompFinderParam) GetCompCollection() ([]*toolkit.M, error)
func (*CompFinderParam) GetCompTableName ¶
func (s *CompFinderParam) GetCompTableName()
type CostCenter ¶
type CostCenter struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //CCID
EntityID string
Name string
CostGroup01 string
CostGroup02 string
CostGroup03 string
BranchID string
BranchType BranchTypeEnum
CCTypeID string
HCCGroupID string
}
func CostCenterGetByID ¶
func CostCenterGetByID(id string) *CostCenter
func (*CostCenter) Delete ¶
func (c *CostCenter) Delete() error
func (*CostCenter) RecordID ¶
func (c *CostCenter) RecordID() interface{}
func (*CostCenter) Save ¶
func (c *CostCenter) Save() error
func (*CostCenter) TableName ¶
func (c *CostCenter) TableName() string
type CostCenterType ¶
type CostCenterType struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //CCTypeID
Name string
}
func CostCenterTypeGetByID ¶
func CostCenterTypeGetByID(id string) *CostCenterType
func (*CostCenterType) Delete ¶
func (c *CostCenterType) Delete() error
func (*CostCenterType) RecordID ¶
func (c *CostCenterType) RecordID() interface{}
func (*CostCenterType) Save ¶
func (c *CostCenterType) Save() error
func (*CostCenterType) TableName ¶
func (c *CostCenterType) TableName() string
type CsvReport ¶
type Customer ¶
type Customer struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Name string
BranchID string
BranchName string
CustAddr1 string
CustAddr2 string
IsRD bool
DepoID string
DepoName string
KeyAccount string
CustType string
ChannelID string
ChannelName string
ReportChannel string
ReportSubChannel string
ChannelOrRD string
CustomerGroup string
CustomerGroupName string
National string
Zone string
Region string
AreaID string
AreaName string
VDIST_ID string
OptionName string
}
func CustomerGetAll ¶
func CustomerGetByID ¶
func CustomerGetContains ¶
type CustomerGroup ¶
type CustomerGroup struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //Group
Name string
}
func CustomerGroupGetAll ¶
func CustomerGroupGetAll() ([]*CustomerGroup, error)
func CustomerGroupGetByID ¶
func CustomerGroupGetByID(id string) *CustomerGroup
func (*CustomerGroup) Delete ¶
func (c *CustomerGroup) Delete() error
func (*CustomerGroup) RecordID ¶
func (c *CustomerGroup) RecordID() interface{}
func (*CustomerGroup) Save ¶
func (c *CustomerGroup) Save() error
func (*CustomerGroup) TableName ¶
func (c *CustomerGroup) TableName() string
type Date ¶
type DetailParam ¶
type DetailParam struct {
PivotParam
PLHeader1 string `json:"plheader1"`
PLHeader2 string `json:"plheader2"`
PLHeader3 string `json:"plheader3"`
}
type DirectSalesPL ¶
type DirectSalesPL struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
OutletID string
SKUID string
PCID string
CCID string
PLItemID string
Amount float64
}
func DirectSalesPLGetByID ¶
func DirectSalesPLGetByID(id string) *DirectSalesPL
func (*DirectSalesPL) Delete ¶
func (d *DirectSalesPL) Delete() error
func (*DirectSalesPL) RecordID ¶
func (d *DirectSalesPL) RecordID() interface{}
func (*DirectSalesPL) Save ¶
func (d *DirectSalesPL) Save() error
func (*DirectSalesPL) TableName ¶
func (d *DirectSalesPL) TableName() string
type DiscountActivity ¶
type DiscountActivity struct {
orm.ModelBase `json:"-" bson:"-"`
ID bson.ObjectId `json:"_id" bson:"_id"`
Year, Period int
AmountinIDR float64
EntityID, Account, AccountDescription string
PCID, CustomerName, City, ChannelName string
ChannelID, BranchID, KeyAccountGroup, KeyAccountCode string
Brand, Order, Material, LongTextOrder, BusinessArea string
}
func (*DiscountActivity) RecordID ¶
func (t *DiscountActivity) RecordID() interface{}
func (*DiscountActivity) Save ¶
func (t *DiscountActivity) Save() error
func (*DiscountActivity) TableName ¶
func (t *DiscountActivity) TableName() string
type Entity ¶
type Entity struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //EntityID
Name string
}
func EntityGetAll ¶
func EntityGetByID ¶
type HBrandCategory ¶
type HBrandCategory struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
BrandID string
Name string
}
func HBrandCategoryGetAll ¶
func HBrandCategoryGetAll() ([]*HBrandCategory, error)
func HBrandCategoryGetByID ¶
func HBrandCategoryGetByID(id string) *HBrandCategory
func (*HBrandCategory) Delete ¶
func (h *HBrandCategory) Delete() error
func (*HBrandCategory) RecordID ¶
func (h *HBrandCategory) RecordID() interface{}
func (*HBrandCategory) Save ¶
func (h *HBrandCategory) Save() error
func (*HBrandCategory) TableName ¶
func (h *HBrandCategory) TableName() string
type HCostCenterGroup ¶
type HCostCenterGroup struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //HCCGroupID
CCTypeID string
Name string
}
func HCostCenterGroupGetAll ¶
func HCostCenterGroupGetAll() ([]*HCostCenterGroup, error)
func HCostCenterGroupGetByID ¶
func HCostCenterGroupGetByID(id string) *HCostCenterGroup
func (*HCostCenterGroup) Delete ¶
func (h *HCostCenterGroup) Delete() error
func (*HCostCenterGroup) RecordID ¶
func (h *HCostCenterGroup) RecordID() interface{}
func (*HCostCenterGroup) Save ¶
func (h *HCostCenterGroup) Save() error
func (*HCostCenterGroup) TableName ¶
func (h *HCostCenterGroup) TableName() string
type HGeographi ¶
type HGeographi struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //Area
Location string
Region string
Zone string
National string
}
func HGeographiGetAll ¶
func HGeographiGetAll() ([]*HGeographi, error)
func HGeographiGetByID ¶
func HGeographiGetByID(id string) *HGeographi
func (*HGeographi) Delete ¶
func (h *HGeographi) Delete() error
func (*HGeographi) RecordID ¶
func (h *HGeographi) RecordID() interface{}
func (*HGeographi) Save ¶
func (h *HGeographi) Save() error
func (*HGeographi) TableName ¶
func (h *HGeographi) TableName() string
type HeadCount ¶
type HeadCount struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
PCID string
CCID string
BranchID string
Level string
Qty int // Qty of employee in that level in month
}
func HeadCountGetByID ¶
type IndirectSalesPL ¶
type IndirectSalesPL struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
PCID string
CCID string
PLItemID string
Amount float64
}
func IndirectSalesPLGetByID ¶
func IndirectSalesPLGetByID(id string) *IndirectSalesPL
func (*IndirectSalesPL) Delete ¶
func (i *IndirectSalesPL) Delete() error
func (*IndirectSalesPL) RecordID ¶
func (i *IndirectSalesPL) RecordID() interface{}
func (*IndirectSalesPL) Save ¶
func (i *IndirectSalesPL) Save() error
func (*IndirectSalesPL) TableName ¶
func (i *IndirectSalesPL) TableName() string
type InventoryLevel ¶
type InventoryLevel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
BranchID string
SKUID_VDIST string
SKUID_SAPBI string
ProductName string
QtyOpen int
QtyReceived int
QtySales int
QtyOther int
QtyBalance int
}
func InventoryLevelGetByID ¶
func InventoryLevelGetByID(id string) *InventoryLevel
func (*InventoryLevel) Delete ¶
func (i *InventoryLevel) Delete() error
func (*InventoryLevel) RecordID ¶
func (i *InventoryLevel) RecordID() interface{}
func (*InventoryLevel) Save ¶
func (i *InventoryLevel) Save() error
func (*InventoryLevel) TableName ¶
func (i *InventoryLevel) TableName() string
type KeyAccount ¶
type KeyAccount struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //KeyAccount
Name string
}
func KeyAccountGetAll ¶
func KeyAccountGetAll() ([]*KeyAccount, error)
func KeyAccountGetByID ¶
func KeyAccountGetByID(id string) *KeyAccount
func (*KeyAccount) Delete ¶
func (k *KeyAccount) Delete() error
func (*KeyAccount) RecordID ¶
func (k *KeyAccount) RecordID() interface{}
func (*KeyAccount) Save ¶
func (k *KeyAccount) Save() error
func (*KeyAccount) TableName ¶
func (k *KeyAccount) TableName() string
type KeyCustName ¶
type KeyCustName struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `bson:"_id" json:"_id"`
Name string
KeyName string
}
func KeyCustNameGetByID ¶
func KeyCustNameGetByID(id string) *KeyCustName
func (*KeyCustName) Delete ¶
func (c *KeyCustName) Delete() error
func (*KeyCustName) RecordID ¶
func (c *KeyCustName) RecordID() interface{}
func (*KeyCustName) Save ¶
func (c *KeyCustName) Save() error
func (*KeyCustName) TableName ¶
func (c *KeyCustName) TableName() string
type LedgerAccount ¶
type LedgerAccount struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //LedgerAccount
Title string
G1 string
G2 string
G3 string
G4 string
}
func FindLedgerAccountLikeId ¶
func FindLedgerAccountLikeId(id string, take, skip int) (arla []*LedgerAccount)
func GetFilteredCustomer ¶
func GetFilteredCustomer(cgroup, keyaccount, cchannel string, take, skip int) (arla []*LedgerAccount)
func LedgerAccountGetAll ¶
func LedgerAccountGetAll() ([]*LedgerAccount, error)
func LedgerAccountGetByID ¶
func LedgerAccountGetByID(id string) *LedgerAccount
func (*LedgerAccount) Delete ¶
func (t *LedgerAccount) Delete() error
func (*LedgerAccount) RecordID ¶
func (t *LedgerAccount) RecordID() interface{}
func (*LedgerAccount) Save ¶
func (t *LedgerAccount) Save() error
func (*LedgerAccount) TableName ¶
func (t *LedgerAccount) TableName() string
type LedgerMaster ¶
type LedgerMaster struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //LedgerMaster
Title string
PLCode string
OrderIndex string
H1 string
H2 string
H3 string
G1 string
G2 string
G3 string
G4 string
}
func LedgerMasterGetByID ¶
func LedgerMasterGetByID(id string) *LedgerMaster
func (*LedgerMaster) Delete ¶
func (t *LedgerMaster) Delete() error
func (*LedgerMaster) RecordID ¶
func (t *LedgerMaster) RecordID() interface{}
func (*LedgerMaster) Save ¶
func (t *LedgerMaster) Save() error
func (*LedgerMaster) TableName ¶
func (t *LedgerMaster) TableName() string
type LedgerSummary ¶
type LedgerSummary struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `bson:"_id"`
PC *ProfitCenter
CC *CostCenter
PLModel *PLModel
CompanyCode string
LedgerAccount string
Customer *Customer
Product *Product
Date *Date
PLGroup1, PLGroup2, PLGroup3, PLGroup4 string
Value1, Value2, Value3 float64
//EasyForSelect
PCID, CCID, OutletID, SKUID, PLCode, PLOrder string
Month time.Month
Year int
Source string
}
func GetLedgerSummaryByDetail ¶
func GetLedgerSummaryByDetail(LedgerAccount, PCID, CCID, OutletID, SKUID string, Year int, Month time.Month) (ls *LedgerSummary)
func LedgerSummaryGetDetailPivot ¶
func LedgerSummaryGetDetailPivot(payload *DetailParam) ([]*LedgerSummary, error)
func (*LedgerSummary) PreSave ¶
func (s *LedgerSummary) PreSave() error
func (*LedgerSummary) PrepareID ¶
func (s *LedgerSummary) PrepareID() interface{}
func (*LedgerSummary) Save ¶
func (s *LedgerSummary) Save() error
func (*LedgerSummary) TableName ¶
func (s *LedgerSummary) TableName() string
type LedgerTrx ¶
type MappingInventory ¶
type MappingInventory struct {
GDRJModel `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //SKUID_SAP
SKUID_VDIST string
}
func MappingInventoryGetAll ¶
func MappingInventoryGetAll() ([]*MappingInventory, error)
func MappingInventoryGetByID ¶
func MappingInventoryGetByID(id string) *MappingInventory
func MappingInventoryGetByIDVdist ¶
func MappingInventoryGetByIDVdist(id string) (mi *MappingInventory)
func (*MappingInventory) Delete ¶
func (mp *MappingInventory) Delete() error
func (*MappingInventory) RecordID ¶
func (mp *MappingInventory) RecordID() interface{}
func (*MappingInventory) Save ¶
func (mp *MappingInventory) Save() error
func (*MappingInventory) TableName ¶
func (mp *MappingInventory) TableName() string
type MappingProfitCenter ¶
type MappingProfitCenter struct {
GDRJModel `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //Material
BranchID string
MaterialDescription string
ProfitCenter string
}
func MappingProfitCenterGetAll ¶
func MappingProfitCenterGetAll() ([]*MappingProfitCenter, error)
func MappingProfitCenterGetByID ¶
func MappingProfitCenterGetByID(id string) *MappingProfitCenter
func (*MappingProfitCenter) Delete ¶
func (mp *MappingProfitCenter) Delete() error
func (*MappingProfitCenter) RecordID ¶
func (mp *MappingProfitCenter) RecordID() interface{}
func (*MappingProfitCenter) Save ¶
func (mp *MappingProfitCenter) Save() error
func (*MappingProfitCenter) TableName ¶
func (mp *MappingProfitCenter) TableName() string
type MasterArea ¶
type MasterArea struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterAreaGetAll ¶
func MasterAreaGetAll() ([]*MasterArea, error)
func (*MasterArea) RecordID ¶
func (c *MasterArea) RecordID() interface{}
func (*MasterArea) TableName ¶
func (c *MasterArea) TableName() string
type MasterBranch ¶
type MasterBranch struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterBranchGetAll ¶
func MasterBranchGetAll() ([]*MasterBranch, error)
func (*MasterBranch) RecordID ¶
func (c *MasterBranch) RecordID() interface{}
func (*MasterBranch) TableName ¶
func (c *MasterBranch) TableName() string
type MasterBranchGroup ¶
type MasterBranchGroup struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterBranchGroupGetAll ¶
func MasterBranchGroupGetAll() ([]*MasterBranchGroup, error)
func (*MasterBranchGroup) RecordID ¶
func (c *MasterBranchGroup) RecordID() interface{}
func (*MasterBranchGroup) TableName ¶
func (c *MasterBranchGroup) TableName() string
type MasterBranchLvl2 ¶
type MasterBranchLvl2 struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterBranchLvl2GetAll ¶
func MasterBranchLvl2GetAll() ([]*MasterBranchLvl2, error)
func (*MasterBranchLvl2) RecordID ¶
func (c *MasterBranchLvl2) RecordID() interface{}
func (*MasterBranchLvl2) TableName ¶
func (c *MasterBranchLvl2) TableName() string
type MasterChannel ¶
type MasterChannel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterChannelGetAll ¶
func MasterChannelGetAll() ([]*MasterChannel, error)
func (*MasterChannel) RecordID ¶
func (c *MasterChannel) RecordID() interface{}
func (*MasterChannel) TableName ¶
func (c *MasterChannel) TableName() string
type MasterCustomerRD ¶
type MasterCustomerRD struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
ChannelID, ChannelName, CustType, CustTypeName string
OutletID string
CustGroup, CustGroupName, CustomerName string
}
func (*MasterCustomerRD) RecordID ¶
func (t *MasterCustomerRD) RecordID() interface{}
func (*MasterCustomerRD) TableName ¶
func (t *MasterCustomerRD) TableName() string
type MasterFunction ¶
type MasterFunction struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
}
func MasterFunctionGetAll ¶
func MasterFunctionGetAll() ([]*MasterFunction, error)
func (*MasterFunction) RecordID ¶
func (c *MasterFunction) RecordID() interface{}
func (*MasterFunction) TableName ¶
func (c *MasterFunction) TableName() string
type MasterReportSubChannel ¶
type MasterReportSubChannel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
Name string
ChannelID string
}
func MasterReportSubChannelGetByChannelID ¶
func MasterReportSubChannelGetByChannelID(channelid string) ([]*MasterReportSubChannel, error)
func (*MasterReportSubChannel) RecordID ¶
func (c *MasterReportSubChannel) RecordID() interface{}
func (*MasterReportSubChannel) TableName ¶
func (c *MasterReportSubChannel) TableName() string
type Module ¶
type Module struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Name string
Description string
BuildPath string
IsCompiled bool //if false do extract and build
LastCompile time.Time
ExecFile string
Applied bool
AddParam []string //except base param, startperiode,endperiode,outletid,skuid
IsActive bool
}
func (*Module) CompileFile ¶
func (*Module) ExtractFile ¶
type Organization ¶
type Organization struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
FullName string
Position string
Image string
Color string
Items []Organization
}
func OrganizationGetByID ¶
func OrganizationGetByID(id string) *Organization
func (*Organization) GetOrganization ¶
func (o *Organization) GetOrganization() error
func (*Organization) RecordID ¶
func (o *Organization) RecordID() interface{}
func (*Organization) TableName ¶
func (o *Organization) TableName() string
type OutletGeo ¶
type PLDataModel ¶
type PLDataModel struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `bson:"_id" json:"_id"`
PC *ProfitCenter
CC *CostCenter
CompanyCode string
//LedgerAccount string
Customer *Customer
Product *Product
Date *Date
Value1, Value2, Value3 float64
//EasyForSelect
PLGroup1, PLGroup2, PLGroup3, PLGroup4 string
PCID, CCID, OutletID, SKUID, PLCode, PLOrder string
Month int
Year int
Source string
}
func GetPLModel ¶
func (*PLDataModel) PrepareID ¶
func (s *PLDataModel) PrepareID() interface{}
func (*PLDataModel) TableName ¶
func (pldm *PLDataModel) TableName() string
type PLFinderDetail ¶
type PLFinderDetail struct {
PLFinderParam
PageSize int `json:"pageSize"`
Take int `json:"take"`
Skip int `json:"skip"`
Page int `json:"page"`
}
type PLFinderParam ¶
type PLFinderParam struct {
PLs []string `json:"pls"`
Breakdowns []string `json:"groups"`
Filters []*Filter `json:"filters"`
Aggr string `json:"aggr"`
Flag string `json:"flag"`
TableKey string `json:"tablekey"`
WhenEmptyUseSalesPLSSummary bool
Limit int
OrderBy string
}
func (*PLFinderParam) CalculateOutlet ¶
func (s *PLFinderParam) CalculateOutlet(data *[]*toolkit.M) *[]*toolkit.M
func (*PLFinderParam) CalculatePL ¶
func (s *PLFinderParam) CalculatePL(data *[]*toolkit.M) *[]*toolkit.M
func (*PLFinderParam) ConnectToDB ¶
func (*PLFinderParam) CountOutletData ¶
func (s *PLFinderParam) CountOutletData() (bool, string, error)
func (*PLFinderParam) CountPLData ¶
func (s *PLFinderParam) CountPLData() (bool, error)
func (*PLFinderParam) DeletePLCollection ¶
func (s *PLFinderParam) DeletePLCollection(table []string) error
func (*PLFinderParam) GeneratePLData ¶
func (s *PLFinderParam) GeneratePLData() error
func (*PLFinderParam) GetOutletData ¶
func (s *PLFinderParam) GetOutletData() ([]*toolkit.M, error)
func (*PLFinderParam) GetOutletTable ¶
func (s *PLFinderParam) GetOutletTable() string
func (*PLFinderParam) GetPLCollections ¶
func (s *PLFinderParam) GetPLCollections() ([]*toolkit.M, error)
func (*PLFinderParam) GetPLModelsFollowPLS ¶
func (s *PLFinderParam) GetPLModelsFollowPLS() ([]*PLModel, error)
func (*PLFinderParam) GetPayload ¶
func (s *PLFinderParam) GetPayload(r *knot.WebContext) error
func (*PLFinderParam) GetTableName ¶
func (s *PLFinderParam) GetTableName() string
func (*PLFinderParam) ParseFilter ¶
func (s *PLFinderParam) ParseFilter() *dbox.Filter
func (*PLFinderParam) TakeTop4FromCustomerDataBy ¶
type PLModel ¶
type PLModel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //PLCode
OrderIndex string
PLHeader1 string
PLHeader2 string
PLHeader3 string
Amount float64
GLReff string
}
func PLModelGetAll ¶
func PLModelGetAll(s *PLFinderParam) ([]*PLModel, error)
func PLModelGetByID ¶
type PLStructure ¶
type PLStructure struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //PLItemID
PLGroup string
PLSubGroup string
Name string
Notes string
}
func PLStructureGetByID ¶
func PLStructureGetByID(id string) *PLStructure
func (*PLStructure) Delete ¶
func (p *PLStructure) Delete() error
func (*PLStructure) RecordID ¶
func (p *PLStructure) RecordID() interface{}
func (*PLStructure) Save ¶
func (p *PLStructure) Save() error
func (*PLStructure) TableName ¶
func (p *PLStructure) TableName() string
type PivotParam ¶
type PivotParam struct {
Dimensions []*PivotParamDimensions `json:"dimensions"`
DataPoints []*PivotParamDataPoint `json:"datapoints"`
Which string `json:"which"`
Filters []toolkit.M `json:"filters"`
Note string `json:"note"`
}
func (*PivotParam) ParseDataPoints ¶
func (p *PivotParam) ParseDataPoints() (res []string)
func (*PivotParam) ParseDimensions ¶
func (p *PivotParam) ParseDimensions() (res []string)
func (*PivotParam) ParseFilter ¶
func (p *PivotParam) ParseFilter() *dbox.Filter
type PivotParamDataPoint ¶
type PivotParamDimensions ¶
type PivotParamDimensions struct {
Field string `json:"field"`
}
type Product ¶
type Product struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `bson:"_id" json:"_id"` //SKUID
Name string
ProdCategory string
Brand string
BrandCategoryID string
PCID string
ProdSubCategory string
ProdSubBrand string
ProdVariant string
ProdDesignType string
}
func ProductGetAll ¶
func ProductGetBySKUID ¶
type ProfitCenter ¶
type ProfitCenter struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //PCID
EntityID string
Name string
BrandID string
BrandCategoryID string
BranchID string
BranchType BranchTypeEnum
}
func ProfitCenterGetByID ¶
func ProfitCenterGetByID(id string) *ProfitCenter
func (*ProfitCenter) Delete ¶
func (p *ProfitCenter) Delete() error
func (*ProfitCenter) RecordID ¶
func (p *ProfitCenter) RecordID() interface{}
func (*ProfitCenter) Save ¶
func (p *ProfitCenter) Save() error
func (*ProfitCenter) TableName ¶
func (p *ProfitCenter) TableName() string
type Promo ¶
type Promo struct {
orm.ModelBase `json:"-" bson:"-"`
ID bson.ObjectId `json:"_id" bson:"_id"`
Year, Period int
AmountinIDR float64
EntityID, Account, AccountDescription, Grouping string
APProposalNo, CCID, PCID, CustomerName, City string
ChannelID, BranchID, KeyAccountGroup, KeyAccountCode, SKUID_BrandCat string
BrandName, Brand string
}
type PromotionPL ¶
type PromotionPL struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
ClaimRefNo string
SKUID_VDIST string
SKUID_SAP string
ExpenseProposal string
DiscountProposal string
OutletNo string
OutletName string
}
func PromotionPLGetByID ¶
func PromotionPLGetByID(id string) *PromotionPL
func (*PromotionPL) Delete ¶
func (p *PromotionPL) Delete() error
func (*PromotionPL) RecordID ¶
func (p *PromotionPL) RecordID() interface{}
func (*PromotionPL) Save ¶
func (p *PromotionPL) Save() error
func (*PromotionPL) TableName ¶
func (p *PromotionPL) TableName() string
type RawCustSAPBranch ¶
type RawCustSAPBranch struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
CSCODE string
CSNAME string
CSADDR1 string
CSADDR2 string
CSAREA string
CSAREATXT string
CSCITY string
CSCITYTXT string
RCSCITY string
RCSCITYTXT string
CSCITYGRP string
CSCHANNEL string
ACCTGRP string
CSGRPTXT string
CSPLANT string
LOCALGRP string
CSDEPO string
CSDEPOTXT string
FLINTRA string
FLACTV string
CSGROUP string
CSTYPE string
CSTYPETXT string
CSWETCODE string
CSWETTXT string
JOINDATE string
PSNO string
CSWEEKCALL string
RDDATASOURCE string
}
func RawCustSAPBranchGetByID ¶
func RawCustSAPBranchGetByID(id string) *RawCustSAPBranch
func (*RawCustSAPBranch) Delete ¶
func (co *RawCustSAPBranch) Delete() error
func (*RawCustSAPBranch) RecordID ¶
func (co *RawCustSAPBranch) RecordID() interface{}
func (*RawCustSAPBranch) Save ¶
func (co *RawCustSAPBranch) Save() error
func (*RawCustSAPBranch) TableName ¶
func (co *RawCustSAPBranch) TableName() string
type RawCustSAPRD ¶
type RawCustSAPRD struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
CS_CODE string
CS_NAME string
CS_AREA string
CS_AREATXT string
CS_CITY string
CS_CITYTXT string
CS_CITYGRP string
CS_GRPTXT string
CS_CHANNEL string
FL_INTRA string
FL_ACTV string
CS_CODENEW string
CS_SAP string
CS_VDIST string
}
func RawCustSAPRDGetByID ¶
func RawCustSAPRDGetByID(id string) *RawCustSAPRD
func (*RawCustSAPRD) Delete ¶
func (co *RawCustSAPRD) Delete() error
func (*RawCustSAPRD) RecordID ¶
func (co *RawCustSAPRD) RecordID() interface{}
func (*RawCustSAPRD) Save ¶
func (co *RawCustSAPRD) Save() error
func (*RawCustSAPRD) TableName ¶
func (co *RawCustSAPRD) TableName() string
type RawCustomerAddressVdist ¶
type RawCustomerAddressVdist struct {
GDRJModel `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
BRSAP string
CS_NO string
CS_ADDR string
CS_POST string
}
func RawCustomerAddressVdistGetAll ¶
func RawCustomerAddressVdistGetAll() ([]*RawCustomerAddressVdist, error)
func RawCustomerAddressVdistGetByID ¶
func RawCustomerAddressVdistGetByID(id string) *RawCustomerAddressVdist
func (*RawCustomerAddressVdist) Delete ¶
func (mp *RawCustomerAddressVdist) Delete() error
func (*RawCustomerAddressVdist) RecordID ¶
func (mp *RawCustomerAddressVdist) RecordID() interface{}
func (*RawCustomerAddressVdist) Save ¶
func (mp *RawCustomerAddressVdist) Save() error
func (*RawCustomerAddressVdist) TableName ¶
func (mp *RawCustomerAddressVdist) TableName() string
type RawDataPL ¶
type RawDataPL struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Period int
Year int
EntityID string
BusA string
Account string
AccountDescription string
AccountInfo string
Grouping string
CCID string
CostCenterName string
PCID string
SKUID string
ProductName string
OutletID string
OutletName string
APGrouping string
APProposalNo string
AmountinIDR float64
AmountinUSD float64
Other string
RDoutletID string
Src string
}
func RawDataPLGetByID ¶
type RawSalesExpVdist ¶
type RawSalesExpVdist struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
EntityID, BusA string
Year int
Period int
Account, Description, OutletID, OutletName string
SKUID, SKU_DESC string
PCID string
CCID string
PLItemID string
Amount float64
Src string
}
func (*RawSalesExpVdist) RecordID ¶
func (s *RawSalesExpVdist) RecordID() interface{}
func (*RawSalesExpVdist) TableName ¶
func (s *RawSalesExpVdist) TableName() string
type SGA ¶
type SGA struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
BranchID string
BranchArea string
BranchName string
BranchLvl2 string
BranchGroup string
Account string
AccountDescription string
AccountGroup string
CostGroup string
Year int
Amount float64
IsElimination bool
}
func SGAGetAll ¶
func SGAGetAll(payload *SGAPayload) ([]*SGA, error)
type SGAPL ¶
type SGAPL struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
PCID string
CCID string
PLItemID string
Amount float64
}
func SGAPLGetByID ¶
type SGAPayload ¶
type Sales ¶
type Sales struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
INVID string
Date time.Time
OutletID string
SKUID string
SalesQty int
SalesGrossAmount float64
SalesTaxAmount float64
SalesDiscountAmount float64
SalesNetAmount float64
}
func SalesGetByID ¶
type SalesDetail ¶
type SalesDetail struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Date time.Time
Month time.Month // ADD By System, Check PRE-SAVE
Year int // ADD By System, Check PRE-SAVE
BranchID string
SalesHeaderID string
SKUID_SAPBI string
SKUID_VDIST string
SalesQty int
Price float64
SalesGrossAmount float64
SalesNetAmount float64
AllocTaxAmount float64
AllocDiscAmount float64
}
func SalesDetailGetByID ¶
func SalesDetailGetByID(id string) *SalesDetail
func (*SalesDetail) Delete ¶
func (sd *SalesDetail) Delete() error
func (*SalesDetail) PreSave ¶
func (s *SalesDetail) PreSave() error
func (*SalesDetail) RecordID ¶
func (sd *SalesDetail) RecordID() interface{}
func (*SalesDetail) Save ¶
func (sd *SalesDetail) Save() error
func (*SalesDetail) TableName ¶
func (sd *SalesDetail) TableName() string
type SalesHeader ¶
type SalesHeader struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Date time.Time
Month time.Month // ADD By System, Check PRE-SAVE
Year int // ADD By System, Check PRE-SAVE
BranchID string
OutletID string
SalesTaxAmount float64
SalesDiscountAmount float64
SalesGrossAmount float64
SalesNetAmount float64
SalesLine int
}
func SalesHeaderGetByID ¶
func SalesHeaderGetByID(id string) *SalesHeader
func (*SalesHeader) Delete ¶
func (sh *SalesHeader) Delete() error
func (*SalesHeader) PreSave ¶
func (s *SalesHeader) PreSave() error
func (*SalesHeader) RecordID ¶
func (sh *SalesHeader) RecordID() interface{}
func (*SalesHeader) Save ¶
func (sh *SalesHeader) Save() error
func (*SalesHeader) TableName ¶
func (sh *SalesHeader) TableName() string
type SalesLineRatio ¶
type SalesMonthly ¶
type SalesMonthly struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month time.Month
OutletID string
SKUID string
SalesQty int
SalesGrossAmount float64 //will be use for allocation formula
SalesTaxAmount float64
SalesDiscountAmount float64
SalesNetAmount float64
}
func SalesMonthlyGetByID ¶
func SalesMonthlyGetByID(id string) *SalesMonthly
func (*SalesMonthly) Delete ¶
func (s *SalesMonthly) Delete() error
func (*SalesMonthly) RecordID ¶
func (s *SalesMonthly) RecordID() interface{}
func (*SalesMonthly) Save ¶
func (s *SalesMonthly) Save() error
func (*SalesMonthly) TableName ¶
func (s *SalesMonthly) TableName() string
type SalesPL ¶
type SalesPL struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `bson:"_id" json:"_id"`
SKUID string
SKUID_VDIST string
OutletID string
SalesQty float64
GrossAmount float64
DiscountAmount float64
TaxAmount float64
NetAmount float64
Date *Date
Customer *Customer
Product *Product
PC *ProfitCenter
CC *CostCenter
Ratio *SalesLineRatio
PLDatas map[string]*PLData
TrxSrc, Source, Ref string
}
func TrxToSalesPL ¶
func (*SalesPL) CalcCOGSRev ¶
func (*SalesPL) CalcDamage ¶
func (*SalesPL) CalcDiscountActivity ¶
func (*SalesPL) CalcFreight ¶
func (*SalesPL) CalcRoyalties ¶
func (*SalesPL) CalcRoyalties2015 ¶
func (*SalesPL) CalcRoyalties2016 ¶
func (*SalesPL) CalcSum ¶
func (pl *SalesPL) Calc(conn dbox.IConnection,
masters toolkit.M,
config toolkit.M) *SalesPL {
pl.NetAmount = pl.GrossAmount - pl.DiscountAmount
//-- classing
if pl.Customer == nil {
c := new(Customer)
c.BranchID = "CD02"
c.CustType = "General"
c.IsRD = false
pl.Customer = c
}
if pl.Customer.ChannelID == "I1" {
pl.Customer.IsRD = true
pl.Customer.ReportChannel = "RD"
pl.Customer.ChannelName = "MT"
} else if pl.Customer.ChannelID == "I3" {
pl.Customer.IsRD = false
pl.Customer.ReportChannel = "MT"
pl.Customer.ChannelName = "MT"
} else if pl.Customer.ChannelID == "I4" {
pl.Customer.IsRD = false
pl.Customer.ReportChannel = "IT"
pl.Customer.ChannelName = "IT"
} else {
pl.Customer.IsRD = false
pl.Customer.ReportChannel = "GT"
pl.Customer.ChannelName = "GT"
}
if pl.Product == nil {
p := new(Product)
p.Brand = "OTHER"
p.Name = "OTHER"
}
//-- end of classing
compute := strings.ToLower(config.Get("compute", "all").(string))
if compute != "none" {
globalSales := masters.Get("globalsales").(float64)
branchSales := masters.Get("branchsales").(map[string]float64)
brandSales := masters.Get("brandsales").(map[string]float64)
var brandSale, branchSale float64
if pl.Product != nil {
brandSale, _ = brandSales[pl.Product.Brand]
}
if pl.Customer != nil {
branchSale, _ = branchSales[pl.Customer.BranchID]
}
if globalSales != 0 {
pl.RatioToGlobalSales = pl.NetAmount / globalSales
}
if brandSale != 0 {
pl.RatioToBrandSales = pl.NetAmount / brandSale
}
if branchSale != 0 {
pl.RatioToBranchSales = pl.NetAmount / branchSale
}
if compute == "all" {
pl.CalcSales(masters)
pl.CalcCOGS(masters)
pl.CalcRoyalties(masters)
pl.CalcDepre(masters)
pl.CalcFreight(masters)
pl.CalcPromo(masters)
pl.CalcSGA(masters)
} else if compute == "sales" {
pl.CalcSales(masters)
} else if compute == "cogs" {
pl.CalcCOGS(masters)
} else if compute == "freight" {
pl.CalcFreight(masters)
} else if compute == "promo" {
pl.CalcRoyalties(masters)
pl.CalcPromo(masters)
} else if compute == "sga" {
pl.CalcSGA(masters)
} else if compute == "rawdatapl" {
pl.CalcFreight(masters)
pl.CalcRoyalties(masters)
pl.CalcPromo(masters)
pl.CalcSGA(masters)
pl.CalcDepre(masters)
} else if compute == "salescogs" {
pl.CalcSales(masters)
pl.CalcCOGS(masters)
}
}
pl.CalcSum(masters)
return pl
}
func (*SalesPL) CleanAndClasify ¶
type SalesPLDetailParam ¶
type SalesPLDetailParam struct {
SalesPLParam
PLCode string `json:"plcode"`
BreakdownBy string `json:"breakdownby"`
BreakdownValue string `json:"breakdownvalue"`
}
type SalesPLParam ¶
type SalesPLParam struct {
PLs []string `json:"pls"`
Groups []string `json:"groups"`
Aggr string `json:"aggr"`
Filters []toolkit.M `json:"filters"`
}
func (*SalesPLParam) GetPLModels ¶
func (s *SalesPLParam) GetPLModels() ([]*PLModel, error)
func (*SalesPLParam) ParseFilter ¶
func (p *SalesPLParam) ParseFilter() *dbox.Filter
type SalesRD ¶
type SalesRD struct {
orm.ModelBase `json:"-" bson:"-"`
ID bson.ObjectId `json:"_id" bson:"_id"`
Period int
Year int
EntityID string
BranchID string
Account int
CCID string
PCID string
SKUID int
ProductName string
OutletID int
OutletName string
AmountinIDR float64
City string
Region string
Area string
Zone string
National string
}
func SalesRDGetByID ¶
type SalesRDClean ¶
type SalesRDClean struct {
orm.ModelBase `json:"-" bson:"-"`
ID bson.ObjectId `json:"_id" bson:"_id"`
Period int
Year int
EntityID string
BranchID string
Account string
CCID string
PCID string
SKUID string
ProductName string
OutletID string
OutletName string
AmountinIDR float64
City string
Region string
Area string
Zone string
National string
}
func (*SalesRDClean) RecordID ¶
func (t *SalesRDClean) RecordID() interface{}
func (*SalesRDClean) Save ¶
func (t *SalesRDClean) Save() error
func (*SalesRDClean) TableName ¶
func (t *SalesRDClean) TableName() string
type SalesRDManeh ¶
type SalesRDManeh struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Month int
Year int
ChannelID, ChannelName, SKUID, ProductName, OutletID, CustomerName string
CustType, CustTypeName, City, Src, CustGroup, CustGroupName string
Amount float64
}
func (*SalesRDManeh) RecordID ¶
func (t *SalesRDManeh) RecordID() interface{}
func (*SalesRDManeh) Save ¶
func (t *SalesRDManeh) Save() error
func (*SalesRDManeh) TableName ¶
func (t *SalesRDManeh) TableName() string
type SalesRatio ¶
type SalesRatio struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Year int
Month int
OutletID string
SKUID string
Ratio float64
Amount float64
BrandCategoryID, BranchID, PCID string
}
func (*SalesRatio) RecordID ¶
func (s *SalesRatio) RecordID() interface{}
func (*SalesRatio) TableName ¶
func (s *SalesRatio) TableName() string
type SalesResource ¶
type SalesResource struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
BranchID string
Year int
Month time.Month
Truck int
Driver int
SalesPerson int
OfficeStaff int
}
func SalesResourceGetByID ¶
func SalesResourceGetByID(id string) *SalesResource
func (*SalesResource) Delete ¶
func (s *SalesResource) Delete() error
func (*SalesResource) RecordID ¶
func (s *SalesResource) RecordID() interface{}
Year Month Truck Driver SalesPerson OfficeStaff
func (*SalesResource) Save ¶
func (s *SalesResource) Save() error
func (*SalesResource) TableName ¶
func (s *SalesResource) TableName() string
type SalesTrx ¶
type SalesTrx struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `bson:"_id" json:"_id"`
SalesHeaderID string
LineNo int
SKUID string
SKUID_VDIST string
OutletID string
Date time.Time
Year, Month int
Fiscal string
SalesQty float64
GrossAmount float64
DiscountAmount float64
TaxAmount float64
NetAmount float64
Src string
HeaderValid bool
ProductValid bool
CustomerValid bool
PCValid bool
Customer *Customer
Product *Product
PC *ProfitCenter
}
type SubChannel ¶
type SubChannel struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //SubChannelID
Title string
}
func SubChannelGetAll ¶
func SubChannelGetAll() ([]*SubChannel, error)
func SubChannelGetByID ¶
func SubChannelGetByID(id string) *SubChannel
func (*SubChannel) Delete ¶
func (e *SubChannel) Delete() error
func (*SubChannel) RecordID ¶
func (e *SubChannel) RecordID() interface{}
func (*SubChannel) Save ¶
func (e *SubChannel) Save() error
func (*SubChannel) TableName ¶
func (e *SubChannel) TableName() string
type SummaryBPS ¶
type SummaryBPS struct {
GDRJModel `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Provinsi string
Population float64
City float64
Urban float64
Family float64
CitySpending float64
UrbanSpending float64
}
func SummaryBPSGetByID ¶
func SummaryBPSGetByID(id string) *SummaryBPS
func (*SummaryBPS) Delete ¶
func (sb *SummaryBPS) Delete() error
func (*SummaryBPS) RecordID ¶
func (sb *SummaryBPS) RecordID() interface{}
func (*SummaryBPS) Save ¶
func (sb *SummaryBPS) Save() error
func (*SummaryBPS) TableName ¶
func (sb *SummaryBPS) TableName() string
type Truck ¶
type Truck struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //TruckID
BranchID string
PlateNo string
Year int
}
func TruckGetByID ¶
type TruckAssignment ¶
type TruckAssignment struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Date time.Time
DriverID string //name, not mandatory
BranchID string
OutletID string
TruckID string
}
func TruckAssignmentGetByID ¶
func TruckAssignmentGetByID(id string) *TruckAssignment
func (*TruckAssignment) Delete ¶
func (t *TruckAssignment) Delete() error
func (*TruckAssignment) RecordID ¶
func (t *TruckAssignment) RecordID() interface{}
func (*TruckAssignment) Save ¶
func (t *TruckAssignment) Save() error
func (*TruckAssignment) TableName ¶
func (t *TruckAssignment) TableName() string
type TruckCost ¶
type TruckCost struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"`
Date time.Time
TruckID string
BranchID string
Mileage int
Gasoline float64
Volume int
Parking float64
Driver float64
Maintenance float64
Other float64
}
func TruckCostGetByID ¶
type TruckOutlet ¶
type TruckOutlet struct {
orm.ModelBase `json:"-" bson:"-"`
ID string `json:"_id" bson:"_id"` //BrandID
NumOutlet int
NumTruct int
BranchName string
BranchLvl2 string
BranchGroup string
IDBranchLvl2 string
Key *TruckOutletKey
}
func (*TruckOutlet) RecordID ¶
func (c *TruckOutlet) RecordID() interface{}
func (*TruckOutlet) TableName ¶
func (c *TruckOutlet) TableName() string
type TruckOutletKey ¶
type TruckOutletPayload ¶
type TruckOutletPayload struct {
BreakdownBy string
FiscalYear string
BranchNames []string
BranchLvl2 []string
BranchGroups []string
}
func (*TruckOutletPayload) TruckOutletGetAll ¶
func (payload *TruckOutletPayload) TruckOutletGetAll() ([]*TruckOutlet, error)
type UploadData ¶
type UploadData struct {
orm.ModelBase `bson:"-" json:"-"`
ID string `json:"_id" bson:"_id"`
Filename string
PhysicalName string
Desc string
DataType string
FieldId string
DocName string
Date time.Time
Datacount float64
Process float64 // 0
Status string // ready, done, failed, onprocess, rollback
Note string
Pid string
Other string
}
func UploadDataGetByID ¶
func UploadDataGetByID(id string) *UploadData
func (*UploadData) Delete ¶
func (u *UploadData) Delete() error
func (*UploadData) PostSave ¶
func (u *UploadData) PostSave() error
func (*UploadData) PreSave ¶
func (u *UploadData) PreSave() error
func (*UploadData) ProcessData ¶
func (u *UploadData) ProcessData(loc string) (err error)
Location will be fullpath
func (*UploadData) RecordID ¶
func (u *UploadData) RecordID() interface{}
func (*UploadData) Save ¶
func (u *UploadData) Save() error
func (*UploadData) TableName ¶
func (u *UploadData) TableName() string
Source Files
¶
- COGSConsolidate.go
- RawDataPL.go
- allocationflow.go
- base.go
- branch.go
- brand.go
- channel.go
- compfinder.go
- costcenter.go
- costcentertype.go
- customer.go
- customergroup.go
- directsalespl.go
- entity.go
- hbrandcategory.go
- hcostcentergroup.go
- headcount.go
- helper.go
- hgeographi.go
- indirectsalespl.go
- inventorylevel.go
- keyaccount.go
- keycustomer.go
- ledgeraccount.go
- ledgermaster.go
- ledgersummary.go
- ledgertrx.go
- mappinginventory.go
- mappingprofitcenter.go
- masterarea.go
- masterbranch.go
- masterbranchgroup.go
- masterbranchlvl2.go
- masterchannel.go
- masterfunction.go
- masterreportsubchannel.go
- module.go
- organization.go
- pldatamodel.go
- plfinder.go
- plmodel.go
- plstructure.go
- product.go
- profitcenter.go
- promotionpl.go
- rawcustomeraddressvdist.go
- rawdatasapbranch.go
- rawdatasaprd.go
- rawsalesexpvdist.go
- sales.go
- salesdetail.go
- salesheader.go
- saleslinepl.go
- saleslineplaggr.go
- salesmonthly.go
- salesratio.go
- salesresource.go
- salestrx.go
- sga.go
- sgapl.go
- subchannel.go
- summarybps.go
- test_miscellanous.go
- truck.go
- truckassignment.go
- truckcost.go
- truckoutlet.go
- uploaddata.go
Click to show internal directories.
Click to hide internal directories.