/[papo]/papo/forms/ownPos.neb
ViewVC logotype

Diff of /papo/forms/ownPos.neb

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by apronotti, Wed May 14 19:01:51 2003 UTC revision 1.6 by styxman, Thu May 15 14:00:49 2003 UTC
# Line 9  Line 9 
9    
10  <!-- organization search -->  <!-- organization search -->
11    
12   <datasource name="orgDataSource" database="papo"   <datasource name="orgDataSource" database="papo"
13      table="entity, _entity_data, own_entity, _own_entity_data, organization, _organization_data">      table="entity, _entity_data, own_entity, _own_entity_data, organization, _organization_data">
14      <condition>      <condition>
15        <and>        <and>
# Line 19  Line 19 
19            <cfield name="_own_entity_data._table"/>            <cfield name="_own_entity_data._table"/>
20          </eq>          </eq>
21          <eq>          <eq>
22            <cfield name="_own_entity_data.entity"/>            <cfield name="_own_entity_data.entity"/>
23            <cfield name="_entity_data._table"/>            <cfield name="_entity_data._table"/>
24          </eq>          </eq>
25          <!-- history tables = null n -->          <!-- history tables = null n -->
# Line 123  Line 123 
123      </condition>      </condition>
124    </datasource>    </datasource>
125    
126    
127   <!-- triggers -->   <!-- triggers -->
128    
129    <trigger type="ON-STARTUP">    <trigger type="ON-STARTUP">
130      masterBlock = getParameter ('master')      masterBlock = getParameter ('master')
131      editBlock = getParameter ('edit')      editBlock = getParameter ('edit')
132      if editBlock:      if editBlock:
133          #busco el punto de venta          # busco el punto de venta
134          ownPosBlock.initQuery()          ownPosBlock.initQuery()
135          ownPosBlock.ownPosEntityIdEntry = str(editBlock.posEntityIdEntry)          ownPosBlock.ownPosEntityIdEntry = str(editBlock.posEntityIdEntry)
136          ownPosBlock.processQuery()          ownPosBlock.processQuery()
137          #busco entity_relation  
138            # busco entity_relation
139          entityRelationBlock.initQuery()          entityRelationBlock.initQuery()
140          entityRelationBlock.entityRelationToEntry = str(ownPosBlock.ownPosEntityIdEntry)          entityRelationBlock.entityRelationToEntry = str(ownPosBlock.ownPosEntityIdEntry)
141          entityRelationBlock.entityRelationFromEntry = str(masterBlock.branchIdEntry)          entityRelationBlock.entityRelationFromEntry = str(masterBlock.branchIdEntry)
142          entityRelationBlock.processQuery()          entityRelationBlock.processQuery()
143          #busco relation_types  
144            # busco relation_types
145          relationTypesBlock.initQuery()          relationTypesBlock.initQuery()
146          relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry)          relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry)
147          relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline>          relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline>
148          relationTypesBlock.processQuery()          relationTypesBlock.processQuery()
149      #le cargo el nombre de branch y de organization  
150      docOrgBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry)      # le cargo el nombre de branch y de organization
151      orgDataSource.createResultSet()      # docOrgBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry)
152      ownBranchBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry)      # orgDataSource.createResultSet()
153      docOrgBlock.organizationNameEntry =str(ownBranchBlock.organizationNameEntry)      # ownBranchBlock.ownBranchNameEntry = str(masterBlock.branchNameEntry)
154        # docOrgBlock.organizationNameEntry =str(ownBranchBlock.organizationNameEntry)
155     </trigger>     </trigger>
156    
157    
158    <trigger name="commitTrigger" type="NAMED">    <trigger name="commitTrigger" type="NAMED">
159    if ownPosBlock.getCurrentRecord().isInserted():    from gnue.common.GDataObjects import ConnectionError as DBError
160      masterBlock = getParameter ('master')    
161      print "Poniendo Nuevo"    try:
162      ownPosBlock.commit()      commitState= 0
163      #cargo el tipo      if ownPosBlock.getCurrentRecord().isInserted():
164      entityTypesBlock.ownPosEntityEntry = str(ownPosBlock.ownPosEntityIdEntry)        masterBlock = getParameter ('master')
165      entityTypesBlock.ownPosEntityTypeEntry = <neb:Inline>'"'.PAPO::ownPosType.'"'</neb:Inline>        print "Poniendo Nuevo"
166      #cargo la entity_relation y el id del branch al que pertenece        ownPosBlock.postChanges()
167      entityRelationBlock.entityRelationFromEntry = str(masterBlock.branchIdEntry)  
168      entityRelationBlock.entityRelationToEntry = str(ownPosBlock.ownPosEntityIdEntry)        commitState= 1
169      ownPosBlock.commit()        # cargo el tipo
170      #cargo relation_types        entityTypesBlock.ownPosEntityEntry = str(ownPosBlock.ownPosEntityIdEntry)
171      relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry)        entityTypesBlock.ownPosEntityTypeEntry = <neb:Inline>'"'.PAPO::ownPosType.'"'</neb:Inline>
172      relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline>        # this one's a detail :-\
173      #cargo los documentos típicos        ownPosBlock.postChanges ()
174      <neb:Block>my $numero = 0; foreach(PAPO::ownPosDocuments) {</neb:Block>  
175      <neb:Inline>{ "posDocBlock.nextRecord()"  if $numero > 0 }</neb:Inline>        commitState= 2
176      posDocBlock.posDocTypeIdEntry = <neb:Inline>'"'.$_.'"'</neb:Inline>        # cargo la entity_relation y el id del branch al que pertenece
177      posDocBlock.posDocPrintEntry =  <neb:Inline>'"'.PAPO::ownPosDocumentsPrint.'"'</neb:Inline>        entityRelationBlock.entityRelationFromEntry = str(masterBlock.branchIdEntry)
178      posDocBlock.posDocNumberEntry =  <neb:Inline>'"'.PAPO::ownPosDocumentsNumber.'"'</neb:Inline>              entityRelationBlock.entityRelationToEntry = str(ownPosBlock.ownPosEntityIdEntry)
179      <neb:Block>$numero++;}</neb:Block>        ownPosBlock.postChanges()
180      ownPosBlock.commit()  
181    else:        commitState= 3
182      ownPosBlock.commit()          # cargo relation_types
183      print 'solo editando'        relationTypesBlock.entityRelationEntry = str(entityRelationBlock.entityRelationIdEntry)
184     </trigger>        relationTypesBlock.relationTypeEntry = <neb:Inline>'"'.PAPO::posOfType.'"'</neb:Inline>
185          relationTypesBlock.postChanges ()
186    
187          commitState= 4
188          # cargo los documentos típicos
189          <neb:Block>my $numero = 0; foreach(PAPO::ownPosDocuments) {</neb:Block>
190          <neb:Inline>{ "posDocBlock.nextRecord()"  if $numero > 0 }</neb:Inline>
191          posDocBlock.posDocTypeIdEntry = <neb:Inline>'"'.$_.'"'</neb:Inline>
192          posDocBlock.posDocPrintEntry =  <neb:Inline>'"'.PAPO::ownPosDocumentsPrint.'"'</neb:Inline>
193          posDocBlock.posDocNumberEntry =  <neb:Inline>'"'.PAPO::ownPosDocumentsNumber.'"'</neb:Inline>
194          <neb:Block>$numero++;}</neb:Block>
195          # this one's a detail :-\
196          ownPosBlock.postChanges()
197        else:
198          ownPosBlock.postChanges()
199        commitConnection ()
200      except DBError, err:
201        mesgs= [ 'los datos del punto de venta', 'el tipo de entidad', 'la relación con la sucursal', 'los tipos de relación', 'los números de facturas' ]
202        rollbackConnection()
203        message = "Hay problemas para grabar "+mesgs[commitState]
204        genericBox(mesagge+"\n"+str(err),['Aceptar'])
205      </trigger>
206    <trigger name="ownPosRollbackTrigger" type="NAMED">    <trigger name="ownPosRollbackTrigger" type="NAMED">
     import hack  
