gdrj

package
v0.0.0-...-54a493b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

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 CalcSum

func CalcSum(tkm toolkit.M, masters toolkit.M)

func CalculateLedgerSummary

func CalculateLedgerSummary(payload *PivotParam) ([]*toolkit.M, error)

func CalculateLedgerSummaryAnalysisIdea

func CalculateLedgerSummaryAnalysisIdea(payload *PivotParam) ([]*toolkit.M, error)

func CloseDb

func CloseDb()

func DB

func DB() *orm.DataContext

func Delete

func Delete(o orm.IModel) error

func Find

func Find(o orm.IModel, filter *dbox.Filter, config toolkit.M) (dbox.ICursor, error)

func Get

func Get(o orm.IModel, id interface{}) error

func GetBaseAllocationParams

func GetBaseAllocationParams() []string

func GetDecreasedQty

func GetDecreasedQty(payload *CompFinderParam) (toolkit.Ms, error)

func GetModelData

func GetModelData(docname string) orm.IModel

func GetUniqueBreakDown

func GetUniqueBreakDown(breakdown string) []string

func Mapautotype

func Mapautotype(m toolkit.M)

func Mapstructtype

func Mapstructtype(m toolkit.M, omod orm.IModel)

func Save

func Save(o orm.IModel) error

func SaveDiv

func SaveDiv(a float64, b float64) float64

func SetDb

func SetDb(conn dbox.IConnection) error

func SummarizeLedgerSum

func SummarizeLedgerSum(
	filter *dbox.Filter,
	columns []string,
	datapoints []string,
	fnTransform func(m *toolkit.M) error) ([]*toolkit.M, error)

Types

type Ads

type Ads struct {
	orm.ModelBase                                        `json:"-" bson:"-"`
	ID                                                   string `json:"_id" bson:"_id"`
	Year, Period                                         int
	EntityID, Account, AccountDescription, BrandCategory string
	Brand, Grouping, ApProposalNo, PCID, Src             string
	Amountinidr                                          float64
}

func (*Ads) RecordID

func (t *Ads) RecordID() interface{}

func (*Ads) Save

func (t *Ads) Save() error

func (*Ads) TableName

func (t *Ads) TableName() string

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 BranchGetAll() ([]*Branch, error)

func BranchGetByID

func BranchGetByID(id string) *Branch

func (*Branch) Delete

func (b *Branch) Delete() error

func (*Branch) RecordID

func (b *Branch) RecordID() interface{}

func (*Branch) Save

func (b *Branch) Save() error

func (*Branch) TableName

func (b *Branch) TableName() string

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 BrandGetAll() ([]*Brand, error)

func BrandGetByID

func BrandGetByID(id string) *Brand

func (*Brand) Delete

func (b *Brand) Delete() error

func (*Brand) RecordID

func (b *Brand) RecordID() interface{}

func (*Brand) Save

func (b *Brand) Save() error

func (*Brand) TableName

func (b *Brand) TableName() string

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 ChannelGetAll() ([]*Channel, error)

func ChannelGetByID

func ChannelGetByID(id string) *Channel

func (*Channel) Delete

func (c *Channel) Delete() error

func (*Channel) RecordID

func (c *Channel) RecordID() interface{}

func (*Channel) Save

func (c *Channel) Save() error

func (*Channel) TableName

func (c *Channel) TableName() string

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 (s *CompFinderParam) ConnectToDB() (*mgo.Database, *mgo.Session, error)

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 CsvReport struct {
	orm.ModelBase                                             `bson:"-" json:"-"`
	ID                                                        string `bson:"_id" json:"_id"`
	BranchID, Branch, ChannelID, Channel, Date                string
	GrossAmount, DiscountAmount, ReturnAmount, ReturnDiscount float64
	InvoiceAmount, ReturnInvoiceAmount                        float64
}

func (*CsvReport) RecordID

func (c *CsvReport) RecordID() interface{}

func (*CsvReport) Save

func (c *CsvReport) Save() error

