Skip to content

Commit

Permalink
Version 12.1.12-pre
Browse files Browse the repository at this point in the history
  • Loading branch information
papyrussolution committed Nov 23, 2024
1 parent 0f74f5a commit 8354d46
Show file tree
Hide file tree
Showing 21 changed files with 374 additions and 98 deletions.
6 changes: 6 additions & 0 deletions Src/Include/PPDEFS.H
Original file line number Diff line number Diff line change
Expand Up @@ -1462,6 +1462,8 @@
#define PPTAG_LOT_MP_STOCK_INWAYTO 122L // @v12.1.10 Тег строки документа вида PPOPK_EDI_STOCK. Количество торговых единиц товара, находящихся в пути на склад
#define PPTAG_LOT_MP_STOCK_INWAYFROM 123L // @v12.1.10 Тег строки документа вида PPOPK_EDI_STOCK. Количество торговых единиц товара, находящихся в пути со склада
#define PPTAG_LOT_MP_STOCK_TIMESTAMP 124L // @v12.1.10 Тег строки документа вида PPOPK_EDI_STOCK. Момент актуалности элемента остатков, полученных от маркетплейса.
#define PPTAG_PERSON_SPCTAXGROUP 125L // @v12.1.12 Специальная налоговая ставка персоналии при продаже товаров (инициировано необходимостью определять специальные
// ставки НДС 5% и 7% в России с 2025года).
//
// Зарезервированные идентификаторы глобальных учетных записей
//
Expand Down Expand Up @@ -11684,6 +11686,10 @@
#define CTLSEL_MPCFG_RETOP (8 + WINDOWS_ID_BIAS) // @v12.1.11
#define DLG_FLTORDLOTEXT 1450 // @v12.1.6 Расширение фильтра лотов заказов
#define DLG_GDSOPRMPTOTAL 1451 // @v12.1.11 Итоги товарного отчета по операции в варианте маркетплейса
#define DLG_SELBITMSPCGEN 1452 // @v12.1.12 Выбор специальной генерации для товарных строк документа
#define CTL_SELBITMSPCGEN_WHAT (1 + WINDOWS_ID_BIAS)
#define CTL_SELBITMSPCGEN_INFO (2 + WINDOWS_ID_BIAS)
#define DLG_TRDPLANBILL 1453 // @v12.1.12 Документ торгового плана
// Win32 Dialog Identifiers
//
#define DLGW_PRINT 4090
Expand Down
1 change: 1 addition & 0 deletions Src/Include/Pp.h
Original file line number Diff line number Diff line change
Expand Up @@ -20054,6 +20054,7 @@ class PPObjSecur : public PPObjReference {
#define PPBZSI_SALERETCOUNT 38 // @v12.1.11 "saleretcount" Количество документов возврата от покупателей //
#define PPBZSI_SALERETQTTY 39 // @v12.1.11 "saleretqtty" Возвращенное от покупателей количество торговых единиц
#define PPBZSI_SALERETCOST 40 // @v12.1.11 "saleretcost" Себестоимость возвращенных от покупателей товаров
#define PPBZSI_MPPROMOTION 41 // @v12.1.12 "mppromotion" Расходы на продвижение товаров на маркетплейсах
//
// Флаги значений бизнес-показателей
//
Expand Down
8 changes: 4 additions & 4 deletions Src/Include/ued-id.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// UED-ID.H
// UED-ID-TEMP.H
// version: 36
// sha256: 30e57f6807209c82ededb4610622268085372e2295a608dc2a01fc98fa6e8173
//
#ifndef __UED_ID_H
#define __UED_ID_H
#ifndef __UED_ID_TEMP_H
#define __UED_ID_TEMP_H

#define UED_META_META 0x100000001ULL
#define UED_META_PREDEFVALUE 0x100000002ULL
Expand Down Expand Up @@ -3693,4 +3693,4 @@
#define UED_META_INTEGER 0x197000000ULL
#define UED_META_DECIMAL 0x198000000ULL

#endif // __UED_ID_H
#endif // __UED_ID_TEMP_H
42 changes: 23 additions & 19 deletions Src/PPEquip/atoldrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1781,26 +1781,30 @@ SJson * SCS_ATOLDRV::MakeJson_CCheck(OfdFactors & rOfdf, CCheckPacket * pPack, u
}
}
{ // @v12.1.8
SJson * p_js_indi_array = SJson::CreateArr();
SJson * p_js_indi = SJson::CreateObj();
p_js_indi->InsertString("date", "2022.03.26");
temp_buf.Z();
if(sl_param.ChZnProductType == 4)
temp_buf.Cat("020");
else if(oneof2(sl_param.ChZnProductType, 12, 1012))
temp_buf.Cat("030");
else
temp_buf.Cat("030");
p_js_indi->InsertString("fois", temp_buf);
p_js_indi->InsertString("number", "477");
//
if(!!sl_param.ChZnPm_ReqId && sl_param.ChZnPm_ReqTimestamp) {
temp_buf.Z().CatEq("UUID", sl_param.ChZnPm_ReqId, S_GUID::fmtIDL|S_GUID::fmtLower).CatChar('&').
CatEq("Time", sl_param.ChZnPm_ReqTimestamp);
p_js_indi->InsertString("industryAttribute", temp_buf);
if(!!sl_param.ChZnPm_ReqId && sl_param.ChZnPm_ReqTimestamp) { // @v12.1.12 условие перенесено наверх
SJson * p_js_indi_array = SJson::CreateArr();
SJson * p_js_indi = SJson::CreateObj();
/* @v12.1.12
p_js_indi->InsertString("date", "2022.03.26");
temp_buf.Z();
if(sl_param.ChZnProductType == 4)
temp_buf.Cat("020");
else if(oneof2(sl_param.ChZnProductType, 12, 1012))
temp_buf.Cat("030");
else
temp_buf.Cat("030");
p_js_indi->InsertString("fois", temp_buf);
p_js_indi->InsertString("number", "477");
*/
//
//if(!!sl_param.ChZnPm_ReqId && sl_param.ChZnPm_ReqTimestamp) {
temp_buf.Z().CatEq("UUID", sl_param.ChZnPm_ReqId, S_GUID::fmtIDL|S_GUID::fmtLower).CatChar('&').
CatEq("Time", sl_param.ChZnPm_ReqTimestamp);
p_js_indi->InsertString("industryAttribute", temp_buf);
//}
p_js_indi_array->InsertChild(p_js_indi);
p_js_item->Insert("industryInfo", p_js_indi_array);
}
p_js_indi_array->InsertChild(p_js_indi);
p_js_item->Insert("industryInfo", p_js_indi_array);
}
}
else {
Expand Down
2 changes: 2 additions & 0 deletions Src/PPLib/Billdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ static uint GetBillDialogID(const PPBillPacket * pack, uint * pPrnForm)
return (IsIntrOp(pack->Rec.OpID) == INTRRCPT) ? DLG_INTRRCPT : DLG_RCPTBILL;
case PPOPT_DRAFTEXPEND:
case PPOPT_GOODSEXPEND:
if(GetOpSubType(pack->Rec.OpID) == OPSUBT_TRADEPLAN) { // @construction @v12.1.12
}
if(IsIntrExpndOp(pack->Rec.OpID))
return DLG_INTREXPD;
else {
Expand Down
4 changes: 2 additions & 2 deletions Src/PPLib/Objtag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,9 @@ static int SelectObjTagType(PPObjectTag * pData, const ObjTagFilt * pObjTagF)
void SetupTagObjType()
{
LinkObjTypeList.addzlist(PPOBJ_QCERT, PPOBJ_PERSON, PPOBJ_QUOTKIND, PPOBJ_GLOBALUSERACC,
PPOBJ_TAXSYSTEMKIND, PPOBJ_INTERNETACCOUNT, PPOBJ_TRANSPORT, PPOBJ_TAG, PPOBJ_WORLD, PPOBJ_ACCOUNT2, 0);
PPOBJ_TAXSYSTEMKIND, PPOBJ_INTERNETACCOUNT, PPOBJ_TRANSPORT, PPOBJ_TAG, PPOBJ_WORLD, PPOBJ_ACCOUNT2, PPOBJ_GOODSTAX, 0);
// @v10.0.05 PPOBJ_GLOBALUSERACC // @v10.6.12 PPOBJ_TAXSYSTEMKIND // @v10.7.11 PPOBJ_INTERNETACCOUNT // @v10.8.12 PPOBJ_TRANSPORT // @v10.9.4 PPOBJ_TAG
// @v11.2.9 PPOBJ_WORLD // @v12.1.3 PPOBJ_ACCOUNT2
// @v11.2.9 PPOBJ_WORLD // @v12.1.3 PPOBJ_ACCOUNT2 // @v12.1.12 PPOBJ_GOODSTAX
P_ObjTypeList = &LinkObjTypeList;
DisableClusterItem(CTL_OBJTAG_TYPE, 7, BIN(!P_ObjTypeList));
SetupObjType();
Expand Down
1 change: 1 addition & 0 deletions Src/PPLib/Objvatbk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ int PPViewVatBook::Init_(const PPBaseFilt * pBaseFilt)
BExtQuery::ZDelete(&P_IterQuery);
Counter.Init();
MEMSZERO(Total);
Filt.Period.Actualize(ZERODATE);
if(Filt.Kind == PPVTB_BUY)
SETFLAG(Filt.Flags, VatBookFilt::fIterateClb, VBObj.GetConfig(PPVTB_BUY).Flags & VATBCfg::hfIterateClb);
}
Expand Down
186 changes: 140 additions & 46 deletions Src/PPLib/V_gdsopr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2508,18 +2508,30 @@ int PPViewGoodsOpAnalyze::CreateTempTable(double * pUfpFactors)
assert(wh_list.getCount());
wh_list.sortAndUndup();
DateRange period(Filt.Period);
RAssocArray avg_rest_result;
double total_storage = 0.0; // Общие расходы на хранение (без разбивки, ибо wildberries не дает таковой)
if(P_BObj->trfr->EvaluateAverageRestByGoods(wh_list, goods_list, period, avg_rest_result) > 0) {
debug_mark = true;
{
double total_acceptance = 0.0; // Общие расходы на приемку товаров на складах маркетплейса (без разбивки, ибо wildberries не дает таковой)
double total_deduction = 0.0; // Общие удержания со счета - чаще всего на маркетинг (без разбивки, ибо wildberries не дает таковой)
bool is_there_any_amount = false;
struct ArToVarAssoc {
PPID ArNo;
double * P_Var;
};
const ArToVarAssoc ar_to_var_assoc[] = {
{ ARTN_MRKTPLCACC_STORAGE, &total_storage },
{ ARTN_MRKTPLCACC_ACCEPTANCE, &total_acceptance },
{ ARTN_MRKTPLCACC_DEDUCTION, &total_deduction }
};
{
ArticleTbl::Rec ar_rec;
for(uint avaidx = 0; avaidx < SIZEOFARRAY(ar_to_var_assoc); avaidx++) {
const int ar_no = ar_to_var_assoc[avaidx].ArNo;
double * p_var = ar_to_var_assoc[avaidx].P_Var;
PPViewAccAnlz aa_view;
AccAnlzFilt aa_filt;
AccAnlzTotal aa_total;
aa_filt.Period = Filt.Period;
aa_filt.AcctId.ac = mp_acc_id;
ArticleTbl::Rec ar_rec;
if(P_BObj->ArObj.P_Tbl->SearchNum(mp_acs_id, ARTN_MRKTPLCACC_STORAGE, &ar_rec) > 0) {
if(P_BObj->ArObj.P_Tbl->SearchNum(mp_acs_id, ar_no, &ar_rec) > 0) {
aa_filt.AcctId.ar = ar_rec.ID;
aa_filt.Aco = ACO_3;
if(P_BObj->atobj->P_Tbl->AcctIDToRel(&aa_filt.AcctId, &aa_filt.AccID)) {
Expand All @@ -2531,57 +2543,105 @@ int PPViewGoodsOpAnalyze::CreateTempTable(double * pUfpFactors)
double crd = 0.0;
aa_total.DbtTrnovr.Get(0L, 0L, &dbt);
aa_total.CrdTrnovr.Get(0L, 0L, &crd);
total_storage = crd - dbt;
*p_var = crd - dbt;
if(*p_var != 0.0) {
is_there_any_amount = true;
}
}
}
}
}
}
if(is_there_any_amount) {
bool avg_rest_is_ok = false;
RAssocArray avg_rest_result;
if(total_storage > 0.0 || total_acceptance > 0.0) {
if(P_BObj->trfr->EvaluateAverageRestByGoods(wh_list, goods_list, period, avg_rest_result) > 0) {
avg_rest_is_ok = true;
}
}
if(total_storage > 0.0) {
const double avg_rest_total = avg_rest_result.GetTotal();
for(uint arlidx = 0; arlidx < avg_rest_result.getCount(); arlidx++) {
const PPID goods_id = avg_rest_result.at(arlidx).Key;
const double avg_rest = avg_rest_result.at(arlidx).Val;
double ord_qtty = 0;
double shipm_qtty = 0;
uint item_count = 0; // Количество элементов в IndicatorList имеющих общий ид товара
{
for(uint i = 0; i < IndicatorList.getCount(); i++) {
const IndicatorVector * p_iv = IndicatorList.at(i);
if(p_iv && p_iv->GoodsID == goods_id) {
item_count++;
double v = 0.0;
if(p_iv->Get(PPBZSI_ORDQTTY, &v))
ord_qtty += v;
if(p_iv->Get(PPBZSI_SALEQTTY, &v))
shipm_qtty += v;
}
//
const double avg_rest_total = avg_rest_result.GetTotal();
double total_shipm_qtty = 0.0; // Общее заказанное количество
double total_ord_qtty = 0.0; // Общее отгруженное количество
{
for(uint i = 0; i < IndicatorList.getCount(); i++) {
const IndicatorVector * p_iv = IndicatorList.at(i);
if(p_iv) {
double v = 0.0;
if(p_iv->Get(PPBZSI_ORDQTTY, &v))
total_ord_qtty += v;
if(p_iv->Get(PPBZSI_SALEQTTY, &v))
total_shipm_qtty += v;
}
}
}
for(uint gidx = 0; gidx < goods_list.getCount(); gidx++) {
const PPID goods_id = goods_list.get(gidx);
double ord_qtty = 0; // Заказанное количество по товару goods_id
double shipm_qtty = 0; // Отгруженное количество по товару goods_id
uint item_count = 0; // Количество элементов в IndicatorList имеющих общий ид товара
{
for(uint i = 0; i < IndicatorList.getCount(); i++) {
const IndicatorVector * p_iv = IndicatorList.at(i);
if(p_iv && p_iv->GoodsID == goods_id) {
item_count++;
double v = 0.0;
if(p_iv->Get(PPBZSI_ORDQTTY, &v))
ord_qtty += v;
if(p_iv->Get(PPBZSI_SALEQTTY, &v))
shipm_qtty += v;
}
}
if(item_count) {
for(uint i = 0; i < IndicatorList.getCount(); i++) {
IndicatorVector * p_iv = IndicatorList.at(i);
if(p_iv && p_iv->GoodsID == goods_id) {
}
if(item_count) {
const double avg_rest = avg_rest_result.Get(goods_id, 0);
for(uint i = 0; i < IndicatorList.getCount(); i++) {
IndicatorVector * p_iv = IndicatorList.at(i);
if(p_iv && p_iv->GoodsID == goods_id) {
double coeff = 0.0; // Коэффициент для расчета удельной доли стоимости хранения и приемки
double coeff2 = 0.0; // Коэффициент для расчета удельной доли прочих расходов (реклама, вестимо)
double v = 0.0;
if(avg_rest_total != 0.0) {
const double avg_rest_part = avg_rest / avg_rest_total;
double storage_cost = 0.0;
if(item_count == 1) {
storage_cost = total_storage * avg_rest_part;
}
else {
double v = 0.0;
if(shipm_qtty > 0.0) {
{
// Здесь приоритет у отгрузок перед заказами
if(item_count == 1) {
coeff = avg_rest_part; // Единственный элемент для товара goods_id: коэффициент просто равен доле среднего остатка
}
else if(shipm_qtty > 0.0) {
p_iv->Get(PPBZSI_SALEQTTY, &v);
storage_cost = (v / shipm_qtty) * total_storage * avg_rest_part;
coeff = (v / shipm_qtty) * avg_rest_part;
}
else if(ord_qtty > 0.0) {
p_iv->Get(PPBZSI_ORDQTTY, &v);
storage_cost = (v / ord_qtty) * total_storage * avg_rest_part;
coeff = (v / ord_qtty) * avg_rest_part;
}
else {
storage_cost = (1.0 / static_cast<double>(item_count)) * total_storage * avg_rest_part;
coeff = (1.0 / static_cast<double>(item_count)) * avg_rest_part;
}
}
p_iv->Add(PPBZSI_MPSTORAGE, storage_cost);
}
{
// Здесь приоритет у заказов перед отгрузками
if(total_ord_qtty > 0.0) {
p_iv->Get(PPBZSI_ORDQTTY, &v);
coeff2 = (v / total_ord_qtty);
}
else if(total_shipm_qtty > 0.0) {
p_iv->Get(PPBZSI_SALEQTTY, &v);
coeff2 = (v / total_shipm_qtty);
}
else {
coeff2 = (1.0 / static_cast<double>(item_count));
}
}
double storage_cost = coeff * total_storage;
double acceptance_cost = coeff * total_acceptance;
double deduction_cost = coeff2 * total_deduction;
p_iv->Add(PPBZSI_MPSTORAGE, storage_cost);
p_iv->Add(PPBZSI_MPACCEPTANCE, acceptance_cost);
p_iv->Add(PPBZSI_MPPROMOTION, deduction_cost);
}
}
}
Expand Down Expand Up @@ -4217,11 +4277,12 @@ int PPViewGoodsOpAnalyze::_GetDataForBrowser(SBrowserDataProcBlock * pBlk)
double earnings = 0.0;
double expenses = 0.0;
double temp_val = 0.0;
static const long expenses_indicator_list[] = { PPBZSI_SALECOST, PPBZSI_FREIGHT, PPBZSI_MPPROMOTION, PPBZSI_MPACCEPTANCE, PPBZSI_MPSTORAGE };
p_ind->Get(PPBZSI_MPSELLERSPART, &earnings);
p_ind->Get(PPBZSI_SALECOST, &temp_val);
expenses += temp_val;
p_ind->Get(PPBZSI_FREIGHT, &temp_val);
expenses += temp_val;
for(uint eiidx = 0; eiidx < SIZEOFARRAY(expenses_indicator_list); eiidx++) {
p_ind->Get(expenses_indicator_list[eiidx], &temp_val);
expenses += temp_val;
}
value = earnings - expenses;
pBlk->Set(value);
ok = 1;
Expand Down Expand Up @@ -4255,6 +4316,27 @@ int PPViewGoodsOpAnalyze::_GetDataForBrowser(SBrowserDataProcBlock * pBlk)
ok = 1;
}
break;
case 124: // PPBZSI_MPSTORAGE
if(p_ind) {
p_ind->Get(PPBZSI_MPSTORAGE, &value);
pBlk->Set(value);
ok = 1;
}
break;
case 125: // PPBZSI_MPACCEPTANCE
if(p_ind) {
p_ind->Get(PPBZSI_MPACCEPTANCE, &value);
pBlk->Set(value);
ok = 1;
}
break;
case 126: // PPBZSI_MPPROMOTION
if(p_ind) {
p_ind->Get(PPBZSI_MPPROMOTION, &value);
pBlk->Set(value);
ok = 1;
}
break;
}
}
}
Expand Down Expand Up @@ -4334,13 +4416,25 @@ void PPViewGoodsOpAnalyze::PreprocessBrowser(PPViewBrowser * pBrw)
pBrw->insertColumn(-1, "@sellersincome", 107, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
column_idx += 1;
{
uint grp_count = 0;
pBrw->insertColumn(-1, "@commission_s", 108, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
pBrw->insertColumn(-1, "@bankacquiring", 109, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
pBrw->insertColumn(-1, "@freight", 117, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
// @v12.1.12 {
pBrw->insertColumn(-1, "@storage", 124, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
pBrw->insertColumn(-1, "@warehouseacceptance", 125, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
pBrw->insertColumn(-1, "@advpromotion", 126, T_DOUBLE, SFMT_MONEY, BCO_USERPROC);
grp_count++;
// } @v12.1.12
{
BroGroup grp;
grp.First = column_idx;
grp.Count = 3;
grp.Count = grp_count;
grp.Height = 1;
grp.P_Text = newStr(PPLoadStringS("expense_pl", temp_buf));
p_def->AddColumnGroup(&grp);
Expand Down
Loading

0 comments on commit 8354d46

Please sign in to comment.