207      ownPosBlock.reset()      ownPosBlock.reset()
208      </trigger>      </trigger>
209    <trigger name="posDocRollbackTrigger" type="NAMED">    <trigger name="posDocRollbackTrigger" type="NAMED">
     import hack  
210      ownPosBlock.reset()      ownPosBlock.reset()
211      posDocBlock.reset()      posDocBlock.reset()
212    </trigger>    </trigger>
# Line 192  Line 214 
214    
215    
216    <trigger type="ON-EXIT">    <trigger type="ON-EXIT">
217        # quick: what's this for?
218        print "saliendo"
219      func= getParameter('callback')      func= getParameter('callback')
220        print "saliendo"
221      func()      func()
222      print "saliendo"      print "saliendo"
223    </trigger>    </trigger>
# Line 200  Line 225 
225    <page name="Gestión">    <page name="Gestión">
226      <!--identificador-->      <!--identificador-->
227      <box label="Sucursal" x="0" y="0" height="5" width="84">      <box label="Sucursal" x="0" y="0" height="5" width="84">
228        <block name="ownBranchBlock" datasource="orgDataSource">        <block name="ownBranchBlock" datasource="orgDataSource">
229          <label text="organización"   x="1" y="1" />          <label text="Organización:"   x="1" y="1" />
230          <label text="sucursal" x="40" y="1" />          <label text="Sucursal:" x="40" y="1" />
231          <entry name="organizationNameEntry" x="1" y="2" field="_entity_data.name" width="40"          <entry name="organizationNameEntry" x="1" y="2" field="_entity_data.name" width="40"
232            style="label" />            style="label" />
233          <entry name="ownBranchNameEntry" x="40" y="2" width="40" style="label"/>          <entry name="ownBranchNameEntry" x="40" y="2" width="40" style="label"/>
234        </block>        </block>
235      </box>      </box>
236      <!--abm-->      <!--abm-->
237      <box label="Punto de venta" x="0" y="4" height="18" width="84">      <box label="Punto de venta" x="0" y="4" height="18" width="84">
238      <block name="ownPosBlock" datasource="ownPosDataSource" restrictInsert="y" transparentBlock="y">        <block name="ownPosBlock" datasource="ownPosDataSource" restrictInsert="y" transparentBlock="y">
239        <entry name="ownPosEntityIdEntry" field="entity.id"  x="70" y="9" width="10" hidden="" />          <entry name="ownPosEntityIdEntry" field="entity.id"  x="70" y="9" width="10" hidden="" />
240        <label text="Nombre" x="1" y="1"/>          <label text="Nombre:" x="1" y="1"/>
241        <label text="Número" x="1" y="3"/>          <label text="Número:" x="1" y="3"/>
242        <label text="Stock por factura" x="1" y="6"/>          <label text="Stock por factura:" x="1" y="6"/>
243        <entry name="numberEntry" field="_own_pos_data.number" x="1" y="4" width="10"/>          <entry name="numberEntry" field="_own_pos_data.number" x="1" y="4" width="10"/>
244        <entry name="nameEntry" field="_entity_data.name" x="1" y="2" width="40"/>          <entry name="nameEntry" field="_entity_data.name" x="1" y="2" width="40"/>
245        <entry name="StockByInvoiceEntry" field="_own_pos_data.stock_by_invoice" x="20" y="6" width="2" default="1"/>          <entry name="StockByInvoiceEntry" field="_own_pos_data.stock_by_invoice" x="20" y="6" width="2" default="1"/>
246        <label text="Observaciones" x="1" y="7"/>          <label text="Observaciones:" x="1" y="7"/>
247        <entry name="obs" field="_entity_data.observations" x="1" y="8" width="25" height="7"/>          <entry name="obs" field="_entity_data.observations" x="1" y="8" width="25" height="7"/>
248        <button x="1" y="15" trigger="commitTrigger" width="9" label="Aceptar" name="ownPosCommitBtn" height="1"/>            <button x="1" y="15" trigger="commitTrigger" width="9" label="Aceptar" name="ownPosCommitBtn" height="1"/>
249        <button x="21" y="15" trigger="ownPosRollbackTrigger" width="9" label="Cancelar" name="ownPosRollbackBtn" height="1"/>          <button x="21" y="15" trigger="ownPosRollbackTrigger" width="9" label="Cancelar" name="ownPosRollbackBtn" height="1"/>
250      </block>        </block>
251      </box>      </box>
252      <block name="entityTypesBlock" datasource="entityTypesDataSource" >      <block name="entityTypesBlock" datasource="entityTypesDataSource" >
253        <entry name="ownPosEntityTypeEntry" field="_entity_types_data.entity_type"        <entry name="ownPosEntityTypeEntry" field="_entity_types_data.entity_type"
# Line 233  Line 258 
258      <!--entity relation-->      <!--entity relation-->
259      <block name="entityRelationBlock" datasource="entityRelationDataSource" >      <block name="entityRelationBlock" datasource="entityRelationDataSource" >
260        <entry name="entityRelationIdEntry" field="entity_relation.id" x="70" y="1" hidden="" />        <entry name="entityRelationIdEntry" field="entity_relation.id" x="70" y="1" hidden="" />
261        <entry name="entityRelationToEntry" field="_entity_relation_data.entity_to" x="70" y="2" hidden="" />            <entry name="entityRelationToEntry" field="_entity_relation_data.entity_to" x="70" y="2" hidden="" />
262        <entry name="entityRelationFromEntry" field="_entity_relation_data.entity_from" x="70" y="3" hidden="" />        <entry name="entityRelationFromEntry" field="_entity_relation_data.entity_from" x="70" y="3" hidden="" />
263      </block>      </block>
264      <!--relation_types-->      <!--relation_types-->
265      <block name="relationTypesBlock" datasource="relationTypesDataSource" >      <block name="relationTypesBlock" datasource="relationTypesDataSource" >
266        <entry name="relationTypeEntry" field="_relation_types_data.relation_type" x="70" y="5" hidden="" />            <entry name="relationTypeEntry" field="_relation_types_data.relation_type" x="70" y="5" hidden="" />
267        <entry name="entityRelationEntry" field="_relation_types_data.entity_relation" x="70" y="6" hidden=""/>        <entry name="entityRelationEntry" field="_relation_types_data.entity_relation" x="70" y="6" hidden=""/>
268      </block>      </block>
269      <!--/entity relation-->      <!--/entity relation-->
# Line 260  Line 285 
285          </and>          </and>
286        </condition>        </condition>
287      </datasource>      </datasource>
288      <!-- del text lookup del nombre y codigo de document type -->          <!-- del text lookup del nombre y codigo de document type -->
289    <datasource name="documentsDataSource" database="papo" table="_document_type_data ">    <datasource name="documentsDataSource" database="papo" table="_document_type_data ">
290        <condition>        <condition>
291          <and>          <and>
# Line 281  Line 306 
306        <block name="documentsPosBlock" datasource="ownPosDataSource">        <block name="documentsPosBlock" datasource="ownPosDataSource">
307          <label text="organización:" x="1" y="1" />          <label text="organización:" x="1" y="1" />
308          <label text="sucursal:" x="40" y="1" />          <label text="sucursal:" x="40" y="1" />
309          <label text="punto de venta:" x="1" y="3" />          <label text="punto de venta:" x="1" y="3" />
310          <label text="número:" x="40" y="3" />          <label text="número:" x="40" y="3" />
311          <entry name="ownPosNameEntry" x="1" y="4" width="40" field="_entity_data.name" style="label" />          <entry name="ownPosNameEntry" x="1" y="4" width="40" field="_entity_data.name" style="label" />
312          <entry name="ownPosIdEntry" x="40" y="4" width="10" field="_own_pos_data.number" style="label"/>          <entry name="ownPosIdEntry" x="40" y="4" width="10" field="_own_pos_data.number" style="label"/>
# Line 294  Line 319 
319          <label text="Tipo de documento" x="10" y="1" />          <label text="Tipo de documento" x="10" y="1" />
320          <label text="N prox" x="50" y="1" />          <label text="N prox" x="50" y="1" />
321          <label text="Impresión" x="60" y="1" />          <label text="Impresión" x="60" y="1" />
322          <entry x="1"  y="2"  name="posDocTypeIdEntry" rows="10" field="_own_pos_document_data.document_type" hidden="" />          <entry x="1"  y="2"  name="posDocTypeIdEntry" rows="10" field="_own_pos_document_data.document_type" hidden="" />
323        <entry x="1" y="2" field="_own_pos_document_data.document_type" name="posDocTypeCodeEntry"  readonly="" width="10" style="textlookup" foreign_key="documentsDataSource._table" foreign_key_description="code" rows="10" />            <entry x="1" y="2" field="_own_pos_document_data.document_type" name="posDocTypeCodeEntry"  readonly="" width="10" style="textlookup" foreign_key="documentsDataSource._table" foreign_key_description="code" rows="10" />
324          <entry x="10" y="2" field="_own_pos_document_data.document_type" name="posDocTypeNameEntry"  readonly="" width="35" style="textlookup" foreign_key="documentsDataSource._table" foreign_key_description="name" rows="10" />            <entry x="10" y="2" field="_own_pos_document_data.document_type" name="posDocTypeNameEntry"  readonly="" width="35" style="textlookup" foreign_key="documentsDataSource._table" foreign_key_description="name" rows="10" />
325           <entry x="50" y="2" width="10" name="posDocNumberEntry" field="_own_pos_document_data.number" rows="10" />             <entry x="50" y="2" width="10" name="posDocNumberEntry" field="_own_pos_document_data.number" rows="10" />
326          <entry x="60" y="2" width="10" name="posDocPrintEntry" field="_own_pos_document_data.print_command" rows="10" />          <entry x="60" y="2" width="10" name="posDocPrintEntry" field="_own_pos_document_data.print_command" rows="10" />
327          <button x="1" y="13" trigger="commitTrigger" width="9" label="Aceptar" name="posDocCommitBtn" height="1"/>            <button x="1" y="13" trigger="commitTrigger" width="9" label="Aceptar" name="posDocCommitBtn" height="1"/>
328          <button x="21" y="13" trigger="posDocRollbackTrigger" width="9" label="Cancelar" name="posDocRollbackBtn" height="1"/>          <button x="21" y="13" trigger="posDocRollbackTrigger" width="9" label="Cancelar" name="posDocRollbackBtn" height="1"/>
329         <scrollbar page="10" x="80" y="2" width="3" height="10"/>         <scrollbar page="10" x="80" y="2" width="3" height="10"/>
330        </block>        </block>
331      </box>      </box>
332    </page>    </page>
333  </form>    </form>
   

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26