123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904 |
- /*
- * eLaRP: A small ERP utility program
- * Copyright (C) 2024 Wu Yiming
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include "elarp.h"
- ERPMain* erp;
- void* erpget_erp(void* unused1, void* unused2){
- return erp;
- }
- void erpui_ProductOptionValueItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,cr,0,0);
- laShowItemFull(uil,c,This,"remove",0,0,0,0)->Flags|=LA_UI_FLAGS_ICON;
- laShowItemFull(uil,cr,This,"name",0,0,0,0)->Expand=1;
- laShowItem(uil,cr,This,"price_offset")->Expand=1;
- laEndRow(uil,r);
- laShowItem(uil,cl,This,"__move");
- }
- void erpui_ProductOptionItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,cr,0,0);
- laShowItemFull(uil,c,This,"remove",0,0,0,0)->Flags|=LA_UI_FLAGS_ICON;
- laShowItemFull(uil,cr,This,"name",0,0,0,0)->Expand=1;
- laShowItem(uil,cr,This,"new_value");
- laEndRow(uil,r);
- laShowItemFull(uil,cr,This,"values",0,0,erpui_ProductOptionValueItem,0);
- laShowItem(uil,cl,This,"__move");
- }
- void erpui_ProductListItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.4); cl=laLeftColumn(c,2);cr=laRightColumn(c,0);
- laShowItemFull(uil,cl,This,"price",LA_WIDGET_INT_PLAIN,0,0,0)->Flags|=LA_UI_FLAGS_NO_LABEL;
- laShowItemFull(uil,cr,This,"name",LA_WIDGET_STRING_PLAIN,0,0,0);
- }
- void erpui_ProductItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
-
- laShowItemFull(uil,c,This,"name",0,0,0,0);
- laUiItem* r=laBeginRow(uil,c,1,0);
- laShowItemFull(uil,c,This,"price",0,0,0,0);
- laShowItemFull(uil,c,This,"discounted_price",0,0,0,0);
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"hs_code",0,0,0,0);
- r=laBeginRow(uil,c,0,0);
- laShowLabel(uil,c,"Options:",0,0);
- laShowItem(uil,c,This,"new_option");
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"available_options",0,0,erpui_ProductOptionItem,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
- laShowSeparator(uil,c);
- r=laBeginRow(uil,c,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItemFull(uil,c,This,"remove",0,0,0,0);
- laEndRow(uil,r);
- }
- void erpui_ProductsPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.5); cl=laLeftColumn(c,0);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,0,"ERP_new_product");
- laEndRow(uil,r);
- laShowColumnAdjuster(uil,c);
- laUiItem* gr=laMakeEmptyGroup(uil,cl,0,0); laUiList* gu=gr->Page; laColumn* gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- laUiItem* ui=laShowItemFull(gu,gc,0,"erp.products",0,0,erpui_ProductListItem,0);
- gr=laMakeEmptyGroup(uil,cr,0,0); gu=gr->Page; gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- ui=laShowItemFull(gu,gc,0,"erp.current_product",0,0,erpui_ProductItem,0);
- ui->Flags|=LA_UI_COLLECTION_NO_HIGHLIGHT;
- }
- void erpui_ProductEntryOptionItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laColumn* crl,*crr; laSplitColumn(uil,cr,0.8); crl=laLeftColumn(cr,1);crr=laRightColumn(cr,0);
- laColumn* crrl,*crrr; laSplitColumn(uil,crr,0.5); crrl=laLeftColumn(crr,0);crrr=laRightColumn(crr,0);
-
- laShowItem(uil,cl,This,"__move");
- laShowItemFull(uil,crl,This,"remove",0,0,0,0)->Flags|=LA_UI_FLAGS_ICON;
- laShowItemFull(uil,crrl,This,"option",0,0,0,0);
- laShowItemFull(uil,crrr,This,"value",0,0,0,0);
- }
- void erpui_ProductEntryItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laColumn* crl,*crr; laSplitColumn(uil,cr,0.2); crl=laLeftColumn(cr,4);crr=laRightColumn(cr,0);
- laColumn* crrl,*crrr; laSplitColumn(uil,crr,0.5); crrl=laLeftColumn(crr,0);crrr=laRightColumn(crr,0);
-
- laShowItem(uil,cl,This,"__move");
- laUiItem* b=laBeginRow(uil,crl,0,0);
- laShowItem(uil,crl,This,"remove")->Flags|=LA_UI_FLAGS_ICON;
- laUiItem* ui=laShowItem(uil,crl,This,"entry_price");ui->Flags|=LA_UI_FLAGS_NO_LABEL; ui->Expand=1;
- laEndRow(uil,b);
- laShowItemFull(uil,crrl,This,"product",0,0,erpui_ProductListItem,0);
- b=laBeginRow(uil,crrr,0,0);
- laUiItem* am=laShowItem(uil,crrr,This,"amount"); am->Expand=1; am->Flags|=LA_UI_FLAGS_NO_LABEL;
- laShowItem(uil,crrr,This,"new_option");
- laEndRow(uil,b);
- laShowItemFull(uil,crr,This,"options",0,0,erpui_ProductEntryOptionItem,0);
- }
- void erpui_ProductEntryListItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.4); cl=laLeftColumn(c,2);cr=laRightColumn(c,0);
- laUiItem* b=laOnConditionThat(uil,c,laPropExpression(This,"product"));
- laShowItemFull(uil,cl,This,"entry_price",LA_WIDGET_INT_PLAIN,0,0,0)->Flags|=LA_UI_FLAGS_NO_LABEL;
- laShowItemFull(uil,cr,This,"product.name",LA_WIDGET_STRING_PLAIN,0,0,0);
- laElse(uil,b);
- laShowLabel(uil,c,"<Empty Product>",0,0);
- laEndCondition(uil,b);
- }
- void erpui_PackageProductItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laColumn* crl,*crr; laSplitColumn(uil,cr,0.2); crl=laLeftColumn(cr,1);crr=laRightColumn(cr,0);
- laShowItemFull(uil,cl,This,"__move",0,0,0,0);
- laShowItemFull(uil,crl,This,"remove",0,0,0,0)->Flags|=LA_UI_FLAGS_ICON;
- laShowItemFull(uil,crr,This,"product",0,0,0,0);
- }
- void erpui_PackageItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laColumn* crl,*crr; laSplitColumn(uil,cr,0.2); crl=laLeftColumn(cr,1);crr=laRightColumn(cr,0);
- laColumn* crrl,*crrr; laSplitColumn(uil,crr,0.5); crrl=laLeftColumn(crr,0);crrr=laRightColumn(crr,1);
-
- laShowItem(uil,cl,This,"__move");
- laShowItem(uil,crl,This,"remove")->Flags|=LA_UI_FLAGS_ICON;
- laUiItem* r=laBeginRow(uil,crr,0,0);
- laShowItemFull(uil,crr,This,"tracking",0,0,0,0)->Expand=1;
- laShowItem(uil,crrr,This,"new_entry");
- laEndRow(uil,r);
- laShowItemFull(uil,crr,This,"included_products",0,0,erpui_PackageProductItem,0);
- }
- void erpui_MessageEntryItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.2); cl=laLeftColumn(c,1);cr=laRightColumn(c,0);
- laColumn* crl,*crr; laSplitColumn(uil,cr,0.2); crl=laLeftColumn(cr,0);crr=laRightColumn(cr,1);
- laShowItem(uil,cl,This,"__move");
- laShowItem(uil,crl,This,"message");
- laShowItem(uil,crr,This,"remove")->Flags|=LA_UI_FLAGS_ICON;
- }
- void erpui_OrderListItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.4); cl=laLeftColumn(c,2);cr=laRightColumn(c,0);
- laShowItemFull(uil,cl,This,"order_price",LA_WIDGET_INT_PLAIN,0,0,0)->Flags|=LA_UI_FLAGS_NO_LABEL;
- laShowItemFull(uil,cr,This,"__uid",LA_WIDGET_STRING_PLAIN,0,0,0);
- }
- void erpui_OrderItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
-
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItemFull(uil,c,This,"state",0,0,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItemFull(uil,c,This,"paid",0,0,0,0);
- laShowSeparator(uil,c);
- laShowItemFull(uil,c,This,"order_discount",0,0,0,0);
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"customer",LA_WIDGET_COLLECTION_SELECTOR,0,0,0);
- r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,This,"new_item");
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"product_entries",0,0,erpui_ProductEntryItem,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
- laShowItemFull(uil,c,This,"order_price",LA_WIDGET_INT_PLAIN,0,0,0)->Flags|=LA_UI_FLAGS_NO_LABEL|LA_TEXT_ALIGN_LEFT;
- laShowSeparator(uil,c);
- r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,This,"new_package");
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"packages",0,0,erpui_PackageItem,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
- r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,This,"new_message");
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"message_entries",0,0,erpui_MessageEntryItem,0)->Flags|=LA_UI_FLAGS_NO_DECAL;
- laShowItemFull(uil,c,This,"comments",LA_WIDGET_STRING_MULTI,0,0,0)->Extra->HeightCoeff=2;
- laShowSeparator(uil,c);
- laShowItemFull(uil,c,This,"admin_comments",LA_WIDGET_STRING_MULTI,0,0,0)->Extra->HeightCoeff=2;
-
- laShowSeparator(uil,c);
- r=laBeginRow(uil,c,0,0);
- laShowItemFull(uil,c,This,"print",0,0,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItemFull(uil,c,This,"remove",0,0,0,0);
- laEndRow(uil,r);
- }
- void erpui_OrdersPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.5); cl=laLeftColumn(c,0);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,0,"ERP_new_order");
- laEndRow(uil,r);
- laShowColumnAdjuster(uil,c);
- laUiItem* gr=laMakeEmptyGroup(uil,cl,0,0); laUiList* gu=gr->Page; laColumn* gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- laUiItem* ui=laShowItemFull(gu,gc,0,"erp.orders",0,0,erpui_OrderListItem,0);
- gr=laMakeEmptyGroup(uil,cr,0,0); gu=gr->Page; gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- ui=laShowItemFull(gu,gc,0,"erp.current_order",0,0,erpui_OrderItem,0);
- ui->Flags|=LA_UI_COLLECTION_NO_HIGHLIGHT;
- }
- void erpui_MessageListItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,This,"is_header")->Flags|=LA_UI_FLAGS_ICON|LA_UI_FLAGS_NO_DECAL;
- laShowItemFull(uil,c,This,"description",LA_WIDGET_STRING_PLAIN,0,0,0)->Expand=1;
- laEndRow(uil,r);
- }
- void erpui_MessageItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,This,"is_header")->Flags|=LA_UI_FLAGS_ICON;
- laShowItem(uil,c,This,"description")->Expand=1;
- laEndRow(uil,r);
- laShowItemFull(uil,c,This,"message",LA_WIDGET_STRING_MULTI,0,0,0)->Extra->HeightCoeff=-1;
- }
- void erpui_CustomerListItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItemFull(uil,c,This,"nickname",LA_WIDGET_STRING_PLAIN,0,0,0);
- laEndRow(uil,r);
- }
- void erpui_CustomerItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil),*cl,*cr; laSplitColumn(uil,c,0.5); cl=laLeftColumn(c,10);cr=laRightColumn(c,0);
-
- laShowItemFull(uil,c,This,"nickname",0,0,0,0);
- laShowLabel(uil,c,"Details:",0,0);
- laShowLabel(uil,cl,"Name:",0,0); laShowItemFull(uil,cr,This,"name",0,0,0,0);
- laShowLabel(uil,cl,"Country:",0,0); laShowItemFull(uil,cr,This,"country",0,0,0,0);
- laShowLabel(uil,cl,"State:",0,0); laShowItemFull(uil,cr,This,"state",0,0,0,0);
- laShowLabel(uil,cl,"City:",0,0); laShowItemFull(uil,cr,This,"city",0,0,0,0);
- laShowLabel(uil,cl,"Address:",0,0); laShowItemFull(uil,cr,This,"address",0,0,0,0);
- laShowLabel(uil,cl,"Postal Code:",0,0); laShowItemFull(uil,cr,This,"postal_code",0,0,0,0);
- laShowLabel(uil,cl,"Telephone:",0,0); laShowItemFull(uil,cr,This,"tel",0,0,0,0);
- laShowLabel(uil,cl,"E-Mail:",0,0); laShowItemFull(uil,cr,This,"email",0,0,0,0);
- laShowSeparator(uil,c);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowSeparator(uil,c)->Expand=1;
- laShowItemFull(uil,c,This,"remove",0,0,0,0);
- laEndRow(uil,r);
- }
- void erpui_CustomersPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil),*cl,*cr; laSplitColumn(uil,c,0.5); cl=laLeftColumn(c,0);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,0,"ERP_new_customer");
- laEndRow(uil,r);
- laShowColumnAdjuster(uil,c);
- laUiItem* gr=laMakeEmptyGroup(uil,cl,0,0); laUiList* gu=gr->Page; laColumn* gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- laUiItem* ui=laShowItemFull(gu,gc,0,"erp.customers",0,0,erpui_CustomerListItem,0);
- gr=laMakeEmptyGroup(uil,cr,0,0); gu=gr->Page; gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- ui=laShowItemFull(gu,gc,0,"erp.current_customer",0,0,erpui_CustomerItem,0);
- ui->Flags|=LA_UI_COLLECTION_NO_HIGHLIGHT;
- }
- void erpui_MessagesPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProps, laColumn *UNUSED, int context){
- laColumn* c=laFirstColumn(uil), *cl,*cr; laSplitColumn(uil,c,0.5); cl=laLeftColumn(c,0);cr=laRightColumn(c,0);
- laUiItem* r=laBeginRow(uil,c,0,0);
- laShowItem(uil,c,0,"ERP_new_message");
- laEndRow(uil,r);
- laShowColumnAdjuster(uil,c);
- laUiItem* gr=laMakeEmptyGroup(uil,cl,0,0); laUiList* gu=gr->Page; laColumn* gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- laUiItem* ui=laShowItemFull(gu,gc,0,"erp.messages",0,0,erpui_MessageListItem,0);
- gr=laMakeEmptyGroup(uil,cr,0,0); gu=gr->Page; gc=laFirstColumn(gu);
- gu->HeightCoeff=-1; gr->Flags|=LA_UI_FLAGS_NO_DECAL;
- ui=laShowItemFull(gu,gc,0,"erp.current_message",0,0,erpui_MessageItem,0);
- ui->Flags|=LA_UI_COLLECTION_NO_HIGHLIGHT;
- }
- void erp_GetCustomerText(laSafeString** s, ERPCustomer* c){
- if(!c){ strSafePrint(s," <Unspecified>\n"); return; }
- strSafePrint(s," %-15s : %s\n","Name",SSTR(c->Name));
- strSafePrint(s," %-15s : %s\n","Country",SSTR(c->Country));
- strSafePrint(s," %-15s : %s\n","State",SSTR(c->State));
- strSafePrint(s," %-15s : %s\n","City",SSTR(c->City));
- strSafePrint(s," %-15s : %s\n","Address",SSTR(c->Address));
- strSafePrint(s," %-15s : %s\n","PostalCode",SSTR(c->PostalCode));
- strSafePrint(s," %-15s : %s\n","Tel",SSTR(c->Tel));
- strSafePrint(s," %-15s : %s\n","EMail",SSTR(c->EMail));
- }
- void erp_GetOrderProductsText(laSafeString** s, ERPOrder* o){
- if(!o->ProductEntries.pFirst){ strSafePrint(s," <Empty Order>\n"); return; }
- strSafePrint(s,"Item | Per Item | Amount | Combined \n");
- for(ERPProductEntry* pe=o->ProductEntries.pFirst;pe;pe=pe->Item.pNext){
- strSafePrint(s,"%-32s%8d %6d %8d\n",
- pe->Product?SSTR(pe->Product->Name):"<Empty Product>",
- pe->Product?pe->Product->Price:0, pe->Amount, pe->EntryPrice);
- for(ERPProductEntryOption* peo=pe->Options.pFirst;peo;peo=peo->Item.pNext){
- strSafePrint(s," %-13s: %-13s %+7d\n",
- peo->Option?SSTR(peo->Option->Name):"<Empty Option>",
- peo->Value?SSTR(peo->Value->Name):"<Empty Value>",
- peo->OptionPriceOffset);
- }
- }
- }
- void erp_GetOrderPackagesText(laSafeString** s, ERPOrder* o){
- if(!o->ProductEntries.pFirst){ strSafePrint(s," <Empty Order>\n"); return; }
- int i=0; for(ERPPackage* p=o->Packages.pFirst;p;p=p->Item.pNext){ i++;
- strSafePrint(s," %2d %-32s\n", i,
- (p->Tracking&&p->Tracking->Ptr[0]!=0)?SSTR(p->Tracking):"<Unspecified package tracking number>");
- int j=0; for(ERPPackageProduct* pp=p->IncludedProducts.pFirst;pp;pp=pp->Item.pNext){ j++;
- strSafePrint(s," %2d. %-28s (%8d)\n", j,
- (pp->Product&&pp->Product->Product)?SSTR(pp->Product->Product->Name):"<Empty Product>",
- pp->Product?pp->Product->EntryPrice:0);
- }
- }
- }
- void erp_GetOrderText(laSafeString** s, ERPOrder* o){
- int hylevel;
- laMemNodeHyper* head=memGetHead(o,&hylevel);
- strSafePrint(s,"Order %s\n============================================================\n\nTO:\n",head->NUID.String);
- erp_GetCustomerText(s,o->Customer);
- strSafePrint(s,"\nProducts ---------------------------------------------------\n\n");
- erp_GetOrderProductsText(s, o);
- strSafePrint(s,"\nPackages ---------------------------------------------------\n\n");
- erp_GetOrderPackagesText(s, o);
- }
- void erp_GetCustomTest(laSafeString** s, ERPOrder* o){
- //strSafePrint(ss);
- }
- ERPOrder* erpNewOrder(){
- ERPOrder* o=memAcquireHyper(sizeof(ERPOrder)); lstPushItem(&erp->Orders,o);
- laNotifyUsers("erp.orders"); laNotifyUsers("erp.current_order"); memAssignRef(erp,&erp->CurrentOrder,o);
- return o;
- }
- ERPCustomer* erpNewCustomer(){
- ERPCustomer* c=memAcquireHyper(sizeof(ERPCustomer)); lstPushItem(&erp->Customers,c);
- strSafeSet(&c->Nickname,"New Customer");
- laNotifyUsers("erp.customers"); laNotifyUsers("erp.current_customer"); memAssignRef(erp,&erp->CurrentCustomer,c);
- return c;
- }
- ERPProduct* erpNewProduct(){
- ERPProduct* p=memAcquireHyper(sizeof(ERPProduct)); lstPushItem(&erp->Products,p);
- strSafeSet(&p->Name,"New Product");
- laNotifyUsers("erp.products"); laNotifyUsers("erp.current_product"); memAssignRef(erp,&erp->CurrentProduct,p);
- return p;
- }
- ERPProductOption* erpNewProductOption(ERPProduct* p){ if(!p) return 0;
- ERPProductOption* po=memAcquire(sizeof(ERPProductOption)); lstAppendItem(&p->AvailableOptions,po);
- strSafeSet(&po->Name,"New Option"); laNotifyInstanceUsers(p); memAssignRef(po,&po->Parent,p);
- return po;
- }
- ERPProductOptionValue* erpNewProductOptionValue(ERPProductOption* po){ if(!po) return 0;
- ERPProductOptionValue* pov=memAcquire(sizeof(ERPProductOptionValue)); lstAppendItem(&po->Values,pov);
- strSafeSet(&pov->Name,"New Value"); laNotifyInstanceUsers(po); memAssignRef(pov,&pov->Parent,po);
- return pov;
- }
- ERPProductEntry* erpNewProductEntry(ERPOrder* o){ if(!o) return 0;
- ERPProductEntry* pe=memAcquire(sizeof(ERPProductEntry)); lstAppendItem(&o->ProductEntries,pe);
- laNotifyInstanceUsers(o); memAssignRef(pe,&pe->Parent,o);
- return pe;
- }
- ERPProductEntry* erpNewProductEntryOption(ERPProductEntry* pe){ if(!pe) return 0;
- ERPProductEntryOption* peo=memAcquire(sizeof(ERPProductEntryOption)); lstAppendItem(&pe->Options,peo);
- laNotifyInstanceUsers(pe); memAssignRef(peo,&peo->Parent,pe);
- return peo;
- }
- ERPPackageProduct* erpNewPackageProduct(ERPPackage* p){ if(!p) return 0;
- ERPPackageProduct* pp=memAcquire(sizeof(ERPPackage)); lstAppendItem(&p->IncludedProducts,pp);
- laNotifyInstanceUsers(p); memAssignRef(pp,&pp->Parent,p);
- return pp;
- }
- ERPPackage* erpNewPackage(ERPOrder* o){ if(!o) return 0;
- ERPPackage* p=memAcquire(sizeof(ERPPackage)); lstAppendItem(&o->Packages,p);
- laNotifyInstanceUsers(o); memAssignRef(p,&p->Parent,o);
- erpNewPackageProduct(p);
- return p;
- }
- ERPMessage* erpNewMessage(){
- ERPMessage* msg=memAcquireHyper(sizeof(ERPMessage)); lstAppendItem(&erp->Messages,msg);
- strSafeSet(&msg->Description, "New Message");
- laNotifyUsers("erp.messages"); laNotifyUsers("erp.current_message"); memAssignRef(erp,&erp->CurrentMessage,msg);
- return msg;
- }
- ERPMessageEntry* erpNewMessageEntry(ERPOrder* o){ if(!o) return 0;
- ERPMessageEntry* me=memAcquire(sizeof(ERPMessageEntry)); lstAppendItem(&o->Messages,me);
- laNotifyInstanceUsers(o); memAssignRef(me,&me->Parent,o);
- return me;
- }
- void erpRemoveMessageEntry(ERPOrder* o, ERPMessageEntry* me){
- lstRemoveItem(&o->Messages, me); memLeave(me); laNotifyInstanceUsers(o);
- }
- void erpRemovePackageProduct(ERPPackage* p, ERPPackageProduct* pp){
- lstRemoveItem(&p->IncludedProducts,pp); memLeave(pp); laNotifyInstanceUsers(p);
- }
- void erpRemovePackage(ERPOrder* o, ERPPackage* p){
- while(p->IncludedProducts.pFirst){ erpRemovePackageProduct(p,p->IncludedProducts.pFirst); }
- lstRemoveItem(&o->Packages,p); strSafeDestroy(&p->Tracking); memLeave(p); laNotifyInstanceUsers(o);
- }
- void erpRemoveProductEntryOption(ERPProductEntry* pe, ERPProductEntryOption* peo){
- lstRemoveItem(&pe->Options,peo); memLeave(peo); laNotifyInstanceUsers(pe);
- }
- void erpRemoveProductEntry(ERPOrder* o, ERPProductEntry* pe){
- while(pe->Options.pFirst){ erpRemoveProductEntryOption(pe,pe->Options.pFirst); }
- lstRemoveItem(&o->ProductEntries,pe); memLeave(pe); laNotifyInstanceUsers(o);
- }
- void erpRemoveOrder(ERPOrder* o){
- while(o->Packages.pFirst){ erpRemovePackage(o,o->Packages.pFirst); }
- while(o->ProductEntries.pFirst){ erpRemoveProductEntry(o,o->ProductEntries.pFirst); }
- while(o->Messages.pFirst){ erpRemoveMessageEntry(o,o->Messages.pFirst); }
- strSafeDestroy(&o->Comments); strSafeDestroy(&o->AdminComments);
- ERPOrder* cur=o->Item.pNext?o->Item.pNext:o->Item.pPrev;
- memAssignRef(erp,&erp->CurrentOrder,cur);
- lstRemoveItem(&erp->Orders, o); memLeave(o);
- laNotifyUsers("erp.current_order");laNotifyUsers("erp.orders");
- }
- void erpRemoveCustomer(ERPCustomer* c){
- strSafeDestroy(&c->Nickname);
- strSafeDestroy(&c->Name);
- strSafeDestroy(&c->Country);
- strSafeDestroy(&c->State);
- strSafeDestroy(&c->City);
- strSafeDestroy(&c->Address);
- strSafeDestroy(&c->PostalCode);
- strSafeDestroy(&c->Tel);
- strSafeDestroy(&c->EMail);
- ERPCustomer* cur=c->Item.pNext?c->Item.pNext:c->Item.pPrev;
- memAssignRef(erp,&erp->CurrentCustomer,cur);
- lstRemoveItem(&erp->Customers,c); memLeave(c);
- laNotifyUsers("erp.current_customer");laNotifyUsers("erp.customers");
- }
- void erpRemoveProductOptionValue(ERPProductOption* po, ERPProductOptionValue* pov){
- lstRemoveItem(&po->Values,pov); strSafeDestroy(&pov->Name); memLeave(pov);
- laNotifyInstanceUsers(po);
- }
- void erpRemoveProductOption(ERPProduct* p, ERPProductOption* po){
- while(po->Values.pFirst){erpRemoveProductOptionValue(po,po->Values.pFirst);}
- lstRemoveItem(&p->AvailableOptions,po);
- strSafeDestroy(&po->Name); memLeave(po); laNotifyInstanceUsers(p);
- }
- void erpRemoveProduct(ERPProduct* p){
- while(p->AvailableOptions.pFirst){erpRemoveProductOption(p,p->AvailableOptions.pFirst);}
- strSafeDestroy(&p->Name); strSafeDestroy(&p->HSCode);
- ERPProduct* cur=p->Item.pNext?p->Item.pNext:p->Item.pPrev;
- memAssignRef(erp,&erp->CurrentProduct,cur);
- lstRemoveItem(&erp->Products,p); memLeave(p);
- laNotifyUsers("erp.current_product");laNotifyUsers("erp.products");
- }
- void erpRemoveMessage(ERPMessage* m){
- ERPMessage* nm=m->Item.pNext?m->Item.pNext:m->Item.pPrev;
- memAssignRef(erp,&erp->CurrentMessage,nm);
- strSafeDestroy(&m->Message); strSafeDestroy(&m->Description);
- lstRemoveItem(&erp->Messages, m); memLeave(m);
- laNotifyUsers("erp.messages"); laNotifyUsers("erp.current_message");
- }
- int erpinv_NewOrder(laOperator* a, laEvent* e){ erpNewOrder();
- laRecordDifferences(0,"erp.orders");laRecordDifferences(0,"erp.current_order");laPushDifferences("New Order",0);
- return LA_FINISHED;
- }
- int erpinv_NewCustomer(laOperator* a, laEvent* e){ erpNewCustomer();
- laRecordDifferences(0,"erp.customers");laRecordDifferences(0,"erp.current_customer");laPushDifferences("New Customer",0);
- return LA_FINISHED;
- }
- int erpinv_NewProduct(laOperator* a, laEvent* e){ erpNewProduct();
- laRecordDifferences(0,"erp.products");laRecordDifferences(0,"erp.current_product");laPushDifferences("New Product",0);
- return LA_FINISHED;
- }
- int erpinv_NewProductOption(laOperator* a, laEvent* e){
- ERPProduct* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- ERPProductOption* po=erpNewProductOption(p); if(po){ laRecordInstanceDifferences(p,"erp_product");laPushDifferences("New Product Option",0); }
- return LA_FINISHED;
- }
- int erpinv_NewProductOptionValue(laOperator* a, laEvent* e){
- ERPProductOption* po=a->This?a->This->EndInstance:0; if(!po){ return LA_FINISHED; }
- ERPProductOptionValue* pov=erpNewProductOptionValue(po); if(pov){ laRecordInstanceDifferences(po,"erp_product_option"); laPushDifferences("New Product Value",0); }
- return LA_FINISHED;
- }
- int erpinv_NewProductEntry(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:0; if(!o){ return LA_FINISHED; }
- ERPProductEntry* pe=erpNewProductEntry(o); if(pe){ laRecordInstanceDifferences(o,"erp_order");laPushDifferences("New Product Entry",0); }
- return LA_FINISHED;
- }
- int erpinv_NewProductEntryOption(laOperator* a, laEvent* e){
- ERPProductEntry* pe=a->This?a->This->EndInstance:0; if(!pe){ return LA_FINISHED; }
- ERPProductEntry* peo=erpNewProductEntryOption(pe); if(peo){ laRecordInstanceDifferences(pe,"erp_product_entry");laPushDifferences("New Product Entry Option",0); }
- return LA_FINISHED;
- }
- int erpinv_NewPackage(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:0; if(!o){ return LA_FINISHED; }
- ERPPackage* p=erpNewPackage(o); if(p){ laRecordInstanceDifferences(o,"erp_order");laPushDifferences("New Package",0); }
- return LA_FINISHED;
- }
- int erpinv_NewPackageProduct(laOperator* a, laEvent* e){
- ERPPackage* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- ERPPackageProduct* pp=erpNewPackageProduct(p); if(pp){ laRecordInstanceDifferences(p,"erp_package");laPushDifferences("New Package Product",0); }
- return LA_FINISHED;
- }
- int erpinv_NewMessage(laOperator* a, laEvent* e){ erpNewMessage();
- laRecordDifferences(0,"erp.messages");laRecordDifferences(0,"erp.current_message");laPushDifferences("New Message",0);
- }
- int erpinv_NewMessageEntry(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:0; if(!o){ return LA_FINISHED; }
- ERPMessageEntry* me=erpNewMessageEntry(o); if(me){ laRecordInstanceDifferences(o,"erp_order");laPushDifferences("New Message Entry",0); }
- return LA_FINISHED;
- }
- int erpinv_RemoveOrder(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:0; if(!o){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove order?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveOrder(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:0; if(!o){ return LA_FINISHED; }
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveOrder(o);
- laRecordDifferences(0,"erp.orders");laRecordDifferences(0,"erp.current_order");laPushDifferences("Remove Order",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveProduct(laOperator* a, laEvent* e){
- ERPProduct* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove product?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveProduct(laOperator* a, laEvent* e){
- ERPProduct* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveProduct(p);
- laRecordDifferences(0,"erp.products");laRecordDifferences(0,"erp.current_product");laPushDifferences("Remove Product",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveCustomer(laOperator* a, laEvent* e){
- ERPCustomer* c=a->This?a->This->EndInstance:0; if(!c){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove customer?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveCustomer(laOperator* a, laEvent* e){
- ERPCustomer* c=a->This?a->This->EndInstance:0; if(!c){ return LA_FINISHED; }
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveCustomer(c);
- laRecordDifferences(0,"erp.customers");laRecordDifferences(0,"erp.current_customer");laPushDifferences("Remove Customer",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemovePackage(laOperator* a, laEvent* e){
- ERPPackage* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove package?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemovePackage(laOperator* a, laEvent* e){
- ERPPackage* p=a->This?a->This->EndInstance:0; if(!p){ return LA_FINISHED; }
- ERPOrder* o=p->Parent;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemovePackage(o,p);
- laRecordInstanceDifferences(o,"erp_order");
- laPushDifferences("Remove Package",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveProductOption(laOperator* a, laEvent* e){
- ERPProductOption* po=a->This?a->This->EndInstance:0; if(!po){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove option?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveProductOption(laOperator* a, laEvent* e){
- ERPProductOption* po=a->This?a->This->EndInstance:0; if(!po){ return LA_FINISHED; }
- ERPProduct* p=po->Parent;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveProductOption(p,po);
- laRecordInstanceDifferences(p,"erp_product");
- laPushDifferences("Remove Product Option",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveProductEntry(laOperator* a, laEvent* e){
- ERPProductEntry* pe=a->This?a->This->EndInstance:0; if(!pe){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove entry?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveProductEntry(laOperator* a, laEvent* e){
- ERPProductEntry* pe=a->This?a->This->EndInstance:0; if(!pe){ return LA_FINISHED; }
- ERPOrder* o=pe->Parent;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveProductEntry(o,pe);
- laRecordInstanceDifferences(o,"erp_order");
- laPushDifferences("Remove Product Entry",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveProductEntryOption(laOperator* a, laEvent* e){
- ERPProductEntryOption* peo=a->This?a->This->EndInstance:0; if(!peo){ return LA_FINISHED; }
- ERPProductEntry* pe=peo->Parent;
- erpRemoveProductEntryOption(pe,peo);
- laRecordInstanceDifferences(pe,"erp_product_entry"); laPushDifferences("Remove Product Entry Option",0);
- return LA_FINISHED;
- }
- int erpinv_RemoveProductOptionValue(laOperator* a, laEvent* e){
- ERPProductOptionValue* pov=a->This?a->This->EndInstance:0; if(!pov){ return LA_FINISHED; }
- ERPProductOption* po=pov->Parent;
- erpRemoveProductOptionValue(po,pov);
- laRecordInstanceDifferences(po,"erp_product_option"); laPushDifferences("Remove Product Option Value",0);
- return LA_FINISHED;
- }
- int erpinv_RemovePackageProduct(laOperator* a, laEvent* e){
- ERPPackageProduct* pp=a->This?a->This->EndInstance:0; if(!pp){ return LA_FINISHED; }
- ERPPackage* p=pp->Parent; if(p->IncludedProducts.pFirst==p->IncludedProducts.pLast){ return LA_FINISHED; }
- erpRemovePackageProduct(p,pp);
- laRecordInstanceDifferences(p,"erp_package"); laPushDifferences("Remove Package Product",0);
- return LA_FINISHED;
- }
- int erpinv_RemoveMessage(laOperator* a, laEvent* e){
- ERPMessage* m=a->This?a->This->EndInstance:0; if(!m){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove message?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveMessage(laOperator* a, laEvent* e){
- ERPMessage* m=a->This?a->This->EndInstance:0; if(!m){ return LA_FINISHED; }
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveMessage(m);
- laRecordDifferences(0,"erp.messages");laRecordDifferences(0,"erp.current_message");laPushDifferences("Remove Message",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_RemoveMessageEntry(laOperator* a, laEvent* e){
- ERPMessageEntry* me=a->This?a->This->EndInstance:0; if(!me){ return LA_FINISHED; }
- laEnableYesNoPanel(a,0,"Confirm?","Remove message?",e->x,e->y,200,e);
- return LA_RUNNING;
- }
- int erpmod_RemoveMessageEntry(laOperator* a, laEvent* e){
- ERPMessageEntry* me=a->This?a->This->EndInstance:0; if(!me){ return LA_FINISHED; }
- ERPOrder* o=me->Parent;
- if (a->ConfirmData){
- if (a->ConfirmData->Mode == LA_CONFIRM_OK){ erpRemoveMessageEntry(o,me);
- laRecordInstanceDifferences(o,"erp_order");
- laPushDifferences("Remove Message Entry",0);
- }
- return LA_FINISHED;
- } return LA_RUNNING;
- }
- int erpinv_PrintOrderInfo(laOperator* a, laEvent* e){
- ERPOrder* o=a->This?a->This->EndInstance:erp->CurrentOrder; if(!o){ return LA_FINISHED; }
- laSafeString*s=0; erp_GetOrderText(&s,o);
- struct pdf_info info = {
- .creator = "Me",
- .producer = "eLarp Software",
- .title = "Order Info",
- .author = "Yiming",
- .subject = "Some Subject",
- .date = "Today"
- };
- //struct pdf_doc *pdf = pdf_create(PDF_A4_WIDTH, PDF_A4_HEIGHT, &info);
- //pdf_set_font(pdf, "Courier");
- //pdf_append_page(pdf);
- //pdf_add_text_wrap(pdf, NULL, SSTR(s), 12, 50,PDF_A4_HEIGHT-20, 0,PDF_BLACK,PDF_A4_WIDTH,PDF_ALIGN_LEFT,0);
- //pdf_add_line(pdf, NULL, 50, 24, 150, 24, 3, PDF_BLACK);
- //pdf_save(pdf, "output.pdf");
- //pdf_destroy(pdf);
- FILE* f=fopen("order.txt","w");
- fprintf(f,"%s\n",SSTR(s));
- fclose(f);
-
- printf("%s\n",SSTR(s)); strSafeDestroy(&s);
- return LA_FINISHED;
- }
- void erpset_ProductOptionMove(ERPProductOption* po, int move){
- if(move<0 && po->Item.pPrev){ lstMoveUp(&po->Parent->AvailableOptions, po); laNotifyInstanceUsers(po->Parent); }
- elif(move>0 && po->Item.pNext){ lstMoveDown(&po->Parent->AvailableOptions, po); laNotifyInstanceUsers(po->Parent); }
- }
- void erpset_ProductOptionValueMove(ERPProductOptionValue* pov, int move){
- if(move<0 && pov->Item.pPrev){ lstMoveUp(&pov->Parent->Values, pov); laNotifyInstanceUsers(pov->Parent); }
- elif(move>0 && pov->Item.pNext){ lstMoveDown(&pov->Parent->Values, pov); laNotifyInstanceUsers(pov->Parent); }
- }
- void erpset_ProductEntryMove(ERPProductEntry* pe, int move){
- if(move<0 && pe->Item.pPrev){ lstMoveUp(&pe->Parent->ProductEntries, pe); laNotifyInstanceUsers(pe->Parent); }
- elif(move>0 && pe->Item.pNext){ lstMoveDown(&pe->Parent->ProductEntries, pe); laNotifyInstanceUsers(pe->Parent); }
- }
- void erpset_ProductEntryOptionMove(ERPProductEntryOption* peo, int move){
- if(move<0 && peo->Item.pPrev){ lstMoveUp(&peo->Parent->Options, peo); laNotifyInstanceUsers(peo->Parent); }
- elif(move>0 && peo->Item.pNext){ lstMoveDown(&peo->Parent->Options, peo); laNotifyInstanceUsers(peo->Parent); }
- }
- void erpset_PackageMove(ERPPackage* p, int move){
- if(move<0 && p->Item.pPrev){ lstMoveUp(&p->Parent->Packages, p); laNotifyInstanceUsers(p->Parent); }
- elif(move>0 && p->Item.pNext){ lstMoveDown(&p->Parent->Packages, p); laNotifyInstanceUsers(p->Parent); }
- }
- void erpset_PackageProductMove(ERPPackageProduct* pp, int move){
- if(move<0 && pp->Item.pPrev){ lstMoveUp(&pp->Parent->IncludedProducts, pp); laNotifyInstanceUsers(pp->Parent); }
- elif(move>0 && pp->Item.pNext){ lstMoveDown(&pp->Parent->IncludedProducts, pp); laNotifyInstanceUsers(pp->Parent); }
- }
- void erpset_MessageEntryMove(ERPMessageEntry* me, int move){
- if(move<0 && me->Item.pPrev){ lstMoveUp(&me->Parent->Messages, me); laNotifyInstanceUsers(me->Parent); }
- elif(move>0 && me->Item.pNext){ lstMoveDown(&me->Parent->Messages, me); laNotifyInstanceUsers(me->Parent); }
- }
- void* erpget_FirstCustomer(void* unused1,void* unused2){ return erp->Customers.pFirst; }
- void* erpget_FirstProduct(void* unused1,void* unused2){ return erp->Products.pFirst; }
- void* erpget_FirstMessage(void* unused1,void* unused2){ return erp->Messages.pFirst; }
- void* erpget_FirstProductEntryOption(ERPProductEntryOption* peo,void* unused2){ return peo->Parent&&peo->Parent->Product?peo->Parent->Product->AvailableOptions.pFirst:0; }
- void* erpget_FirstProductEntryOptionValue(ERPProductEntryOption* peo,void* unused2){ return peo->Option?peo->Option->Values.pFirst:0; }
- void* erpget_FirstProductEntryFromPackageProduct(ERPPackageProduct* pp,void* unused2){ return pp->Parent&&pp->Parent->Parent?pp->Parent->Parent->ProductEntries.pFirst:0; }
- void* erpgetactive_ProductEntryProduct(ERPProductEntry* pe, void* unused){ return pe->Product; }
- void* erpgetactive_MessageEntryMessage(ERPMessageEntry* me, void* unused){ return me->Message; }
- void erpRegisterEverything(){
- laPropContainer* pc; laKeyMapper* km; laProp* p; laSubProp* sp; laOperatorType* at;
-
- laCreateOperatorType("ERP_new_order","New Order","New order",0,0,0,erpinv_NewOrder,0,'+',0);
- laCreateOperatorType("ERP_new_customer","New Customer","New customer",0,0,0,erpinv_NewCustomer,0,'+',0);
- laCreateOperatorType("ERP_new_product","New Product","New product",0,0,0,erpinv_NewProduct,0,'+',0);
- laCreateOperatorType("ERP_new_product_option","New Option","New option",0,0,0,erpinv_NewProductOption,0,'+',0);
- laCreateOperatorType("ERP_new_product_option_value","New Value","New value",0,0,0,erpinv_NewProductOptionValue,0,'+',0);
- laCreateOperatorType("ERP_new_product_entry","New Product Entry","New product entry",0,0,0,erpinv_NewProductEntry,0,'+',0);
- laCreateOperatorType("ERP_new_product_entry_option","New Option","New option",0,0,0,erpinv_NewProductEntryOption,0,'+',0);
- laCreateOperatorType("ERP_new_package","New Package","New package",0,0,0,erpinv_NewPackage,0,'+',0);
- laCreateOperatorType("ERP_new_package_product","New Package Product","New package Product",0,0,0,erpinv_NewPackageProduct,0,'+',0);
- laCreateOperatorType("ERP_new_message","New Message","New Message",0,0,0,erpinv_NewMessage,0,'+',0);
- laCreateOperatorType("ERP_new_message_entry","New Message Entry","New Message Entry",0,0,0,erpinv_NewMessageEntry,0,'+',0);
- laCreateOperatorType("ERP_remove_order","Remove Order","Remove order",0,0,0,erpinv_RemoveOrder,erpmod_RemoveOrder,U'🞫',0);
- laCreateOperatorType("ERP_remove_product","Remove Product","Remove product",0,0,0,erpinv_RemoveProduct,erpmod_RemoveProduct,U'🞫',0);
- laCreateOperatorType("ERP_remove_customer","Remove Customer","Remove customer",0,0,0,erpinv_RemoveCustomer,erpmod_RemoveCustomer,U'🞫',0);
- laCreateOperatorType("ERP_remove_package","Remove Package","Remove package",0,0,0,erpinv_RemovePackage,erpmod_RemovePackage,U'🞫',0);
- laCreateOperatorType("ERP_remove_product_option","Remove Product Option","Remove product option",0,0,0,erpinv_RemoveProductOption,erpmod_RemoveProductOption,U'🞫',0);
- laCreateOperatorType("ERP_remove_product_entry","Remove Product Entry","Remove product entry",0,0,0,erpinv_RemoveProductEntry,erpmod_RemoveProductEntry,U'🞫',0);
- laCreateOperatorType("ERP_remove_product_entry_option","Remove Product Entry Option","Remove product entry option",0,0,0,erpinv_RemoveProductEntryOption,0,U'🞫',0);
- laCreateOperatorType("ERP_remove_product_option_value","Remove Product Option Value","Remove product option value",0,0,0,erpinv_RemoveProductOptionValue,0,U'🞫',0);
- laCreateOperatorType("ERP_remove_package_product","Remove Package Product","Remove package product",0,0,0,erpinv_RemovePackageProduct,0,U'🞫',0);
- laCreateOperatorType("ERP_remove_message","Remove Message","Remove Message",0,0,0,erpinv_RemoveMessage,erpmod_RemoveMessage,U'🞫',0);
- laCreateOperatorType("ERP_remove_message_entry","Remove Message Entry","Remove Message Entry",0,0,0,erpinv_RemoveMessageEntry,erpmod_RemoveMessageEntry,U'🞫',0);
-
- laCreateOperatorType("ERP_print_order_info","Print Order Info","Print order info",0,0,0,erpinv_PrintOrderInfo,0,0,0);
-
- pc=laDefineRoot();
- laAddSubGroup(pc,"erp","ERP","ERP main","erp_main",0,0,0,-1,erpget_erp,0,0,0,0,0,0,LA_UDF_SINGLE);
- pc=laAddPropertyContainer("erp_main","ERP MAIN","ERP root structure",0,0,sizeof(ERPMain),0,0,1);
- laAddSubGroup(pc,"current_order","Current Order","Current Order","erp_order",0,0,0,offsetof(ERPMain,CurrentOrder),0,0,0,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"current_product","Current Product","Current Product","erp_product",0,0,0,offsetof(ERPMain,CurrentProduct),0,0,0,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"current_customer","Current Customer","Current Customer","erp_customer",0,0,0,offsetof(ERPMain,CurrentCustomer),0,0,0,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"current_message","Current Message","Current Message","erp_message",0,0,0,offsetof(ERPMain,CurrentMessage),0,0,0,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"orders","Orders","All Orders","erp_order",0,0,0,offsetof(ERPMain,CurrentOrder),0,0,0,0,0,0,offsetof(ERPMain,Orders),0);
- laAddSubGroup(pc,"products","Products","All Products","erp_product",0,0,0,offsetof(ERPMain,CurrentProduct),0,0,0,0,0,0,offsetof(ERPMain,Products),0);
- laAddSubGroup(pc,"customers","Customers","All Customers","erp_customer",0,0,0,offsetof(ERPMain,CurrentCustomer),0,0,0,0,0,0,offsetof(ERPMain,Customers),0);
- laAddSubGroup(pc,"messages","Messages","All Messages","erp_message",0,0,0,offsetof(ERPMain,CurrentMessage),0,0,0,0,0,0,offsetof(ERPMain,Messages),0);
-
- pc=laAddPropertyContainer("erp_customer","ERP Customer","ERP customer",0,0,sizeof(ERPCustomer),0,0,2);
- laAddStringProperty(pc,"nickname","Nickname","Nickname",0,0,0,0,1,offsetof(ERPCustomer,Nickname),0,0,0,0,LA_AS_IDENTIFIER);
- laAddStringProperty(pc,"name","Name","Name",0,0,0,0,1,offsetof(ERPCustomer,Name),0,0,0,0,0);
- laAddStringProperty(pc,"country","Country","Country",0,0,0,0,1,offsetof(ERPCustomer,Country),0,0,0,0,0);
- laAddStringProperty(pc,"state","State","State",0,0,0,0,1,offsetof(ERPCustomer,State),0,0,0,0,0);
- laAddStringProperty(pc,"city","City","City",0,0,0,0,1,offsetof(ERPCustomer,City),0,0,0,0,0);
- laAddStringProperty(pc,"address","Address","Address",0,0,0,0,1,offsetof(ERPCustomer,Address),0,0,0,0,0);
- laAddStringProperty(pc,"postal_code","PostalCode","PostalCode",0,0,0,0,1,offsetof(ERPCustomer,PostalCode),0,0,0,0,0);
- laAddStringProperty(pc,"tel","Tel","Tel",0,0,0,0,1,offsetof(ERPCustomer,Tel),0,0,0,0,0);
- laAddStringProperty(pc,"email","EMail","EMail",0,0,0,0,1,offsetof(ERPCustomer,EMail),0,0,0,0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this customer","ERP_remove_customer",0,0);
- pc=laAddPropertyContainer("erp_order","ERP Order","ERP order",0,0,sizeof(ERPOrder),0,0,2);
- laAddSubGroup(pc,"customer","Customer","Customer","erp_customer",0,LA_WIDGET_ENUM_SELECTOR,erpui_CustomerListItem,offsetof(ERPOrder,Customer),erpget_FirstCustomer,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"product_entries","Product Entries","Product entries","erp_product_entry",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPOrder,ProductEntries),0);
- laAddSubGroup(pc,"message_entries","Message Entries","Message entries","erp_message_entry",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPOrder,Messages),0);
- laAddSubGroup(pc,"packages","Packages","Packages","erp_package",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPOrder,Packages),0);
- laAddStringProperty(pc,"comments","Comments","Comments about the order",0,0,0,0,1,offsetof(ERPOrder,Comments),0,0,0,0,0);
- laAddStringProperty(pc,"admin_comments","Admin comments","Admin comments about the order",0,0,0,0,1,offsetof(ERPOrder,AdminComments),0,0,0,0,0);
- p=laAddEnumProperty(pc,"state","State","State of the order",0,0,0,0,0,offsetof(ERPOrder,State),0,0,0,0,0,0,0,0,0,0);
- laAddEnumItemAs(p,"PENDING_PACKAGING","Pending Packaging","Pending packaging",ERP_ORDER_STATE_PENDING_PACKAGING,0);
- laAddEnumItemAs(p,"PENDING_LABEL","Pending Label","Pending label",ERP_ORDER_STATE_PENDING_LABEL,0);
- laAddEnumItemAs(p,"PENDING_SHIPPING","Pending Shipping","Pending shipping",ERP_ORDER_STATE_PENDING_SHIPPING,0);
- laAddEnumItemAs(p,"SHIPPED","Shipped","Shipped",ERP_ORDER_STATE_SHIPPED,0);
- laAddEnumItemAs(p,"ARRIVED","Arrived","Arrived",ERP_ORDER_STATE_ARRIVED,0);
- laAddEnumItemAs(p,"IN_PERSON","In Person","Pending packaging",ERP_ORDER_STATE_IN_PERSON,0);
- laAddEnumItemAs(p,"NEEDS_INFO","Needs Information","Pending packaging",ERP_ORDER_STATE_NEED_INFO,0);
- laAddIntProperty(pc,"paid","Paid","Paid",0,0,0,0,0,0,0,0,offsetof(ERPOrder,Paid),0,0,0,0,0,0,0,0,0,0,0);
- laAddIntProperty(pc,"order_discount","Order Discount","Order discount",0,0,0,0,0,0,0,0,offsetof(ERPOrder,OrderDiscount),0,0,0,0,0,0,0,0,0,0,0);
- laAddIntProperty(pc,"order_price","Order Price","Order price",0,0,0,0,0,0,0,0,offsetof(ERPOrder,OrderPrice),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
- laAddOperatorProperty(pc,"new_item","New Item","New product entry","ERP_new_product_entry",0,0);
- laAddOperatorProperty(pc,"new_package","New Package","New package for the order","ERP_new_package",0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this order","ERP_remove_order",0,0);
- laAddOperatorProperty(pc,"print","Print","Print out this order","ERP_print_order_info",0,0);
- laAddOperatorProperty(pc,"new_message","New Message","New Message","ERP_new_message_entry",0,0);
- pc=laAddPropertyContainer("erp_package","ERP Package","ERP package",0,0,sizeof(ERPPackage),0,0,1);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_PackageMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddSubGroup(pc,"parent","Parent","Parent order","erp_order",0,0,0,offsetof(ERPPackage,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddStringProperty(pc,"tracking","Tracking","Tracking number",0,0,0,0,1,offsetof(ERPPackage,Tracking),0,0,0,0,LA_AS_IDENTIFIER);
- laAddSubGroup(pc,"included_products","Included Products","Included products","erp_package_product",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPPackage,IncludedProducts),0);
- laAddOperatorProperty(pc,"new_entry","New Entry","Add product entry to package","ERP_new_package_product",0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this package","ERP_remove_package",0,0);
- pc=laAddPropertyContainer("erp_package_product","ERP Package Product","ERP package product",0,0,sizeof(ERPPackageProduct),0,0,1);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_PackageProductMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddSubGroup(pc,"parent","Parent","Parent order","erp_package",0,0,0,offsetof(ERPPackageProduct,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddSubGroup(pc,"product","Product","Prduct entry","erp_product_entry",0,LA_WIDGET_COLLECTION_SELECTOR,erpui_ProductEntryListItem,offsetof(ERPPackageProduct,Product),erpget_FirstProductEntryFromPackageProduct,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddOperatorProperty(pc,"remove","Remove","Remove this product","ERP_remove_package_product",0,0);
- pc=laAddPropertyContainer("erp_product_entry","ERP Product Entry","ERP Product Entry",0,0,sizeof(ERPProductEntry),0,0,1);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_ProductEntryMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddSubGroup(pc,"parent","Parent","Parent order","erp_order",0,0,0,offsetof(ERPProductEntry,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddSubGroup(pc,"product","Product","Product","erp_product",0,LA_WIDGET_COLLECTION_SELECTOR,erpui_ProductListItem,offsetof(ERPProductEntry,Product),erpget_FirstProduct,erpgetactive_ProductEntryProduct,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"options","Options","Product Options","erp_product_entry_option",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPProductEntry,Options),0);
- laAddIntProperty(pc,"amount","Amount","Amount",0,0,0,0,0,0,0,0,offsetof(ERPProductEntry,Amount),0,0,0,0,0,0,0,0,0,0,0);
- laAddIntProperty(pc,"entry_price","Entry Price","Entry price",LA_WIDGET_INT_PLAIN,0,0,0,0,0,0,0,offsetof(ERPProductEntry,EntryPrice),0,0,0,0,0,0,0,0,0,0,LA_READ_ONLY);
- laAddOperatorProperty(pc,"new_option","New Option","New product option","ERP_new_product_entry_option",0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this entry","ERP_remove_product_entry",0,0);
- pc=laAddPropertyContainer("erp_product_entry_option","ERP Product Entry Option","ERP Product Entry Option",0,0,sizeof(ERPProductEntryOption),0,0,1);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_ProductEntryOptionMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddSubGroup(pc,"parent","Parent","Parent entry","erp_product_entry",0,0,0,offsetof(ERPProductEntryOption,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddSubGroup(pc,"option","Option","Option","erp_product_option",0,LA_WIDGET_COLLECTION_SELECTOR,laui_IdentifierOnly,offsetof(ERPProductEntryOption,Option),erpget_FirstProductEntryOption,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddSubGroup(pc,"value","Value","Value","erp_product_option_value",0,LA_WIDGET_COLLECTION_SELECTOR,laui_IdentifierOnly,offsetof(ERPProductEntryOption,Value),erpget_FirstProductEntryOptionValue,0,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddIntProperty(pc,"option_price_offset","Option price Offset","Option price offset",0,0,0,0,0,0,0,0,offsetof(ERPProductEntryOption,OptionPriceOffset),0,0,0,0,0,0,0,0,0,0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this option","ERP_remove_product_entry_option",0,0);
- pc=laAddPropertyContainer("erp_product","ERP Product","ERP product",0,0,sizeof(ERPOrder),0,0,2);
- laAddStringProperty(pc,"name","Name","Name",0,0,0,0,1,offsetof(ERPProduct,Name),0,0,0,0,LA_AS_IDENTIFIER);
- laAddSubGroup(pc,"available_options","Available Options","Available options","erp_product_option",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPProduct,AvailableOptions),0);
- laAddIntProperty(pc,"price","Price","Price",0,0,0,0,0,0,0,0,offsetof(ERPProduct,Price),0,0,0,0,0,0,0,0,0,0,0);
- laAddIntProperty(pc,"discounted_price","Discounted Price","Discounted price",0,0,0,0,0,0,0,0,offsetof(ERPProduct,DiscountedPrice),0,0,0,0,0,0,0,0,0,0,0);
- laAddOperatorProperty(pc,"new_option","New Option","New option for the product","ERP_new_product_option",0,0);
- laAddStringProperty(pc,"hs_code","HS code","EU HS Code",0,0,0,0,1,offsetof(ERPProduct,HSCode),0,0,0,0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this product","ERP_remove_product",0,0);
- pc=laAddPropertyContainer("erp_product_option","ERP Product Option","ERP Product Option",0,0,sizeof(ERPProductOption),0,0,1);
- laAddSubGroup(pc,"parent","Parent","Parent product","erp_product",0,0,0,offsetof(ERPProductOption,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddStringProperty(pc,"name","Name","Name",0,0,0,0,1,offsetof(ERPProductOption,Name),0,0,0,0,LA_AS_IDENTIFIER);
- laAddSubGroup(pc,"values","Values","Values","erp_product_option_value",0,0,0,-1,0,0,0,0,0,0,offsetof(ERPProductOption,Values),0);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_ProductOptionMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddOperatorProperty(pc,"new_value","New Value","New value for the option","ERP_new_product_option_value",0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this product option","ERP_remove_product_option",0,0);
- pc=laAddPropertyContainer("erp_product_option_value","ERP Product Option","ERP Product Option Value",0,0,sizeof(ERPProductOptionValue),0,0,1);
- laAddSubGroup(pc,"parent","Parent","Parent product option","erp_product_option",0,0,0,offsetof(ERPProductOptionValue,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddStringProperty(pc,"name","Name","Name",0,0,0,0,1,offsetof(ERPProductOptionValue,Name),0,0,0,0,LA_AS_IDENTIFIER);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_ProductOptionValueMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddIntProperty(pc,"price_offset","Price Offset","Price offset",0,0,0,0,0,0,0,0,offsetof(ERPProductOptionValue,PriceOffset),0,0,0,0,0,0,0,0,0,0,0);
- laAddOperatorProperty(pc,"remove","Remove","Remove this product option value","ERP_remove_product_option_value",0,0);
- pc=laAddPropertyContainer("erp_message","ERP Message","ERP message",0,0,sizeof(ERPMessage),0,0,2);
- laAddStringProperty(pc,"description","Description","description of the message",0,0,0,0,1,offsetof(ERPMessage,Description),0,0,0,0,LA_AS_IDENTIFIER);
- laAddStringProperty(pc,"message","Message","Body of the message",0,0,0,0,1,offsetof(ERPMessage,Message),0,0,0,0,0);
- p = laAddEnumProperty(pc,"is_header","Is Header","Put the message on the header",LA_WIDGET_ENUM_HIGHLIGHT,0,0,0,0,offsetof(ERPMessage,IsHeader),0,0,0,0,0,0,0,0,0,0);
- laAddEnumItemAs(p,"NONE","None","Put message at the end of the order",0,0);
- laAddEnumItemAs(p,"HEADER","Header","Put message at the top of the order",1,U'↑');
- pc=laAddPropertyContainer("erp_message_entry","ERP Message Entry","ERP message entry",0,0,sizeof(ERPMessageEntry),0,0,1);
- laAddIntProperty(pc,"__move","Move","Move slider",LA_WIDGET_HEIGHT_ADJUSTER,0,0,0,0,0,0,0,0,0,erpset_MessageEntryMove,0,0,0,0,0,0,0,0,LA_UDF_IGNORE);
- laAddSubGroup(pc,"parent","Parent","Parent order","erp_order",0,0,0,offsetof(ERPMessageEntry,Parent),0,0,0,0,0,0,0,LA_UDF_REFER|LA_READ_ONLY);
- laAddSubGroup(pc,"message","Message","Message","erp_message",0,LA_WIDGET_COLLECTION_SELECTOR,erpui_MessageListItem,offsetof(ERPProductEntry,Product),erpget_FirstMessage,erpgetactive_MessageEntryMessage,laget_ListNext,0,0,0,0,LA_UDF_REFER);
- laAddOperatorProperty(pc,"remove","Remove","Remove this message entry","ERP_remove_message_entry",0,0);
- laSaveProp("erp.products");
- laSaveProp("erp.customers");
- laSaveProp("erp.orders");
- laSaveProp("erp.messages");
- laRegisterUiTemplate("erp_panel_orders","Orders",erpui_OrdersPanel,0,0,0,0,20,20);
- laRegisterUiTemplate("erp_panel_products","Products",erpui_ProductsPanel,0,0,0,0,20,20);
- laRegisterUiTemplate("erp_panel_customers","Customers",erpui_CustomersPanel,0,0,0,0,20,20);
- laRegisterUiTemplate("erp_panel_messages","Messages",erpui_MessagesPanel,0,0,0,0,20,20);
- }
- void erpInit(){
- erp=memAcquire(sizeof(ERPMain));
- laAddRootDBInst("erp");
- }
|