|
@@ -24,51 +24,6 @@ void* erpget_erp(void* unused1, void* unused2){
|
|
|
return erp;
|
|
|
}
|
|
|
|
|
|
-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_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);
|
|
@@ -189,6 +144,14 @@ void erpui_PackageItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProp
|
|
|
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;
|
|
@@ -221,6 +184,12 @@ void erpui_OrderItem(laUiList *uil, laPropPack *This, laPropPack *DetachedProps,
|
|
|
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;
|
|
@@ -250,7 +219,87 @@ void erpui_OrdersPanel(laUiList *uil, laPropPack *This, laPropPack *DetachedProp
|
|
|
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; }
|
|
@@ -300,6 +349,9 @@ void erp_GetOrderText(laSafeString** s, ERPOrder* 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);
|
|
@@ -349,7 +401,21 @@ ERPPackage* erpNewPackage(ERPOrder* o){ if(!o) return 0;
|
|
|
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);
|
|
|
}
|
|
@@ -365,8 +431,9 @@ void erpRemoveProductEntry(ERPOrder* o, ERPProductEntry* pe){
|
|
|
lstRemoveItem(&o->ProductEntries,pe); memLeave(pe); laNotifyInstanceUsers(o);
|
|
|
}
|
|
|
void erpRemoveOrder(ERPOrder* o){
|
|
|
- while(o->Packages.pFirst){ erpRemovePackage(o,o->ProductEntries.pFirst); }
|
|
|
+ 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);
|
|
@@ -405,6 +472,14 @@ void erpRemoveProduct(ERPProduct* p){
|
|
|
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);
|
|
@@ -448,6 +523,14 @@ int erpinv_NewPackageProduct(laOperator* a, laEvent* e){
|
|
|
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; }
|
|
@@ -560,6 +643,36 @@ int erpinv_RemovePackageProduct(laOperator* a, laEvent* e){
|
|
|
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; }
|
|
@@ -573,19 +686,22 @@ int erpinv_PrintOrderInfo(laOperator* a, laEvent* e){
|
|
|
.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);
|
|
|
+ //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); }
|
|
@@ -610,12 +726,18 @@ 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;
|
|
@@ -629,6 +751,8 @@ void erpRegisterEverything(){
|
|
|
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);
|
|
@@ -638,7 +762,9 @@ void erpRegisterEverything(){
|
|
|
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();
|
|
@@ -649,9 +775,11 @@ void erpRegisterEverything(){
|
|
|
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);
|
|
@@ -668,6 +796,7 @@ void erpRegisterEverything(){
|
|
|
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);
|
|
@@ -686,6 +815,7 @@ void erpRegisterEverything(){
|
|
|
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);
|
|
@@ -743,13 +873,28 @@ void erpRegisterEverything(){
|
|
|
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(){
|