func (*CsvReport) TableName

func (c *CsvReport) TableName() string

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 CustomerGetAll() ([]*Customer, error)

func CustomerGetByID

func CustomerGetByID(id string) *Customer

func CustomerGetContains

func CustomerGetContains(keyword string, otherparam toolkit.M) ([]*Customer, error)

func (*Customer) Delete

func (c *Customer) Delete() error

func (*Customer) RecordID

func (c *Customer) RecordID() interface{}

func (*Customer) Save

func (c *Customer) Save() error

func (*Customer) TableName

func (c *Customer) TableName() string

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 Date struct {
	ID         string
	Date       time.Time
	Month      time.Month
	Quarter    int
	YearTxt    string
	QuarterTxt string
	Year       int
	Fiscal     string
}

func NewDate

func NewDate(yr, mth, dt int) *Date

func SetDate

func SetDate(dt time.Time) *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 EntityGetAll() ([]*Entity, error)

func EntityGetByID

func EntityGetByID(id string) *Entity

func (*Entity) Delete

func (e *Entity) Delete() error

func (*Entity) RecordID

func (e *Entity) RecordID() interface{}

func (*Entity) Save

func (e *Entity) Save() error

func (*Entity) TableName

func (e *Entity) TableName() string

type Filter

type Filter struct {
	Field string      `json:"field"`
	Op    string      `json:"op"`
	Value interface{} `json:"value"`
}

type GDRJModel

type GDRJModel struct {
	orm.ModelBase
	LastUpdate time.Time
}

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

func HeadCountGetByID(id string) *HeadCount

func (*HeadCount) Delete

func (h *HeadCount) Delete() error

func (*HeadCount) RecordID

func (h *HeadCount) RecordID() interface{}

func (*HeadCount) Save

func (h *HeadCount) Save() error

func (*HeadCount) TableName

func (h *HeadCount) TableName() string

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) RecordID

func (s *LedgerSummary) RecordID() interface{}

month,year

func (*LedgerSummary) Save

func (s *LedgerSummary) Save() error

func (*LedgerSummary) TableName

func (s *LedgerSummary) TableName() string

type LedgerTrx

type LedgerTrx struct {
	orm.ModelBase `json:"-" bson:"-"`
	ID            string `json:"_id" bson:"_id"`
	Year          int
	Month         time.Month
	Qty           int
	Date          time.Time
	PeriodID      string
	CompanyCode   string
	PCID          string
	CCID          string
	LedgerAccount string
	Value         float64
}

func (*LedgerTrx) RecordID

func (t *LedgerTrx) RecordID() interface{}

func (*LedgerTrx) TableName

func (t *LedgerTrx) TableName() string

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) BuildFile

func (m *Module) BuildFile(filename string, basepath string) error

func (*Module) CompileFile

func (m *Module) CompileFile(fullpath string) error

func (*Module) ExtractFile

func (m *Module) ExtractFile(compressedSource string, fileName string) error

func (*Module) Get

func (m *Module) Get(search string) ([]Module, error)

func (*Module) PreSave

func (m *Module) PreSave() error

func (*Module) RecordID

func (m *Module) RecordID() interface{}

func (*Module) TableName

func (m *Module) TableName() string

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 OutletGeo struct {
	orm.ModelBase `json:"-" bson:"-"`
	ID            int `json:"_id" bson:"_id"`
	OutletName    string
	City          string
	Region        string
	Area          string
	Zone          string
	National      string
}

func (*OutletGeo) RecordID

func (t *OutletGeo) RecordID() interface{}

func (*OutletGeo) TableName

func (t *OutletGeo) TableName() string

type PLData

type PLData struct {
	PLCode                 string
	PLOrder                string
	Group1, Group2, Group3 string
	Amount                 float64
}

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 GetPLModel(plcode, companyid string,
	yr, month int, outletid, skuid, pcid, ccid string,
	value1, value2, value3 float64,
	source string,
	plconn dbox.IConnection,
	custs, products, profitcenters, costcenters, plmodels toolkit.M,
	addtoexisting bool, save bool) *PLDataModel

