Wtx ~ Wt Extension Library
WtxLib
Template.h
1 /**************************************************************************
2 ###########################################################################
3 ##
4 ## $SHOWOFFDB_BEGIN_LICENSE$
5 ## Copyright (C) 2011 Lorimark Solutions, LLC and/or its subsidiary(-ies).
6 ## All rights reserved.
7 ## Contact: Lorimark Solutions, LLC (info@showoff-db.org)
8 ##
9 ## This file is part of the Showoff Database Application Framework.
10 ##
11 ## Commercial Usage
12 ## Licensees holding valid ShowoffDB Commercial licenses may use this file in
13 ## accordance with the ShowoffDB Commercial License Agreement provided with the
14 ## Software or, alternatively, in accordance with the terms contained in
15 ## a written agreement between you and Lorimark Solutions, LLC.
16 ##
17 ## GNU Lesser General Public License Usage
18 ## Alternatively, this file may be used under the terms of the GNU Lesser
19 ## General Public License version 2.1 as published by the Free Software
20 ## Foundation and appearing in the file LICENSE.LGPL included in the
21 ## packaging of this file. Please review the following information to
22 ## ensure the GNU Lesser General Public License version 2.1 requirements
23 ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ##
25 ## In addition, as a special exception, Lorimark Solutions, LLC gives
26 ## you certain additional rights. These rights are described in the
27 ## Lorimark Solutions, LLC ShowoffDB LGPL Exception version 1.0, included in
28 ## the file LGPL_EXCEPTION.txt in this package.
29 ##
30 ## GNU General Public License Usage
31 ## Alternatively, this file may be used under the terms of the GNU
32 ## General Public License version 3.0 as published by the Free Software
33 ## Foundation and appearing in the file LICENSE.GPL included in the
34 ## packaging of this file. Please review the following information to
35 ## ensure the GNU General Public License version 3.0 requirements will be
36 ## met: http://www.gnu.org/copyleft/gpl.html.
37 ##
38 ## If you have questions regarding the use of this file, please contact
39 ## Lorimark Solutions, LLC at info@showoff-db.org.
40 ## $SHOWOFFDB_END_LICENSE$
41 ##
42 #############################################################################
43 ****************************************************************************/
44 
45 
46 #ifndef __WTX_CRM_COMPANY_TEMPLATE_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__
47 #define __WTX_CRM_COMPANY_TEMPLATE_H_234e0174_6b7d_11e8_b503_fb1ef3651ec0__
48 
49 #include <Wtx/Dbo/PermissionItemTpl.h>
50 #include <Wtx/Sys/Lookup/Item.h>
51 
52 #include "Definition.h"
53 
54 namespace Wtx {
55  namespace Crm {
56  namespace Company {
57 
58 template <class C> class Template
60 {
61  public:
62 
63  Template( const std::string keyField = "" )
64  : Wtx::Dbo::PermissionItemTpl<C>( keyField )
65  {
66  }
67 
68  Template( const std::string & key, const std::string & cfy )
69  : Wtx::Dbo::PermissionItemTpl<C>( key, cfy )
70  {
71  }
72 
74  : Wtx::Dbo::PermissionItemTpl<C>( other.keyField().value(), other.cfyField().value() )
75  {
76  }
77 
78  virtual ~Template()
79  {
80  }
81 
82 
83  static Definition & TableDef()
84  {
85  return C::TableDef();
86  }
87 
88 // const Wtx::Dbo::Field< Wtx::Sys::Lookup::Item::Ptr > & status () const { return m_status ; }
89  const Wtx::Dbo::Field< std::string > & accountName () const { return m_accountName ; }
90  const Wtx::Dbo::Field< std::string > & accountNote () const { return m_accountNote ; }
91  const Wtx::Dbo::Field< Wt::WDate > & activityDate () const { return m_activityDate ; }
92  const Wtx::Dbo::Field< Wt::WDate > & activeFrom () const { return m_activeFrom ; }
93  const Wtx::Dbo::Field< Wt::WDate > & activeTo () const { return m_activeTo ; }
94 
95  const Wtx::Dbo::Field< std::string > & custType () const { return m_custType ; }
96  const Wtx::Dbo::Field< std::string > & note () const { return m_note ; }
97  const Wtx::Dbo::Field< std::string > & notes () const { return m_notes ; }
98  const Wtx::Dbo::Field< std::string > & alert () const { return m_alert ; }
99  const Wtx::Dbo::Field< std::string > & phone1 () const { return m_phone1 ; }
100  const Wtx::Dbo::Field< std::string > & phone2 () const { return m_phone2 ; }
101  const Wtx::Dbo::Field< std::string > & addr () const { return m_addr ; }
102  const Wtx::Dbo::Field< std::string > & addr2 () const { return m_addr2 ; }
103  const Wtx::Dbo::Field< std::string > & fax () const { return m_fax ; }
104  const Wtx::Dbo::Field< Wtx::Sys::Lookup::Item::Ptr > & terms () const { return m_terms ; }
105  const Wtx::Dbo::Field< std::string > & city () const { return m_city ; }
106  const Wtx::Dbo::Field< std::string > & state () const { return m_state ; }
107  const Wtx::Dbo::Field< std::string > & zip () const { return m_zip ; }
108  const Wtx::Dbo::Field< std::string > & country () const { return m_country ; }
109  const Wtx::Dbo::Field< std::string > & payor () const { return m_payor ; }
110  const Wtx::Dbo::Field< std::string > & carrier () const { return m_carrier ; }
111  const Wtx::Dbo::Field< std::string > & email () const { return m_email ; }
112  const Wtx::Dbo::Field< std::string > & emailBilling () const { return m_emailBilling ; }
113  const Wtx::Dbo::Field< std::string > & contact () const { return m_contact ; }
114  const Wtx::Dbo::Field< std::string > & contactPhone () const { return m_contactPhone ; }
115  const Wtx::Dbo::Field< std::string > & buyer () const { return m_buyer ; }
116  const Wtx::Dbo::Field< std::string > & buyerPhone () const { return m_buyerPhone ; }
117  const Wtx::Dbo::Field< std::string > & memo () const { return m_memo ; }
118  const Wtx::Dbo::Field< int > & expAdj () const { return m_expAdj ; }
119  const Wtx::Dbo::Field< bool > & catchWt () const { return m_catchWt ; }
120  const Wtx::Dbo::Field< bool > & useLotNumbers () const { return m_useLotNumbers ; }
121  const Wtx::Dbo::Field< int > & chargeMin () const { return m_chargeMin ; }
122  const Wtx::Dbo::Field< int > & chargeDiffDays () const { return m_chargeDiffDays ; }
123  const Wtx::Dbo::Field< int > & chargeLtDays () const { return m_chargeLtDays ; }
124  const Wtx::Dbo::Field< int > & chargeStart () const { return m_chargeStart ; }
125  const Wtx::Dbo::Field< float > & chargeMinInvChgIn () const { return m_chargeMinInvChgIn ; }
126  const Wtx::Dbo::Field< float > & chargeMinInvChgOut () const { return m_chargeMinInvChgOut ; }
127 
128  const Wtx::Dbo::Field< std::string > & companyName () const { return m_companyName ; }
129  const Wtx::Dbo::Field< std::string > & contactName () const { return m_contactName ; }
130  const Wtx::Dbo::Field< std::string > & mainPhone () const { return m_mainPhone ; }
131  const Wtx::Dbo::Field< std::string > & category () const { return m_category ; }
132 
133  const Wtx::Dbo::Field< Wt::WDate > & lastBilledEom () const { return m_lastBilledEom ; }
134  const Wtx::Dbo::Field< Wt::WDate > & lastBilledMaster () const { return m_lastBilledMaster ; }
135 
136  Wtx::Dbo::Field< Wtx::Sys::Lookup::Item::Ptr > & status () { return m_status ; }
137  Wtx::Dbo::Field< std::string > & accountName () { return m_accountName ; }
138  Wtx::Dbo::Field< std::string > & accountNote () { return m_accountNote ; }
139  Wtx::Dbo::Field< Wt::WDate > & activityDate () { return m_activityDate ; }
140  Wtx::Dbo::Field< Wt::WDate > & activeFrom () { return m_activeFrom ; }
141  Wtx::Dbo::Field< Wt::WDate > & activeTo () { return m_activeTo ; }
142 
143  Wtx::Dbo::Field< std::string > & custType () { return m_custType ; }
144  Wtx::Dbo::Field< std::string > & note () { return m_note ; }
145  Wtx::Dbo::Field< std::string > & notes () { return m_notes ; }
146  Wtx::Dbo::Field< std::string > & alert () { return m_alert ; }
147  Wtx::Dbo::Field< std::string > & phone1 () { return m_phone1 ; }
148  Wtx::Dbo::Field< std::string > & phone2 () { return m_phone2 ; }
149  Wtx::Dbo::Field< std::string > & addr () { return m_addr ; }
150  Wtx::Dbo::Field< std::string > & addr2 () { return m_addr2 ; }
151  Wtx::Dbo::Field< std::string > & fax () { return m_fax ; }
152  Wtx::Dbo::Field< Wtx::Sys::Lookup::Item::Ptr > & terms () { return m_terms ; }
153  Wtx::Dbo::Field< std::string > & city () { return m_city ; }
154  Wtx::Dbo::Field< std::string > & state () { return m_state ; }
155  Wtx::Dbo::Field< std::string > & zip () { return m_zip ; }
156  Wtx::Dbo::Field< std::string > & country () { return m_country ; }
157  Wtx::Dbo::Field< std::string > & payor () { return m_payor ; }
158  Wtx::Dbo::Field< std::string > & carrier () { return m_carrier ; }
159  Wtx::Dbo::Field< std::string > & email () { return m_email ; }
160  Wtx::Dbo::Field< std::string > & emailBilling () { return m_emailBilling ; }
161  Wtx::Dbo::Field< std::string > & contact () { return m_contact ; }
162  Wtx::Dbo::Field< std::string > & contactPhone () { return m_contactPhone ; }
163  Wtx::Dbo::Field< std::string > & buyer () { return m_buyer ; }
164  Wtx::Dbo::Field< std::string > & buyerPhone () { return m_buyerPhone ; }
165  Wtx::Dbo::Field< std::string > & memo () { return m_memo ; }
166  Wtx::Dbo::Field< int > & expAdj () { return m_expAdj ; }
167  Wtx::Dbo::Field< bool > & catchWt () { return m_catchWt ; }
168  Wtx::Dbo::Field< bool > & useLotNumbers () { return m_useLotNumbers ; }
169  Wtx::Dbo::Field< int > & chargeMin () { return m_chargeMin ; }
170  Wtx::Dbo::Field< int > & chargeDiffDays () { return m_chargeDiffDays ; }
171  Wtx::Dbo::Field< int > & chargeLtDays () { return m_chargeLtDays ; }
172  Wtx::Dbo::Field< int > & chargeStart () { return m_chargeStart ; }
173  Wtx::Dbo::Field< float > & chargeMinInvChgIn () { return m_chargeMinInvChgIn ; }
174  Wtx::Dbo::Field< float > & chargeMinInvChgOut () { return m_chargeMinInvChgOut ; }
175 
176  Wtx::Dbo::Field< std::string > & companyName () { return m_companyName ; }
177  Wtx::Dbo::Field< std::string > & contactName () { return m_contactName ; }
178  Wtx::Dbo::Field< std::string > & mainPhone () { return m_mainPhone ; }
179  Wtx::Dbo::Field< std::string > & category () { return m_category ; }
180 
181  Wtx::Dbo::Field< Wt::WDate > lastBilledEom () { return m_lastBilledEom ; }
182  Wtx::Dbo::Field< Wt::WDate > lastBilledMaster () { return m_lastBilledMaster ; }
183 
184  std::string cityStateZip() const
185  {
186  std::string retVal = city().value();
187 
188  if( state().value() != "" )
189  {
190  retVal += ", " + state().value();
191  }
192 
193  if( zip().value() != "" )
194  {
195  retVal += " " + zip().value();
196  }
197 
198  return retVal;
199  }
200 
201  template<class Action> void persist( Action & a )
202  {
204 
205  m_status .persist( a, &TableDef(). StatusFieldDef );
206  m_accountName .persist( a, &TableDef(). AccountNameFieldDef );
207  m_accountNote .persist( a, &TableDef(). AccountNoteFieldDef );
208  m_activityDate .persist( a, &TableDef(). ActivityDateFieldDef );
209  m_activeFrom .persist( a, &TableDef(). ActiveFromFieldDef );
210  m_activeTo .persist( a, &TableDef(). ActiveToFieldDef );
211 
212  m_custType .persist( a, &TableDef(). CustTypeFieldDef );
213  m_note .persist( a, &TableDef(). NoteFieldDef );
214  m_notes .persist( a, &TableDef(). NotesFieldDef );
215  m_alert .persist( a, &TableDef(). AlertFieldDef );
216  m_phone1 .persist( a, &TableDef(). Phone1FieldDef );
217  m_phone2 .persist( a, &TableDef(). Phone2FieldDef );
218  m_addr .persist( a, &TableDef(). AddrFieldDef );
219  m_addr2 .persist( a, &TableDef(). Addr2FieldDef );
220  m_fax .persist( a, &TableDef(). FaxFieldDef );
221  m_terms .persist( a, &TableDef(). TermsFieldDef );
222  m_city .persist( a, &TableDef(). CityFieldDef );
223  m_state .persist( a, &TableDef(). StateFieldDef );
224  m_zip .persist( a, &TableDef(). ZipFieldDef );
225  m_country .persist( a, &TableDef(). CountryFieldDef );
226  m_payor .persist( a, &TableDef(). PayorFieldDef );
227  m_carrier .persist( a, &TableDef(). CarrierFieldDef );
228  m_email .persist( a, &TableDef(). EmailFieldDef );
229  m_emailBilling .persist( a, &TableDef(). EmailBillingFieldDef );
230  m_contact .persist( a, &TableDef(). ContactFieldDef );
231  m_contactPhone .persist( a, &TableDef(). ContactPhoneFieldDef );
232  m_buyer .persist( a, &TableDef(). BuyerFieldDef );
233  m_buyerPhone .persist( a, &TableDef(). BuyerPhoneFieldDef );
234  m_memo .persist( a, &TableDef(). MemoFieldDef );
235  m_expAdj .persist( a, &TableDef(). ExpAdjFieldDef );
236  m_catchWt .persist( a, &TableDef(). CatchWtFieldDef );
237  m_useLotNumbers .persist( a, &TableDef(). UseLotNumbersFieldDef );
238  m_chargeMin .persist( a, &TableDef(). ChargeMinFieldDef );
239  m_chargeDiffDays .persist( a, &TableDef(). ChargeDiffDaysFieldDef );
240  m_chargeLtDays .persist( a, &TableDef(). ChargeLtDaysFieldDef );
241  m_chargeStart .persist( a, &TableDef(). ChargeStartFieldDef );
242  m_chargeMinInvChgIn .persist( a, &TableDef(). ChargeMinInvChgInFieldDef );
243  m_chargeMinInvChgOut .persist( a, &TableDef(). ChargeMinInvChgOutFieldDef );
244 
245  m_companyName .persist( a, &TableDef(). CompanyNameFieldDef );
246  m_contactName .persist( a, &TableDef(). ContactNameFieldDef );
247  m_mainPhone .persist( a, &TableDef(). MainPhoneFieldDef );
248  m_category .persist( a, &TableDef(). CategoryFieldDef );
249 
250  m_lastBilledEom .persist( a, &TableDef(). LastBilledEomFieldDef );
251  m_lastBilledMaster .persist( a, &TableDef(). LastBilledMasterFieldDef );
252 
253  }
254 
255  private:
256 
258  Wtx::Dbo::Field< std::string > m_accountName ;
259  Wtx::Dbo::Field< std::string > m_accountNote ;
260  Wtx::Dbo::Field< Wt::WDate > m_activityDate ;
261  Wtx::Dbo::Field< Wt::WDate > m_activeFrom ;
262  Wtx::Dbo::Field< Wt::WDate > m_activeTo ;
263 
264  Wtx::Dbo::Field< std::string > m_custType ;
281  Wtx::Dbo::Field< std::string > m_emailBilling ;
283  Wtx::Dbo::Field< std::string > m_contactPhone ;
285  Wtx::Dbo::Field< std::string > m_buyerPhone ;
287  Wtx::Dbo::Field< int > m_expAdj ;
288  Wtx::Dbo::Field< bool > m_catchWt ;
289  Wtx::Dbo::Field< bool > m_useLotNumbers ;
290  Wtx::Dbo::Field< int > m_chargeMin ;
291  Wtx::Dbo::Field< int > m_chargeDiffDays ;
292  Wtx::Dbo::Field< int > m_chargeLtDays ;
293  Wtx::Dbo::Field< int > m_chargeStart ;
294  Wtx::Dbo::Field< float > m_chargeMinInvChgIn ;
295  Wtx::Dbo::Field< float > m_chargeMinInvChgOut ;
296 
297  Wtx::Dbo::Field< std::string > m_companyName ;
298  Wtx::Dbo::Field< std::string > m_contactName ;
299  Wtx::Dbo::Field< std::string > m_mainPhone ;
300  Wtx::Dbo::Field< std::string > m_category ;
301 
302  Wtx::Dbo::Field< Wt::WDate > m_lastBilledEom ;
303  Wtx::Dbo::Field< Wt::WDate > m_lastBilledMaster ;
304 
305 }; // endpublic Wtx::Dbo::PermissionItemTpl<C>
306 
307  } // endnamespace Company
308  } // endnamespace Crm
309 } // endnamespace Wtx
310 
311 #endif // __WTX_CRM_COMPANY_TEMPLATE_H___
312 
witty extension library
Definition: Activity.h:51