更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -8,15 +8,10 @@ import (
|
||||
"server/models"
|
||||
)
|
||||
|
||||
// BackendErpReportController 进销存报表:购销汇总、收发存、毛利、客户RFM、经营看板
|
||||
//
|
||||
// 统计口径全部来自「已生效」单据与库存流水,草稿/审批中/作废不参与,
|
||||
// 这样报表数字与账务(往来账、库存结存)永远一致。
|
||||
type BackendErpReportController struct {
|
||||
BackendErpBaseController
|
||||
}
|
||||
|
||||
// reportRange 解析日期区间,默认当月
|
||||
func (c *BackendErpReportController) reportRange() (time.Time, time.Time) {
|
||||
from, to := erpMonthRange(0)
|
||||
if d := strings.TrimSpace(c.GetString("date_from")); d != "" {
|
||||
@@ -38,7 +33,6 @@ func erpMonthRange(offsetMonths int) (time.Time, time.Time) {
|
||||
return first, first.AddDate(0, 1, 0)
|
||||
}
|
||||
|
||||
// approvedDocIDs 区间内已生效单据ID(按类型)
|
||||
func erpApprovedDocIDs(tid string, docTypes []string, from, to time.Time, partnerID uint64) []uint64 {
|
||||
qs := models.Orm.QueryTable(new(models.ErpDocument)).
|
||||
Filter("tenant_id", tid).
|
||||
@@ -68,7 +62,6 @@ func erpItemsByDocs(tid string, docIDs []uint64) []models.ErpDocumentItem {
|
||||
return out
|
||||
}
|
||||
|
||||
// PurchaseSummary GET /backend/erp/report/purchase 采购汇总(dimension=product|supplier|month)
|
||||
func (c *BackendErpReportController) PurchaseSummary() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -82,7 +75,6 @@ func (c *BackendErpReportController) PurchaseSummary() {
|
||||
c.ok(erpSummaryReportData(group, items, docPartner, returnItems))
|
||||
}
|
||||
|
||||
// SalesSummary GET /backend/erp/report/sales 销售汇总(dimension=product|customer|month)
|
||||
func (c *BackendErpReportController) SalesSummary() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -96,7 +88,6 @@ func (c *BackendErpReportController) SalesSummary() {
|
||||
c.ok(erpSummaryReportData(group, items, docPartner, returnItems))
|
||||
}
|
||||
|
||||
// Rank GET /backend/erp/report/rank 热销/滞销排行
|
||||
func (c *BackendErpReportController) Rank() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -113,8 +104,6 @@ func (c *BackendErpReportController) Rank() {
|
||||
c.ok(data)
|
||||
}
|
||||
|
||||
// StockMove GET /backend/erp/report/stockmove 收发存汇总表
|
||||
// 期末取自库存结存,本期收发取自库存流水,期初=期末-(入-出),保证与账实一致。
|
||||
func (c *BackendErpReportController) StockMove() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -142,8 +131,6 @@ func (c *BackendErpReportController) StockMove() {
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// Profit GET /backend/erp/report/profit 毛利分析:收入=销售出库金额-销售退货金额,
|
||||
// 成本取库存流水的实际出库成本(移动加权),不受手工录入影响。
|
||||
func (c *BackendErpReportController) Profit() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -158,7 +145,6 @@ func (c *BackendErpReportController) Profit() {
|
||||
c.ok(data)
|
||||
}
|
||||
|
||||
// RFM GET /backend/erp/report/rfm 客户价值分层(R最近购买/F频次/M金额)
|
||||
func (c *BackendErpReportController) RFM() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -196,7 +182,6 @@ func (c *BackendErpReportController) RFM() {
|
||||
}
|
||||
amount := d.ActualAmount
|
||||
if d.DocType == models.ErpDocSalesReturn {
|
||||
// 退货只冲减金额,不计购买频次、不影响最近购买时间
|
||||
r.MAmount -= amount
|
||||
continue
|
||||
}
|
||||
@@ -223,7 +208,7 @@ func (c *BackendErpReportController) RFM() {
|
||||
mMed := erpMedian(ms)
|
||||
for _, r := range list {
|
||||
r.MAmount = round2f(r.MAmount)
|
||||
r.RScore = erpHighScore(float64(r.RDays), rMed, true) // R 越小越好
|
||||
r.RScore = erpHighScore(float64(r.RDays), rMed, true)
|
||||
r.FScore = erpHighScore(float64(r.FCount), fMed, false)
|
||||
r.MScore = erpHighScore(r.MAmount, mMed, false)
|
||||
r.Segment = erpRFMSegment(r.RScore, r.FScore, r.MScore)
|
||||
@@ -244,7 +229,6 @@ func (c *BackendErpReportController) RFM() {
|
||||
})
|
||||
}
|
||||
|
||||
// Dashboard GET /backend/erp/report/dashboard 经营看板
|
||||
func (c *BackendErpReportController) Dashboard() {
|
||||
cl, err := c.claims()
|
||||
if c.denied(err) {
|
||||
@@ -253,8 +237,6 @@ func (c *BackendErpReportController) Dashboard() {
|
||||
c.ok(erpDashboardCore(erpNewActor(cl), c.GetString("period")))
|
||||
}
|
||||
|
||||
// ---- 汇总报表共用:聚合实现见 erp_report_core.go ----
|
||||
|
||||
func absFloat(v float64) float64 {
|
||||
if v < 0 {
|
||||
return -v
|
||||
@@ -297,7 +279,6 @@ func erpMedian(v []float64) float64 {
|
||||
return (c[n/2-1] + c[n/2]) / 2
|
||||
}
|
||||
|
||||
// erpHighScore 1=高于中位数(好),0=低于中位数;reverse=true 表示值越小越好
|
||||
func erpHighScore(v, med float64, reverse bool) int {
|
||||
if reverse {
|
||||
if v <= med {
|
||||
@@ -332,7 +313,6 @@ func erpRFMSegment(r, f, m int) string {
|
||||
}
|
||||
}
|
||||
|
||||
// erpErpPendingTaskCount 待当前用户审批的进销存单据数
|
||||
func erpErpPendingTaskCount(tid, uid uint64) int64 {
|
||||
var rows []models.ApprovalTask
|
||||
_, _ = models.Orm.QueryTable(new(models.ApprovalTask)).
|
||||
|
||||
Reference in new issue
Block a user