func (*PLDataModel) PrepareID

func (s *PLDataModel) PrepareID() interface{}

func (*PLDataModel) RecordID

func (s *PLDataModel) RecordID() interface{}

month,year

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"`
}

func (*PLFinderDetail) GetData

func (p *PLFinderDetail) GetData() ([]*toolkit.M, error)

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 (s *PLFinderParam) ConnectToDB() (*mgo.Database, *mgo.Session, error)

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) GetPLData

func (s *PLFinderParam) GetPLData() ([]*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) Sum

func (s *PLFinderParam) Sum(raw *toolkit.M, i ...string) float64

func (*PLFinderParam) TakeTop4FromCustomerDataBy

func (s *PLFinderParam) TakeTop4FromCustomerDataBy(salesInvoices []*toolkit.M) ([]*toolkit.M, error)

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

func PLModelGetByID(id string) *PLModel

func (*PLModel) Delete

func (t *PLModel) Delete() error

func (*PLModel) RecordID

func (t *PLModel) RecordID() interface{}

func (*PLModel) Save

func (t *PLModel) Save() error

func (*PLModel) TableName

func (t *PLModel) TableName() string

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 PivotParamDataPoint struct {
	Aggr  string `json:"aggr"`
	Field string `json:"field"`
}

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 ProductGetAll() ([]*Product, error)

func ProductGetBySKUID

func ProductGetBySKUID(id string) *Product

func (*Product) Delete

func (p *Product) Delete() error

func (*Product) RecordID

func (p *Product) RecordID() interface{}

func (*Product) Save

func (p *Product) Save() error

func (*Product) TableName

func (p *Product) TableName() string

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
}

func (*Promo) RecordID

func (t *Promo) RecordID() interface{}

func (*Promo) Save

func (t *Promo) Save() error

func (*Promo) TableName

func (t *Promo) TableName() 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

func RawDataPLGetByID(id string) *RawDataPL

func (*RawDataPL) Delete

func (t *RawDataPL) Delete() error

func (*RawDataPL) RecordID

func (t *RawDataPL) RecordID() interface{}

func (*RawDataPL) Save

func (t *RawDataPL) Save() error

func (*RawDataPL) TableName

func (t *RawDataPL) TableName() string

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)

func (*SGA) RecordID

func (b *SGA) RecordID() interface{}

func (*SGA) TableName

func (b *SGA) TableName() string

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

func SGAPLGetByID(id string) *SGAPL

func (*SGAPL) Delete

func (s *SGAPL) Delete() error

func (*SGAPL) RecordID

func (s *SGAPL) RecordID() interface{}

func (*SGAPL) Save

func (s *SGAPL) Save() error

func (*SGAPL) TableName

func (s *SGAPL) TableName() string

type SGAPayload

type SGAPayload struct {
	Year int

	BranchNames  []string
	BranchLvl2   []string
	BranchGroups []string
	CostGroups   []string

	Groups []string
}

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

func SalesGetByID(id string) *Sales

func (*Sales) Delete

func (s *Sales) Delete() error

func (*Sales) RecordID

func (s *Sales) RecordID() interface{}

func (*Sales) Save

func (s *Sales) Save() error

func (*Sales) TableName

func (s *Sales) TableName() string

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 SalesLineRatio struct {
	Global, GlobalVdist, Branch, Brand, SKUID, ChannelID                       float64
	Month, MonthVdist, MonthSKUID, MonthChannel, MonthBranch, MonthVdistBranch float64
	MonthChannelBrand, MonthBrand                                              float64
}

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 TrxToSalesPL(conn dbox.IConnection,
	trx *SalesTrx,
	masters toolkit.M,
	config toolkit.M) *SalesPL

func (*SalesPL) AddData

func (pl *SalesPL) AddData(plcode string, amount float64, models map[string]*PLModel)

func (*SalesPL) AddDataCC

