source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/interfaces.py @ 12600

Last change on this file since 12600 was 12600, checked in by Henrik Bettermann, 10 years ago

Add more RPC fields.

Add signatures in footer of RPC contract slip.

  • Property svn:keywords set to Id
File size: 14.7 KB
Line 
1## $Id: interfaces.py 12600 2015-02-11 18:41:56Z henrik $
2##
3## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18
19from zope import schema
20from datetime import datetime
21from zc.sourcefactory.basic import BasicSourceFactory
22from waeup.ikoba.interfaces import IIkobaObject
23from waeup.ikoba.customers.interfaces import (
24    ICustomer, ICustomerDocument, ICustomerPDFDocument, IContract,
25    validate_email)
26from waeup.ikoba.customers.vocabularies import (
27    ConCatProductSource, CustomerDocumentSource, nats_vocab)
28from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber
29from waeup.ikoba.products.productoptions import ProductOptionField
30from ikobacustom.pcn.interfaces import MessageFactory as _
31from ikobacustom.pcn.interfaces import LGASource
32from ikobacustom.pcn.customers.schoolgrades import ResultEntryField
33
34def year_range():
35    curr_year = datetime.now().year
36    return range(curr_year - 2, curr_year + 5)
37
38class PracticeSource(BasicSourceFactory):
39    """A source for categories of practice.
40    """
41    def getValues(self):
42        return [
43            'academic',
44            'administrative',
45            'distribution',
46            'importation',
47            'manufacturing',
48            'retail and dispensing',
49            'wholesale',
50            ]
51
52
53class IPCNCustomer(ICustomer):
54    """Representation of a customer.
55
56    """
57
58    date_of_birth = FormattedDate(
59        title = _(u'Date of Birth'),
60        required = True,
61        show_year = True,
62        )
63
64# Customer document interfaces
65
66
67class IPCNCustomerJPGDocument(ICustomerDocument):
68    """A customer jpg document.
69
70    """
71
72class IPCNCustomerPDFDocument(ICustomerPDFDocument):
73    """A customer pdf document.
74
75    """
76
77# Customer contract interfaces
78
79class IRONContract(IContract):
80    """A Retention of Name contract.
81
82    """
83
84    state_of_origin = schema.Choice(
85        vocabulary = nats_vocab,
86        title = _(u'State of Origin'),
87        required = False,
88        )
89
90    lga = schema.Choice(
91        source = LGASource(),
92        title = _(u'State / LGA'),
93        required = True,
94        )
95
96    year_qualification = schema.Choice(
97        title = _(u'Year of Qualification'),
98        required = True,
99        values = year_range(),
100        )
101
102    res_address = schema.Text(
103        title = _(u'Residential Address'),
104        required = True,
105        )
106
107    work_address = schema.Text(
108        title = _(u'Work Address'),
109        required = False,
110        )
111
112    work_email = schema.ASCIILine(
113        title = _(u'Work Email Address'),
114        required = False,
115        constraint=validate_email,
116        )
117
118    work_phone = PhoneNumber(
119        title = _(u'Work Phone'),
120        description = u'',
121        required = False,
122        )
123
124    categories_practice = schema.List(
125        title = _(u'Categories of Practice'),
126        value_type = schema.Choice(source=PracticeSource()),
127        required = False,
128        default = [],
129        )
130
131    superintendent = schema.Bool(
132        title= _('Superintendent'),
133        description= _('Tick box if you are a superintendent pharamcist.'),
134        required = False,
135        )
136
137    #document_object = schema.Choice(
138    #    title = _(u'Document'),
139    #    source = CustomerDocumentSource(),
140    #    required = False,
141    #    )
142
143class IRONContractOfficialUse(IIkobaObject):
144    """Interface for editing RON official use data.
145
146    """
147
148    comment = schema.Text(
149        title= _('Reason for rejection'),
150        required = False,
151        )
152
153
154class IRONContractProcess(IRONContract, IRONContractOfficialUse):
155    """Interface for processing RON data.
156    """
157
158    product_options = schema.List(
159        title = _(u'Options/Fees'),
160        value_type = ProductOptionField(),
161        required = False,
162        readonly = False,
163        default = [],
164        )
165
166class IRONContractEdit(IRONContract):
167    """Interface for editing RON data by customers.
168
169    """
170
171    #document_object = schema.Choice(
172    #    title = _(u'Document'),
173    #    source = CustomerDocumentSource(),
174    #    required = True,
175    #    )
176
177
178class IROPContract(IContract):
179    """A Registration of Premises contract.
180
181    """
182
183    premises_address = schema.Text(
184        title = _(u'Name and  Address of Pharmaceutical Premises'),
185        required = True,
186        )
187
188    categories_practice = schema.List(
189        title = _(u'Categories of Practice'),
190        value_type = schema.Choice(source=PracticeSource()),
191        required = False,
192        default = [],
193        )
194
195    premises_certificate = schema.TextLine(
196        title = _(u'Last Premises Certificate'),
197        description= _('If an old premises, state the last premises certificate number issued with date.'),
198        required = False,
199        )
200
201    date_of_qualification = FormattedDate(
202        title = _(u'Date of Qualification'),
203        required = False,
204        show_year = True,
205        )
206
207    res_address = schema.Text(
208        title = _(u'Residential Address'),
209        required = False,
210        )
211
212    last_license_number = schema.TextLine(
213        title = _(u'Last Annual License Number'),
214        required = False,
215        )
216
217    superintendent = schema.Bool(
218        title= _('Superintendent'),
219        description= _('Tick box if you were a superintendent pharamcist last year.'),
220        required = False,
221        )
222
223    work_address = schema.Text(
224        title = _(u'Full Time Employment Address'),
225        description= _('Enter work address if you were not a superintendent pharamcist last year.'),
226        required = False,
227        )
228
229    pharmacists_directors= schema.TextLine(
230        title = _(u'Pharmacist Directors'),
231        description = _(u'Full name of directors and their profession as in Form C.O.7'),
232        required = False,
233        )
234
235    other_directors= schema.TextLine(
236        title = _(u'Other Directors'),
237        description = _(u'Full name of directors and their profession as in Form C.O.7'),
238        required = False,
239        )
240
241    #document_object = schema.Choice(
242    #    title = _(u'Document'),
243    #    source = CustomerDocumentSource(),
244    #    required = False,
245    #    )
246
247class IROPContractOfficialUse(IIkobaObject):
248    """Interface for editing ROP official use data.
249
250    """
251
252    inspected = schema.Bool(
253        title = _('Inspected'),
254        description = _('Has the premises been duly inspected?'),
255        required = False,
256        )
257
258    recommended = schema.Bool(
259        title = _('Recommended'),
260        description= _('Is the premises recommended?'),
261        required = False,
262        )
263
264    official_in_state = schema.TextLine(
265        title = _(u'Name of Official in the State'),
266        required = False,
267        )
268
269class IROPContractProcess(IROPContract, IROPContractOfficialUse):
270    """Interface for processing RON data.
271    """
272
273    product_options = schema.List(
274        title = _(u'Options/Fees'),
275        value_type = ProductOptionField(),
276        required = False,
277        readonly = False,
278        default = [],
279        )
280
281class IROPContractEdit(IROPContract):
282    """Interface for editing RON data by customers.
283
284    """
285
286    #document_object = schema.Choice(
287    #    title = _(u'Document'),
288    #    source = CustomerDocumentSource(),
289    #    required = True,
290    #    )
291
292class IRPRContract(IContract):
293    """A Registration in the Provisional Register contract.
294
295    """
296
297    state_of_origin = schema.Choice(
298        vocabulary = nats_vocab,
299        title = _(u'State of Origin'),
300        required = False,
301        )
302
303    res_address = schema.Text(
304        title = _(u'Residential Address'),
305        required = False,
306        )
307
308    pharmacies_addresses = schema.Text(
309        title = _(u'Pharmacies Attended'),
310        description = u'Enter the addresses of pharmacies and periods of attendance.',
311        required = False,
312        readonly = False,
313        )
314
315    qualifications = schema.Text(
316        title = _(u'Qualifications'),
317        description = u'Enter a list of certificates obtained.',
318        required = False,
319        readonly = False,
320        )
321
322    certificates_object = schema.Choice(
323        title = _(u'Certificates'),
324        description = u'Select the document which contains scanned copies '
325                      u'of your certificates. You must create such a '
326                      u'document first.',
327        source = CustomerDocumentSource(),
328        required = False,
329        )
330
331    referee1_name = schema.TextLine(
332        title = _(u'First Referee Name'),
333        required = False,
334        readonly = False,
335        )
336
337    referee1_address = schema.Text(
338        title = _(u'First Referee Address'),
339        required = False,
340        readonly = False,
341        )
342
343    referee1_license = schema.TextLine(
344        title = _(u'First Referee License Number'),
345        required = False,
346        readonly = False,
347        )
348
349    referee2_name = schema.TextLine(
350        title = _(u'Second Referee Name'),
351        required = False,
352        readonly = False,
353        )
354
355    referee2_address = schema.Text(
356        title = _(u'Second Referee Address'),
357        required = False,
358        readonly = False,
359        )
360
361    referee2_license = schema.TextLine(
362        title = _(u'Second Referee License Number'),
363        required = False,
364        readonly = False,
365        )
366
367    internship_address = schema.Text(
368        title = _(u'Internship'),
369        description = u'Enter name and address of company where you want to serve your internship.',
370        required = False,
371        readonly = False,
372        )
373
374
375
376class IRPRContractOfficialUse(IIkobaObject):
377    """Interface for editing RPR official use data.
378
379    """
380
381    comment = schema.Text(
382        title= _('Reason for rejection'),
383        required = False,
384        )
385
386
387class IRPRContractProcess(IRPRContract, IRPRContractOfficialUse):
388    """Interface for processing RPR data.
389    """
390
391    product_options = schema.List(
392        title = _(u'Options/Fees'),
393        value_type = ProductOptionField(),
394        required = False,
395        readonly = False,
396        default = [],
397        )
398
399class IRPRContractEdit(IRPRContract):
400    """Interface for editing RPR data by customers.
401
402    """
403
404    certificates_object = schema.Choice(
405        title = _(u'Certificates'),
406        description = u'Select the document which contains scanned copies '
407                      u'of your certificates. You must create such a '
408                      u'document first.',
409        source = CustomerDocumentSource(),
410        required = True,
411        )
412
413IRPRContractEdit['certificates_object'].order = IRPRContract[
414    'certificates_object'].order
415
416
417class IRPCContract(IContract):
418    """A Registration as Pharmaceutical Chemist.
419
420    """
421
422    nationality = schema.Choice(
423        vocabulary = nats_vocab,
424        title = _(u'Nationality'),
425        required = False,
426        )
427
428    nationality_aquired = schema.Choice(
429        values=[_(u'birth'), _(u'naturalization')],
430        title = _(u'Nationality acquired by'),
431        required = False,
432        )
433
434    res_address = schema.Text(
435        title = _(u'Residential Address'),
436        required = False,
437        )
438
439    qualifications = schema.Text(
440        title = _(u'Qualifications'),
441        description = u'Enter a list of certificates obtained.',
442        required = False,
443        readonly = False,
444        )
445
446    certificates_object = schema.Choice(
447        title = _(u'Certificates'),
448        description = u'Select the document which contains scanned copies '
449                      u'of your certificates. You must create such a '
450                      u'document first.',
451        source = CustomerDocumentSource(),
452        required = False,
453        )
454
455    referee1_name = schema.TextLine(
456        title = _(u'First Referee Name'),
457        required = False,
458        readonly = False,
459        )
460
461    referee1_address = schema.Text(
462        title = _(u'First Referee Address'),
463        required = False,
464        readonly = False,
465        )
466
467    referee1_license = schema.TextLine(
468        title = _(u'First Referee License Number'),
469        required = False,
470        readonly = False,
471        )
472
473    referee2_name = schema.TextLine(
474        title = _(u'Second Referee Name'),
475        required = False,
476        readonly = False,
477        )
478
479    referee2_address = schema.Text(
480        title = _(u'Second Referee Address'),
481        required = False,
482        readonly = False,
483        )
484
485    referee2_license = schema.TextLine(
486        title = _(u'Second Referee License Number'),
487        required = False,
488        readonly = False,
489        )
490
491    internship = schema.Text(
492        title = _(u'Internship'),
493        description = u'Enter name and address of the company where you '
494                      u'served your internship, the name of the approved '
495                      u'registered pharmacist and the period of your service.',
496        required = False,
497        readonly = False,
498        )
499
500    nigerian_residence = FormattedDate(
501        title = _(u'Residence in Nigeria'),
502        description = u'Enter the date since when you have continously '
503                      u'resided in Nigeria.',
504        required = False,
505        show_year = True,
506        )
507
508    witness = schema.Text(
509        title = _(u'Witness'),
510        description = u'Enter name and adress of witness.',
511        required = False,
512        )
513
514
515class IRPCContractOfficialUse(IIkobaObject):
516    """Interface for editing RPC official use data.
517
518    """
519
520    comment = schema.Text(
521        title= _('Reason for rejection'),
522        required = False,
523        )
524
525
526class IRPCContractProcess(IRPCContract, IRPCContractOfficialUse):
527    """Interface for processing RPC data.
528    """
529
530    product_options = schema.List(
531        title = _(u'Options/Fees'),
532        value_type = ProductOptionField(),
533        required = False,
534        readonly = False,
535        default = [],
536        )
537
538class IRPCContractEdit(IRPCContract):
539    """Interface for editing RPC data by customers.
540
541    """
542
543    certificates_object = schema.Choice(
544        title = _(u'Certificates'),
545        description = u'Select the document which contains scanned copies '
546                      u'of your certificates. You must create such a '
547                      u'document first.',
548        source = CustomerDocumentSource(),
549        required = True,
550        )
551
552IRPCContractEdit['certificates_object'].order = IRPCContract[
553    'certificates_object'].order
Note: See TracBrowser for help on using the repository browser.