func (pl *SalesPL) AddDataCC(plcode string, amount float64, ccgroup string, models map[string]*PLModel)

func (*SalesPL) CalcCOGSRev

func (pl *SalesPL) CalcCOGSRev(masters toolkit.M)

func (*SalesPL) CalcDamage

func (pl *SalesPL) CalcDamage(masters toolkit.M)

func (*SalesPL) CalcDepre

func (pl *SalesPL) CalcDepre(masters toolkit.M)

func (*SalesPL) CalcDiscountActivity

func (pl *SalesPL) CalcDiscountActivity(masters toolkit.M)

func (*SalesPL) CalcFreight

func (pl *SalesPL) CalcFreight(masters toolkit.M)

func (*SalesPL) CalcPromo

func (pl *SalesPL) CalcPromo(masters toolkit.M)

func (*SalesPL) CalcRoyalties

func (pl *SalesPL) CalcRoyalties(masters toolkit.M)

func (*SalesPL) CalcRoyalties2015

func (pl *SalesPL) CalcRoyalties2015(masters toolkit.M)

func (*SalesPL) CalcRoyalties2016

func (pl *SalesPL) CalcRoyalties2016(masters toolkit.M)

func (*SalesPL) CalcSGARev

func (pl *SalesPL) CalcSGARev(masters toolkit.M)

sgapls

func (*SalesPL) CalcSales

func (pl *SalesPL) CalcSales(masters toolkit.M)

func (*SalesPL) CalcSum

func (pl *SalesPL) CalcSum(masters toolkit.M)

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

func (spl *SalesPL) CleanAndClasify(masters toolkit.M)

func (*SalesPL) PrepareID

func (s *SalesPL) PrepareID() interface{}

func (*SalesPL) RatioCalc

func (pl *SalesPL) RatioCalc(masters toolkit.M)

func (*SalesPL) RecordID

func (s *SalesPL) RecordID() interface{}

func (*SalesPL) Save

func (s *SalesPL) Save() error

func (*SalesPL) TableName

func (s *SalesPL) TableName() string

type SalesPLDetailParam

type SalesPLDetailParam struct {
	SalesPLParam

	PLCode         string `json:"plcode"`
	BreakdownBy    string `json:"breakdownby"`
	BreakdownValue string `json:"breakdownvalue"`
}

func (*SalesPLDetailParam) GetData

func (s *SalesPLDetailParam) GetData() ([]*toolkit.M, error)

type SalesPLParam

type SalesPLParam struct {
	PLs     []string    `json:"pls"`
	Groups  []string    `json:"groups"`
	Aggr    string      `json:"aggr"`
	Filters []toolkit.M `json:"filters"`
}

func (*SalesPLParam) GetData

func (s *SalesPLParam) GetData() ([]*toolkit.M, error)

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

func SalesRDGetByID(id string) *SalesRD

func (*SalesRD) RecordID

func (t *SalesRD) RecordID() interface{}

func (*SalesRD) TableName

func (t *SalesRD) TableName() string

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
}

func (*SalesTrx) PrepareID

func (s *SalesTrx) PrepareID() interface{}

func (*SalesTrx) RecordID

func (s *SalesTrx) RecordID() interface{}

func (*SalesTrx) TableName

func (s *SalesTrx) TableName() string

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

func TruckGetByID(id string) *Truck

func (*Truck) Delete

func (t *Truck) Delete() error

func (*Truck) RecordID

func (t *Truck) RecordID() interface{}

func (*Truck) Save

func (t *Truck) Save() error

func (*Truck) TableName

func (t *Truck) TableName() string

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

func TruckCostGetByID(id string) *TruckCost

func (*TruckCost) Delete

func (t *TruckCost) Delete() error

func (*TruckCost) RecordID

func (t *TruckCost) RecordID() interface{}

func (*TruckCost) Save

func (t *TruckCost) Save() error

func (*TruckCost) TableName

func (t *TruckCost) TableName() string

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 TruckOutletKey struct {
	BranchID string
	Fiscal   string
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL