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

Diff of /papo/forms/productProviderInvoice.neb

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

revision 1.34 by apronotti, Wed Aug 6 19:29:40 2003 UTC revision 1.35 by mhepp, Thu Aug 14 13:15:05 2003 UTC
# Line 1  Line 1 
1  <?xml version="1.0" encoding="ISO-8859-1"?>  <?xml version="1.0" encoding="ISO-8859-1"?>
2    
 <!--    start_timestamp (timestamp) -->  
 <!--    end_timestamp (timestamp) -->  
 <!--    observations (text) -->  
   
3  <form tabbed="top" width="107" height="25" title="Carga de Facturas de Proveedores">  <form tabbed="top" width="107" height="25" title="Carga de Facturas de Proveedores">
4    <neb:Block>    <neb:Block>
5      use PAPO;      use PAPO;
6      my $uniqed=0;      my $uniqed=0;
7    </neb:Block>    </neb:Block>
   <parameter name="invoiceDate" default=""/>  
   
   <datasource name="nil" cache="1"/>  
   <datasource name="payDataSource" cache="1"/>  
   <datasource name="tmpValuesDataSource" cache="1"/>  
   <datasource name="tmpSearchDataSource" cache="1"/>  
   <datasource name="currentSearchIdDataSource" cache="1"/>  
   <datasource name="tmpAmountDataSource" cache="1"/>  
   
  <datasource name="ownOrganizationDataSource" database="papo"  
              table="_entity_data, _own_entity_data, _organization_data, _persona_tax_profile_data, _tax_profile_data">  
     <condition>  
       <and>  
         <!-- uniones del objeto n-1 -->  
         <eq>  
           <cfield name="_own_entity_data._table"/>  
           <cfield name="_organization_data.own_entity"/>  
         </eq>  
         <eq>  
           <cfield name="_entity_data._table"/>  
           <cfield name="_own_entity_data.entity"/>  
         </eq>  
         <eq>  
          <cfield name="_entity_data._table"/>  
          <cfield name="_persona_tax_profile_data.persona"/>  
         </eq>  
         <eq>  
           <cfield name="_tax_profile_data._table"/>  
           <cfield name="_persona_tax_profile_data.tax_profile"/>  
         </eq>  
         <eq>  
           <cfield name="_tax_profile_data.tax"/>  
           <cconst value="1"/> <!-- IVA -->  
         </eq>  
         <!-- history tables = null n -->  
         <null>  
           <cfield name="_entity_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_own_entity_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_organization_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_persona_tax_profile_data._end_t"/>  
         </null>  
         <null>  
           <cfield name="_tax_profile_data._end_t"/>  
         </null>  
         <!--busco el 1 -->  
         <eq>  
           <cfield name="organization.id"/>  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <!-- Origen de datos que sirve para dar de alta procedimientos de pago (en este caso de la factura) -->  
   <datasource name="proceedingDataSource" database="papo" table="proceeding"/>  
   
   <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->  
   <datasource name="alienDocumentProceedingDataSource" database="papo" table="alien_document_proceeding"/>  
   
   <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->  
   <datasource name="alienDocumentProceedingShowDataSource" database="papo" table="alien_document_proceeding"/>  
   
   <!-- Origen de datos que sirve para dar de alta pagos con algun tipo de currency -->  
   <datasource name="currencyMovementDataSource" database="papo"  
               table="movement, currency_movement">  
     <condition>  
       <eq>  
         <cfield name="movement.id"/>  
         <cfield name="currency_movement.movement"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource name="contactDataSource" database="papo"  
     table="entity, _entity_data, alien_entity, _alien_entity_data,contact,  _contact_data"  
     order_by="_entity_data.name">  
     <condition>  
       <and>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="alien_entity.id"/>  
           <cfield name="_alien_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="contact.id"/>  
           <cfield name="_contact_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_alien_entity_data.entity"/>  
         </eq>  
         <eq>  
           <cfield name="alien_entity.id"/>  
           <cfield name="_contact_data.alien_entity"/>  
         </eq>  
        <null>  
           <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_alien_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_contact_data._end_t"/>  
        </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="receivedDataSource" database="papo"  
     table="entity, _entity_data, own_entity, _own_entity_data, employee, _employee_data" order_by="_entity_data.name">  
     <condition>  
       <and>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="own_entity.id"/>  
           <cfield name="_own_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="employee.id"/>  
           <cfield name="_employee_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_own_entity_data.entity"/>  
         </eq>  
         <eq>  
           <cfield name="own_entity.id"/>  
           <cfield name="_employee_data.own_entity"/>  
         </eq>  
        <null>  
           <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_own_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_employee_data._end_t"/>  
        </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="providerSearchDataSource" database="papo"  
     table="_entity_data, _alien_entity_data, _persona_data, _persona_tax_profile_data, _tax_profile_data,  
                      _provider_data, entity_type_uid_conf,  
                      _entity_uid_data" order_by="_entity_data.name">  
     <condition>  
       <and>  
        <eq>  
          <cfield name="_entity_data._table"/>  
          <cfield name="_alien_entity_data.entity"/>  
        </eq>  
        <eq>  
          <cfield name="_alien_entity_data._table"/>  
          <cfield name="_persona_data.alien_entity"/>  
        </eq>  
        <eq>  
          <cfield name="_persona_data._table"/>  
          <cfield name="_provider_data.persona"/>  
        </eq>  
        <eq>  
         <cfield name="_entity_data._table"/>  
          <cfield name="_entity_uid_data.entity"/>  
        </eq>  
        <eq>  
          <cfield name="_entity_data._table"/>  
          <cfield name="_persona_tax_profile_data.persona"/>  
        </eq>  
        <eq>  
          <cfield name="_tax_profile_data._table"/>  
          <cfield name="_persona_tax_profile_data.tax_profile"/>  
        </eq>  
        <eq>  
         <cconst value="1"/>  <!-- Corresponde al tipo de impuesto IVA -->  
         <cfield name="_tax_profile_data.tax"/>  
        </eq>  
        <eq>  
         <cconst value="8"/>  
         <cfield name="entity_type_uid_conf.entity_type"/>  
        </eq>  
        <eq>  
         <cfield name="_entity_uid_data.entity_uid_type"/>  
         <cfield name="entity_type_uid_conf.entity_uid_type"/>  
        </eq>  
        <null>  
           <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_alien_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_persona_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_provider_data._end_t"/>  
        </null>  
        <null>  
          <cfield name="_entity_uid_data._end_t"/>  
        </null>  
         <null>  
          <cfield name="_tax_profile_data._end_t"/>  
         </null>  
         <null>  
          <cfield name="_persona_tax_profile_data._end_t"/>  
         </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="providerUIDDataSource" database="papo"  
     table="_entity_data, entity_type_uid_conf, _entity_uid_data" cache="1">  
     <condition>  
       <and>  
        <eq>  
         <cfield name="_entity_data._table"/>  
          <cfield name="_entity_uid_data.entity"/>  
        </eq>  
        <eq>  
         <cconst value="8"/>  
         <cfield name="entity_type_uid_conf.entity_type"/>  
        </eq>  
        <eq>  
         <cfield name="_entity_uid_data.entity_uid_type"/>  
         <cfield name="entity_type_uid_conf.entity_uid_type"/>  
        </eq>  
        <null>  
          <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
          <cfield name="_entity_uid_data._end_t"/>  
        </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="providerNameDataSource" database="papo"  
     table="_entity_data">  
     <conditions>  
       <null>  
         <cfield name="_entity_data._end_t"/>  
       </null>  
     </conditions>  
   </datasource>  
   
   <datasource name="transportUIDDataSource" database="papo"  
     table="_entity_data, entity_type_uid_conf, _entity_uid_data" order_by="_entity_data.name">  
     <condition>  
       <and>  
        <eq>  
         <cfield name="_entity_data._table"/>  
          <cfield name="_entity_uid_data.entity"/>  
        </eq>  
        <eq>  
         <cconst value="8"/>  
         <cfield name="entity_type_uid_conf.entity_type"/>  
        </eq>  
        <eq>  
         <cfield name="_entity_uid_data.entity_uid_type"/>  
         <cfield name="entity_type_uid_conf.entity_uid_type"/>  
        </eq>  
        <null>  
          <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
          <cfield name="_entity_uid_data._end_t"/>  
        </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="transportNameDataSource" database="papo"  
     table="_entity_data">  
     <conditions>  
       <null>  
         <cfield name="_entity_data._end_t"/>  
       </null>  
     </conditions>  
   </datasource>  
   
   <datasource name="transportDataSource" database="papo"  
     table="entity, _entity_data, alien_entity, _alien_entity_data,  persona, _persona_data, provider, _provider_data"  
     order_by="_entity_data.name">  
     <condition>  
       <and>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="alien_entity.id"/>  
           <cfield name="_alien_entity_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="persona.id"/>  
           <cfield name="_persona_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="provider.id"/>  
           <cfield name="_provider_data._table"/>  
         </eq>  
         <eq>  
           <cfield name="entity.id"/>  
           <cfield name="_alien_entity_data.entity"/>  
         </eq>  
         <eq>  
           <cfield name="alien_entity.id"/>  
           <cfield name="_persona_data.alien_entity"/>  
         </eq>  
         <eq>  
           <cfield name="persona.id"/>  
           <cfield name="_provider_data.persona"/>  
         </eq>  
        <null>  
           <cfield name="_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_alien_entity_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_persona_data._end_t"/>  
        </null>  
        <null>  
           <cfield name="_provider_data._end_t"/>  
        </null>  
       </and>  
     </condition>  
   </datasource>  
   
   <!--  
       datasource usado para la búsqueda  
   -->  
   <datasource name="productSearchDataSource" database="papo"  
     table=" _product_data, _product_code_data, _product_tax_data"  
     cache="15" order_by="_product_data.canonical_name">  
     <condition>  
       <and>  
         <null>  
           <cfield name="_product_data._end_t"/>  
         </null>  
        <!-- pega product con product_code -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_code_data.product"/>  
         </eq>  
         <!-- solamente códigos internos (id 1) -->  
         <eq>  
           <cfield name="_product_code_data.product_code_type"/>  
           <cconst value="1"/>  
         </eq>  
         <!-- descarta códigos de producto muertos -->  
         <null>  
           <cfield name="_product_code_data._end_t"/>  
         </null>  
         <!-- pega product con product_tax -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_tax_data.product"/>  
         </eq>  
         <!-- descarta product_taxes muertos -->  
         <null>  
           <cfield name="_product_tax_data._end_t"/>  
         </null>  
         <!-- solamente 'IVA' (id 1) -->  
         <eq>  
           <cfield name="_product_tax_data.tax"/>  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="productUIDDataSource" database="papo"  
     table=" _product_data, _product_code_data, _product_tax_data"  
     cache="15" order_by="_product_data.canonical_name">  
     <condition>  
       <and>  
        <!-- pega product con product_code -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_code_data.product"/>  
         </eq>  
         <!-- solamente códigos internos (id 1) -->  
         <eq>  
           <cfield name="_product_code_data.product_code_type"/>  
           <cconst value="1"/>  
         </eq>  
         <!-- pega product con product_tax -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_tax_data.product"/>  
         </eq>  
         <!-- descarta product_taxes muertos -->  
 <!--         <null> -->  
 <!--           <cfield name="_product_tax_data._end_t"/> -->  
 <!--         </null> -->  
 <!--  Revisar porque tiene que paremetrizar por fecha -->  
         <!-- solamente 'IVA' (id 1) -->  
         <eq>  
           <cfield name="_product_tax_data.tax"/>  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="productNameDataSource" database="papo"  
     table=" _product_data, _product_code_data, _product_tax_data"  
     cache="15" order_by="_product_data.canonical_name">  
     <condition>  
       <and>  
        <!-- pega product con product_code -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_code_data.product"/>  
         </eq>  
         <!-- solamente códigos internos (id 1) -->  
         <eq>  
           <cfield name="_product_code_data.product_code_type"/>  
           <cconst value="1"/>  
         </eq>  
         <!-- pega product con product_tax -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_tax_data.product"/>  
         </eq>  
         <!-- descarta product_taxes muertos -->  
 <!--         <null> -->  
 <!--           <cfield name="_product_tax_data._end_t"/> -->  
 <!--         </null> -->  
 <!--  Revisar porque tiene que paremetrizar por fecha -->  
         <!-- solamente 'IVA' (id 1) -->  
         <eq>  
           <cfield name="_product_tax_data.tax"/>  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="productTaxDataSource" database="papo"  
     table=" _product_data, _product_tax_data"  
     order_by="_product_data.canonical_name">  
     <condition>  
       <and>  
         <!-- pega product con product_tax -->  
         <eq>  
           <cfield name="_product_data._table"/>  
           <cfield name="_product_tax_data.product"/>  
         </eq>  
 <!--         <or> -->  
           <!-- find the client state in that time -->  
 <!--           <between> -->  
 <!--             <cparam name="invoiceDate"/> -->  
 <!--             <cfield name="_product_tax_data._start_t"/> -->  
 <!--             <cfield name="_product_tax_data._end_t"/> -->  
 <!--           </between> -->  
           <!-- or is it the current one? -->  
 <!--           <and> -->  
 <!--             <ge> -->  
 <!--               <cparam name="invoiceDate"/> -->  
 <!--               <cfield name="_product_tax_data._start_t"/> -->  
 <!--             </ge> -->  
 <!--             <null> -->  
 <!--               <cfield name="_product_tax_data._end_t"/> -->  
 <!--             </null> -->  
 <!--           </and> -->  
 <!--         </or> -->  
         <!-- solamente 'IVA' (id 1) -->  
         <eq>  
           <cfield name="_product_tax_data.tax"/>  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource name="productDataSource" database="papo" table="_product_data"  
     order_by="canonical_name">  
     <condition>  
       <null>  
         <cfield name="_product_data._end_t"/>  
       </null>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="resultAlienDocumentDataSource" table="alien_document"  
     order_by="date">  
     <condition>  
       <or>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="2"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="10"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="11"/>  
         </eq>  
       </or>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienDocumentDataSource" table="alien_document"  
     order_by="date">  
     <condition>  
       <or>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="2"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="10"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="11"/>  
         </eq>  
       </or>  
     </condition>  
   </datasource>  
   
   <datasource name="alienOtherTaxDataSource" database="papo"  
     detaillink="alien_document_tax.alien_document" master="alienDocumentDataSource"  
     masterlink="id" table="alien_document_tax">  
     <condition>  
       <eq>  
         <cfield name="alien_document_tax.tax"/>  
         <cconst value="3"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource name="alienIvaTaxDataSource" database="papo"  
     detaillink="alien_document_tax.alien_document" master="alienDocumentDataSource"  
     masterlink="id" table="alien_document_tax">  
     <condition>  
       <eq>  
         <cfield name="alien_document_tax.tax"/>  
         <cconst value="1"/>  
       </eq>  
     </condition>  
   </datasource>  
   
 <!--   <datasource database="papo" name="alienDocumentShowDataSource" -->  
 <!--     table="alien_document, _entity_data as provider, _entity_data as transport" -->  
 <!--     order_by="date"> -->  
 <!--     <condition> -->  
 <!--       <and> -->  
 <!--         <eq> -->  
 <!--            <cfield name="alien_document.sender"/> -->  
 <!--            <cfield name="provider.id"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--            <cfield name="alien_document.transport"/> -->  
 <!--            <cfield name="transport.id"/> -->  
 <!--         </eq> -->  
 <!--         <or> -->  
 <!--           <eq> -->  
 <!--             <cfield name="alien_document.alien_document_type"/> -->  
 <!--             <cconst value="2"/> -->  
 <!--         </eq> -->  
 <!--           <eq> -->  
 <!--             <cfield name="alien_document.alien_document_type"/> -->  
 <!--           <cconst value="10"/> -->  
 <!--           </eq> -->  
 <!--           <eq> -->  
 <!--             <cfield name="alien_document.alien_document_type"/> -->  
 <!--           <cconst value="11"/> -->  
 <!--           </eq> -->  
 <!--         </or> -->  
 <!--       </and> -->  
 <!--     </condition> -->  
 <!--   </datasource> -->  
   
   <datasource database="papo" name="alienDocumentShowDataSource"  
     table="alien_document"  
     order_by="date">  
     <condition>  
       <or>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="2"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="10"/>  
         </eq>  
         <eq>  
           <cfield name="alien_document.alien_document_type"/>  
           <cconst value="11"/>  
         </eq>  
       </or>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienDocumentTaxShowDataSource"  
     table="alien_document_tax"/>  
   
   <datasource database="papo" name="alienDocumentIvaShowDataSource"  
     detaillink="alien_document_tax.alien_document" master="alienDocumentShowDataSource"  
     masterlink="id" table="alien_document_tax">  
     <condition>  
       <eq>  
         <cfield name="alien_document_tax.tax"/>  
         <cconst value="1"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource name="alienOtherTaxShowDataSource" database="papo"  
     detaillink="alien_document_tax.alien_document" master="alienDocumentShowDataSource"  
     masterlink="id" table="alien_document_tax">  
     <condition>  
       <eq>  
         <cfield name="alien_document_tax.tax"/>  
         <cconst value="3"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienDocumentProviderShowDataSource"  
     table="alien_document, _entity_data as provider" detaillink="alien_document.id"  
     master="alienDocumentShowDataSource" masterlink="id"  
     order_by="date">  
     <condition>  
       <eq>  
         <cfield name="alien_document.sender"/>  
         <cfield name="provider.id"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienDocumentTransportShowDataSource"  
     table="alien_document, _entity_data as transport" detaillink="alien_document.id"  
     master="alienDocumentShowDataSource" masterlink="id"  
     order_by="date">  
     <condition>  
       <eq>  
         <cfield name="alien_document.transport"/>  
         <cfield name="transport.id"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   
   <datasource database="papo" detaillink="alien_item.alien_document"  
     master="alienDocumentDataSource" masterlink="id" name="alienItemDataSource"  
     table="alien_item, alien_product_item, alien_item_tax">  
     <condition>  
       <and>  
         <eq>  
           <cfield name="alien_item.id"/>  
           <cfield name="alien_product_item.alien_item"/>  
         </eq>  
         <eq>  
            <cfield name="alien_item.id"/>  
            <cfield name="alien_item_tax.alien_item"/>  
         </eq>  
         <eq>  
            <cfield name="alien_item_tax.tax"/>  
            <cconst value="1"/>  
          </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienItemShowDataSource"  
     table="alien_item, alien_product_item">  
     <condition>  
       <eq>  
         <cfield name="alien_item.id"/>  
         <cfield name="alien_product_item.alien_item"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienItemDeleteDataSource"  
     table="alien_item, alien_product_item">  
     <condition>  
       <eq>  
         <cfield name="alien_item.id"/>  
         <cfield name="alien_product_item.alien_item"/>  
       </eq>  
     </condition>  
   </datasource>  
   
   <datasource database="papo" name="alienItemTaxShowDataSource"  
     table="alien_item_tax">  
   </datasource>  
   
 <!-- stock -->  
 <!--  <datasource database="papo" name="alienItemDataSourceToUpd" -->  
 <!--     table="alien_item, alien_product_item, _product_data, _product_store_data"> -->  
 <!--     <condition> -->  
 <!--       <and> -->  
 <!--         <eq> -->  
 <!--           <cfield name="alien_item.id"/> -->  
 <!--           <cfield name="alien_product_item.alien_item"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="alien_product_item.product"/> -->  
 <!--           <cfield name="_product_data.id"/> -->  
 <!--         </eq> -->  
 <!--         <eq> -->  
 <!--           <cfield name="_product_data._table"/> -->  
 <!--           <cfield name="_product_store_data.product"/> -->  
 <!--         </eq> -->  
 <!--         <null> -->  
 <!--           <cfield name="_product_store_data._end_t"/> -->  
 <!--         </null> -->  
 <!--       </and> -->  
 <!--     </condition> -->  
 <!--   </datasource> -->  
   
   <datasource name="lookUpTaxDataSource" database="papo"  
     table="product,_product_data,product_tax,_product_tax_data,tax,_tax_data">  
     <condition>  
       <and>  
         <!-- unify historic -->  
         <eq>  
           <cfield name="product.id"/>  
           <cfield name="_product_data._table"/>  
         </eq>  
         <null>  
           <cfield name="_product_data._end_t"/>  
         </null>  
         <eq>  
           <cfield name="product_tax.id"/>  
           <cfield name="_product_tax_data._table"/>  
         </eq>  
         <null>  
           <cfield name="_product_tax_data._end_t"/>  
         </null>  
         <eq>  
           <cfield name="tax.id"/>  
           <cfield name="_tax_data._table"/>  
         </eq>  
         <null>  
           <cfield name="_tax_data._end_t"/>  
         </null>  
         <!-- do the join-man -->  
         <eq>  
           <cfield name="_product_tax_data.product"/>  
           <cfield name="product.id"/>  
         </eq>  
         <eq>  
           <cfield name="_product_tax_data.tax"/>  
           <cfield name="tax.id"/>  
         </eq>  
         <!-- filter out the wanted ones -->  
         <eq>  
           <cfield name="tax.id"/>  
           <!-- IVA -->  
           <cconst value="1"/>  
         </eq>  
       </and>  
     </condition>  
   </datasource>  
   
   <trigger name="startUp" type="On-Startup">  
   tmpValuesDataSource.discountPercent = 0  
     
   ownOrganizationBlock.clear()  
   ownOrganizationBlock.initQuery()  
   ownOrganizationBlock.processQuery()  
   tmpValuesDataSource.ownIVACond =  str(ownOrganizationBlock.condIVAEntry)  
   print "ownIVACond",tmpValuesDataSource.ownIVACond  
   #cargo el own-pos entity id  
   callTrigger('searchOwnPosData')  
   #/cargo el own-pos entity id  
   </trigger>  
   
   <trigger name="setNumber" type="NAMED"><![CDATA[  
     changed = 0  
     if alienDocumentBlock.prefNumberEntry and len(str(alienDocumentBlock.prefNumberEntry).strip()):  
       alienDocumentBlock.prefNumberEntry = str(alienDocumentBlock.prefNumberEntry).strip().rjust(4).replace(' ','0')  
       changed = 1  
     if alienDocumentBlock.sufNumberEntry and len(str(alienDocumentBlock.sufNumberEntry).strip()):  
       alienDocumentBlock.sufNumberEntry = str(alienDocumentBlock.sufNumberEntry).strip().rjust(8).replace(' ','0')  
       changed = 1  
     if changed:  
       alienDocumentBlock.numberEntry = str(alienDocumentBlock.prefNumberEntry)+"-"+str(alienDocumentBlock.sufNumberEntry)  
   ]]></trigger>  
   
   <trigger name="setSearchNumber" type="NAMED"><![CDATA[  
     changed = 0  
     if alienDocumentSearchBlock.prefNumberEntry and len(str(alienDocumentSearchBlock.prefNumberEntry).strip()):  
       alienDocumentSearchBlock.prefNumberEntry = str(alienDocumentSearchBlock.prefNumberEntry).strip().rjust(4).replace(' ','0')  
       changed = 1  
     if alienDocumentSearchBlock.sufNumberEntry and len(str(alienDocumentSearchBlock.sufNumberEntry).strip()):  
       alienDocumentSearchBlock.sufNumberEntry = str(alienDocumentSearchBlock.sufNumberEntry).strip().rjust(8).replace(' ','0')  
       changed = 1  
     if changed:  
       alienDocumentSearchBlock.numberSEntry = str(alienDocumentSearchBlock.prefNumberEntry)+"-"+str(alienDocumentSearchBlock.sufNumberEntry)  
   ]]></trigger>  
   
   <trigger name="setInvoiceType" type="NAMED"><![CDATA[  
     invoiceType = str(alienDocumentBlock.invoiceTypeEntry).strip().lower()  
     if invoiceType == 'a':  
       alienDocumentBlock.typeEntry = '2'  
     elif invoiceType == 'b':  
       alienDocumentBlock.typeEntry = '10'  
     elif invoiceType == 'c':  
       alienDocumentBlock.typeEntry = '11'  
     else:  
       alienDocumentBlock.typeEntry = ''  
   ]]></trigger>  
   
   <trigger name="invoiceTypeValidation" type="NAMED"><![CDATA[  
     if str(alienDocumentBlock.invoiceTypeEntry).strip().lower() not in ('a','b','c'):  
       genericBox('El tipo de factura es incorrecto',['Aceptar'])  
       alienDocumentBlock.invoiceTypeEntry = ""  
     else:  
       alienDocumentBlock.invoiceTypeEntry = str(alienDocumentBlock.invoiceTypeEntry).strip().upper()  
     callTrigger('setInvoiceType')  
   ]]></trigger>  
   
   <trigger name="startWaitingModeTrigger" type="NAMED"><![CDATA[  
     setStatusText("Procesando ...")  
     try:  
       # gnue version <= 0.4  
       from gnue.forms.GFEvent import GFEvent  
     except ImportError:  
       # gnue version >= 0.5  
       from gnue.common.events.Event import Event as GFEvent  
   
     # busy clock  
     self._object.dispatchEvent(GFEvent('beginWAIT'))  
   ]]></trigger>  
   
   <trigger name="endWaitingModeTrigger" type="NAMED"><![CDATA[  
     try:  
       # gnue version <= 0.4  
       from gnue.forms.GFEvent import GFEvent  
     except ImportError:  
       # gnue version >= 0.5  
       from gnue.common.events.Event import Event as GFEvent  
   
     self._object.dispatchEvent(GFEvent('endWAIT'))  
     setStatusText("Listo")  
   ]]></trigger>  
   
   <trigger name="toDayTrigger" type="NAMED">  
     alienDocumentBlock.dateEntry = alienDocumentDataSource.getTimeStamp()  
   </trigger>  
   
   <trigger name="commitTrigger" type="NAMED">  
     if not alienDocumentBlock.getCurrentRecord().isInserted():  
       genericBox("No se puede grabar modificaciones",["Aceptar"])  
     elif not str(alienDocumentBlock.numberEntry):  
       genericBox("Falta el número de la factura",["Aceptar"])  
     elif not str(alienDocumentBlock.dateEntry):  
       genericBox("Falta la fecha de la factura",["Aceptar"])  
     elif not str(alienDocumentBlock.invoiceTypeEntry):  
       genericBox("Falta el tipo de factura",["Aceptar"])  
     else:  
       from gnue.common.GDataObjects import ConnectionError as DBError  
       try:  
         import hack  
   
         alienIvaTaxBlock.alienIvaTaxAmountEntry = hack.a2f(alienDocumentBlock.ivaTotalEntry,2)  
         alienIvaTaxBlock.alienIvaTaxedAmountEntry = hack.a2f(alienDocumentBlock.netTotalEntry,2)  
   
         postChangeAdvance = 0  
         alienDocumentBlock.ownEntityIdEntry  = str(ownPosBlock.ownPosEntityIdEntry)  
         alienDocumentBlock.postChanges()  
   
         postChangeAdvance = 1  
         proceedingBlock.clear()  
         proceedingBlock.dateEntry = proceedingDataSource.getTimeStamp()  
         proceedingBlock.postChanges()  
   
         postChangeAdvance = 2  
         #cargo el own-pos entity id  
         alienDocumentProceedingBlock.clear()  
         alienDocumentProceedingBlock.proceedingEntry = str(proceedingBlock.idEntry)  
         alienDocumentProceedingBlock.alienDocumentEntry = str(alienDocumentBlock.idEntry)  
         alienDocumentProceedingBlock.amountEntry = str(payBlock.cashEntry)  
         alienDocumentProceedingBlock.postChanges()  
   
         postChangeAdvance = 3  
         rc = currencyMovementBlock.getRecordCount()  
         for recNum in range(rc):  
             currencyMovementBlock.jumpRecord(recNum)  
             currencyMovementBlock.proceedingEntry = str(proceedingBlock.idEntry)  
             currencyMovementBlock.movementTypeEntry = "" # Revisar com queda esto  
         currencyMovementBlock.postChanges()  
   
         postChangeAdvance = 4  
   
         tmpValuesDataSource.idEntry = str(alienDocumentBlock.idEntry)  
         callTrigger('stockAddTrigger')  
           
   
         commitConnection()  
         callTrigger('rollbackTrigger')  
       except DBError, err:  
         rollbackConnection()  
         message = "Hay problemas para grabar "  
         if postChangeAdvance == 0:  
           message += "la Factura"  
         elif postChangeAdvance == 1:  
           message += "el procedimiento General"  
         elif postChangeAdvance == 2:  
           message += "el procedimiento de la Factura"  
         elif postChangeAdvance == 3:  
           message += "las monedas de pago de la Factura"  
         elif postChangeAdvance == 4:  
           message += "el stock"  
         genericBox(message+"\n"+str(err),['Aceptar'])  
       #else:  
       #  alienDocumentBlock.clear()  
     tmpValuesDataSource.discountPercent = 0  
   </trigger>  
   
   <trigger name="rollbackTrigger" type="NAMED">  
   clear()  
   callTrigger('searchOwnPosData')  
   #alienDocumentBlock.newRecord()  
   
   tmpValuesDataSource.discountPercent = 0  
   </trigger>  
   
   <trigger name="deleteTrigger" type="NAMED">  
   if genericBox("¿ Está seguro que desea borrar ?",['Sí','No']) == 1:  
     from gnue.common.GDataObjects import ConnectionError as DBError  
     try:  
         lAlienDocId = str(alienDocumentShowBlock.idEntry)  
         alienDocumentProceedingShowBlock.initQuery()  
         alienDocumentProceedingShowBlock.alienDocumentEntry = lAlienDocId  
         alienDocumentProceedingShowBlock.processQuery()  
         proceedingId = str(alienDocumentProceedingShowBlock.proceedingEntry)  
         alienDocumentProceedingShowBlock.deleteRecord()  
         postChangeAdvance = 0  
         alienDocumentProceedingShowBlock.postChanges()  
     
         currencyMovementBlock.proceedingEntry = proceedingId  
         currencyMovementBlock.processQuery()  
         postChangeAdvance = 1  
         rc = currencyMovementBlock.getRecordCount()  
         for recNum in range(rc):  
             currencyMovementBlock.jumpRecord(recNum)  
             currencyMovementBlock.deleteRecord()  
         currencyMovementBlock.postChanges()  
     
         tmpValuesDataSource.idEntry = str(alienDocumentShowBlock.idEntry)  
         callTrigger('stockSubstractTrigger')  
     
     
         lRecordCount = alienItemShowBlock.getRecordCount()  
         for recNum in range(lRecordCount):  
             alienItemShowBlock.jumpRecord(recNum)  
             alienItemTaxShowBlock.initQuery()  
             alienItemTaxShowBlock.alienItemEntry = str(alienItemShowBlock.idEntry)  
             alienItemTaxShowBlock.processQuery()  
             lTaxRecordCount = alienItemTaxShowBlock.getRecordCount()  
             for taxRecNum in range(lTaxRecordCount):  
               alienItemTaxShowBlock.jumpRecord(taxRecNum)  
               alienItemTaxShowBlock.deleteRecord()  
               alienItemTaxShowBlock.postChanges()  
             alienItemDeleteBlock.initQuery()  
             alienItemDeleteBlock.idEntry = str(alienItemShowBlock.idEntry)  
             alienItemDeleteBlock.processQuery()  
             alienItemDeleteBlock.deleteRecord()  
             alienItemDeleteBlock.postChanges()  
     
         alienItemShowBlock.clear()  
     
         postChangeAdvance = 4  
     
         alienDocumentTaxShowBlock.initQuery()  
         alienDocumentTaxShowBlock.alienDocumentEntry = tmpValuesDataSource.idEntry+"%"  
         alienDocumentTaxShowBlock.processQuery()  
           
         lRecordCount = alienDocumentTaxShowBlock.getRecordCount()  
         for recNum in range(lRecordCount):  
           alienDocumentTaxShowBlock.jumpRecord(recNum)  
           alienDocumentTaxShowBlock.deleteRecord()  
         alienDocumentTaxShowBlock.postChanges()  
     
         postChangeAdvance = 5  
         alienDocumentShowBlock.deleteRecord()  
         alienDocumentShowBlock.postChanges()  
     
         commitConnection()  
     except DBError, err:  
         rollbackConnection()  
         callTrigger('rollbackTrigger')  
         message = ["el procedimiento de la Factura", "Los Montos de la factura",  
                    "el stock","los Items de la Factura","los impuestos de la Factura","la Factura"]  
         genericBox("Hay problemas para borrar "+message[postChangeAdvance]+"\n"+str(err),['Aceptar'])  
     
     
     totalShowBlock.clear()  
   </trigger>  
   
   <trigger name="quitTrigger" type="NAMED">  
     alienDocumentBlock.clear()  
     self.exit()  
   </trigger>  
   
  <trigger name="bringInvoiceTypeShowTrigger" type="NAMED">  
  if resultBlock.getRecordCount() > 0 and not resultBlock.getCurrentRecord().isEmpty() and str(alienDocumentShowBlock.typeEntry):  
    typeInvoice = int(str(alienDocumentShowBlock.typeEntry))  
    result = ""  
    if typeInvoice == 2:  
      result = "A"  
    elif typeInvoice == 10:  
      result = "B"  
    elif typeInvoice == 11:  
      result = "C"  
    alienDocumentShowBlock.invoiceTypeEntry = result  
   
  </trigger>  
   
   <trigger name="totalCalcShowTrigger" type="NAMED">  
    if resultBlock.getRecordCount() > 0 and not resultBlock.getCurrentRecord().isEmpty():  
      import hack  
   
      #recordCount = alienItemShowBlock.getRecordCount()  
      #alienItemShowBlock.firstRecord()  
      #for index in range(recordCount):  
      #  alienItemShowBlock.jumpRecord(index)  
      #  try:  
      #    alienItemShowBlock.taxPercentEntry = hack.a2f(alienItemShowBlock.taxAmountEntry,2) / \  
      #                                         hack.a2f(alienItemShowBlock.unitPriceEntry,2) / \  
      #                                         hack.a2f(alienItemShowBlock.qtyEntry,2) * 100  
      #  except:  
      #    pass  
      #  
      #alienItemShowBlock.firstRecord()  
   
      totalShowBlock.totalEntry = hack.a2f(totalShowBlock.netoEntry,2) + \  
                                  hack.a2f(ivaTotalShowBlock.ivaEntry,2)+hack.a2f(otherTaxShowBlock.otherTaxAmountEntry,2)  
    else:  
      totalShowBlock.clear()  
   </trigger>  
   
   <trigger name="discountCalcTrigger" type="NAMED"><![CDATA[  
     import hack  
       
     if hack.a2f(str(alienDocumentBlock.discountPercentEntry),4) != round(tmpValuesDataSource.discountPercent,4):  
       callTrigger('totalCalcTrigger')  
   
     tmpValuesDataSource.discountPercent = hack.a2f(str(alienDocumentBlock.discountPercentEntry),2)  
   ]]></trigger>  
   
   <trigger name="totalCalcTrigger" type="NAMED">  
     import hack  
   
     lQty = hack.a2f(alienItemBlock.qtyEntry,4)  
     lBonus = hack.a2f(alienItemBlock.bonusEntry,4)  
     lDiscount = hack.a2f(alienItemBlock.discountEntry,4)  
     lUnitPrice = hack.a2f(alienItemBlock.unitPriceEntry,4)  
   
     lItemPrice = round(((lQty * lUnitPrice) - lBonus - lDiscount) * (1 - hack.a2f(alienDocumentBlock.discountPercentEntry,4)/100),2)  
   
     alienItemBlock.itemNetoEntry = lItemPrice  
     alienItemBlock.taxAmountEntry = round((lItemPrice * hack.a2f(alienItemBlock.taxPercentEntry,2)/100),2)  
     alienItemBlock.itemTotalEntry = round(lItemPrice + hack.a2f(alienItemBlock.taxAmountEntry,2),2)  
   
     lTNeto = 0  
     lTTax = 0  
   
     sum = 0  
     lRecords = alienItemDataSource.getRecords()  
     for index in range(len(lRecords)):  
       lRecord = lRecords[index]  
       lQty = hack.a2f(lRecord.getField("alien_product_item.qty"),4)  
       lBonus = hack.a2f(lRecord.getField("alien_item.bonus"),4)  
       lDiscount = hack.a2f(lRecord.getField("alien_item.discount"),4)  
       lUnitPrice = hack.a2f(lRecord.getField("alien_product_item.unit_price"),4)  
       #lTax = hack.a2f(lRecord.getField("alien_item_tax.amount"))  
   
       lItemPrice = round(((lQty * lUnitPrice) - lBonus - lDiscount) * \  
                          (1 - hack.a2f(alienDocumentBlock.discountPercentEntry,4)/100),2)  
   
       alienItemBlock.jumpRecord(index)  
       alienItemBlock.itemNetoEntry = lItemPrice  
       alienItemBlock.taxAmountEntry = round((lItemPrice * hack.a2f(alienItemBlock.taxPercentEntry,4)/100),2)  
       alienItemBlock.itemTotalEntry = round(lItemPrice + hack.a2f(alienItemBlock.taxAmountEntry,2),2)  
   
       lTTax += hack.a2f(lRecord.getField("alien_item_tax.amount"),2)  
       lTNeto += round(lItemPrice,2)  
   
       #sum += lQty * lUnitPrice + lTax - lBonus - lDiscount  
   
     alienDocumentBlock.netTotalEntry = round(lTNeto,2)  
     alienDocumentBlock.ivaTotalEntry = lTTax  
     alienDocumentBlock.taxTotalEntry = lTTax+hack.a2f(otherTaxBlock.otherTaxAmountEntry,2)  
     alienDocumentBlock.totalEntry = round(lTNeto+lTTax+hack.a2f(otherTaxBlock.otherTaxAmountEntry,2),2)  
     payBlock.cashEntry = hack.a2f(alienDocumentBlock.totalEntry,2)  
   
     #totalBlock.totalEntry = str(sum)  
     #payBlock.cashEntry = str(sum)  
     payBlock.ctaCteEntry = "0.00"  
   </trigger>  
   
   <trigger name="newSearchTrigger" type="NAMED">  
     alienDocumentSearchBlock.clear()  
   </trigger>  
   
   <trigger name="searchTrigger" type="NAMED">  
     resultBlock.clear()  
     resultBlock.initQuery()  
     #resultBlock.typeREntry = "2"  
     resultBlock.providerREntry = str(alienDocumentSearchBlock.providerSEntry)  
     resultBlock.transportREntry = str(alienDocumentSearchBlock.transportSEntry)  
     resultBlock.salesPersonREntry = str(alienDocumentSearchBlock.salesPersonSEntry)  
     resultBlock.receivedREntry = str(alienDocumentSearchBlock.receivedSEntry)  
     resultBlock.numberREntry = str(alienDocumentSearchBlock.numberSEntry)+"%"  
     resultBlock.dateREntry = str(alienDocumentSearchBlock.dateSEntry)  
     resultBlock.guideNumerREntry = str(alienDocumentSearchBlock.guideNumerSEntry)  
     resultBlock.bundlesREntry = str(alienDocumentSearchBlock.bundlesSEntry)  
   
     resultBlock.processQuery()  
   </trigger>  
   
   <trigger name="notImplementedSearchTrigger" type="NAMED">  
     genericBox("No implementado",["Aceptar"])  
   </trigger>  
   
   <trigger name="providerSearchPage1Trigger" type="NAMED">  
     currentSearchIdBlock.searchId = "1"  
     callTrigger('providerSearchTrigger')  
   </trigger>  
   
   <trigger name="providerSearchPage2Trigger" type="NAMED">  
     currentSearchIdBlock.searchId = "2"  
     callTrigger('providerSearchTrigger')  
   </trigger>  
   
   <trigger name="providerSearchTrigger" type="NAMED">  
       if str(currentSearchIdBlock.searchId) == "1":  
         codeToSearch = str(alienDocumentSearchBlock.providerCodeSEntry)  
         nameToSearch = str(alienDocumentSearchBlock.providerNameSEntry)  
       else:  
         codeToSearch = str(alienDocumentBlock.providerCodeSEntry)  
         nameToSearch = str(alienDocumentBlock.providerNameSEntry)  
   
       callTrigger('startWaitingModeTrigger')  
       providerResultBlock.reset()  
       providerResultBlock.initQuery()  
       if codeToSearch:  
         providerResultBlock.providerCodeEntry = codeToSearch+"%"  
       if nameToSearch:  
         providerResultBlock.providerNameEntry = nameToSearch+"%"  
       providerResultBlock.processQuery()  
       callTrigger('endWaitingModeTrigger')  
   
       recordCount = providerResultBlock.getRecordCount()  
       if recordCount > 1:  
         def callback (returnValue):  
           global block  
           if returnValue >= 0:  
             providerResultBlock.jumpRecord(returnValue)  
             callTrigger('afterProviderSearchTrigger')  
   
         runForm ('providerSelect.gfd', {'data': providerResultBlock, 'callback': callback})  
       elif recordCount == 1:  
         providerResultBlock.jumpRecord(0)  
         callTrigger('afterProviderSearchTrigger')  
   
   </trigger>  
   
   <trigger name="afterProviderSearchTrigger" type="NAMED">  
     if str(currentSearchIdBlock.searchId) == "1":  
       alienDocumentSearchBlock.providerCodeSEntry = str(providerResultBlock.providerCodeEntry)  
       alienDocumentSearchBlock.providerNameSEntry = str(providerResultBlock.providerNameEntry)  
       alienDocumentSearchBlock.providerSEntry = str(providerResultBlock.idEntry)  
     else:  
       import hack  
   
       alienDocumentBlock.providerCodeSEntry = str(providerResultBlock.providerCodeEntry)  
       alienDocumentBlock.providerNameSEntry = str(providerResultBlock.providerNameEntry)  
       alienDocumentBlock.providerEntry = str(providerResultBlock.idEntry)  
       clientIvaTaxProfile = int(str(tmpValuesDataSource.ownIVACond))  
       print "client IVA ",clientIvaTaxProfile  
       providerIvaTaxProfile = int(str(providerResultBlock.providerIvaTaxProfileEntry))  
       print "providerIvaTaxProfile", providerIvaTaxProfile  
       alienDocumentBlock.invoiceTypeEntry = hack.calcInvoiceType(clientIvaTaxProfile, providerIvaTaxProfile)  
       callTrigger('invoiceTypeValidation')  
   </trigger>  
   
   <trigger name="transportSearchPage1Trigger" type="NAMED">  
     currentSearchIdBlock.searchId = "1"  
     callTrigger('transportSearchTrigger')  
   </trigger>  
   
   <trigger name="transportSearchPage2Trigger" type="NAMED">  
     currentSearchIdBlock.searchId = "2"  
     callTrigger('transportSearchTrigger')  
   </trigger>  
   
   <trigger name="transportSearchTrigger" type="NAMED">  
       if str(currentSearchIdBlock.searchId) == "1":  
         codeToSearch = str(alienDocumentSearchBlock.transportCodeSEntry)  
         nameToSearch = str(alienDocumentSearchBlock.transportNameSEntry)  
       else:  
         codeToSearch = str(alienDocumentBlock.transportCodeSEntry)  
         nameToSearch = str(alienDocumentBlock.transportNameSEntry)  
   
       callTrigger('startWaitingModeTrigger')  
       transportResultBlock.initQuery()  
       transportResultBlock.transportCodeEntry = codeToSearch+"%"  
       transportResultBlock.transportNameEntry = nameToSearch+"%"  
       transportResultBlock.processQuery()  
       callTrigger('endWaitingModeTrigger')  
   
       recordCount = transportResultBlock.getRecordCount()  
       if recordCount > 1:  
         def callback (returnValue):  
           global block  
           if returnValue >= 0:  
             transportResultBlock.jumpRecord(returnValue)  
             callTrigger('afterTransportSearchTrigger')  
   
         runForm ('transportSelect.gfd', {'data': transportResultBlock, 'callback': callback})  
       elif recordCount == 1:  
         transportResultBlock.jumpRecord(0)  
         callTrigger('afterTransportSearchTrigger')  
   </trigger>  
   
   <trigger name="afterTransportSearchTrigger" type="NAMED">  
     if str(currentSearchIdBlock.searchId) == "1":  
       alienDocumentSearchBlock.transportCodeSEntry = str(transportResultBlock.transportCodeEntry)  
       alienDocumentSearchBlock.transportNameSEntry = str(transportResultBlock.transportNameEntry)  
       alienDocumentSearchBlock.transportEntry = str(transportResultBlock.idEntry)  
     else:  
       alienDocumentBlock.transportCodeSEntry = str(transportResultBlock.transportCodeEntry)  
       alienDocumentBlock.transportNameSEntry = str(transportResultBlock.transportNameEntry)  
       alienDocumentBlock.transportEntry = str(transportResultBlock.idEntry)  
   </trigger>  
   
   <trigger name="productSearchTrigger" type="NAMED">  
       codeToSearch = str(alienItemBlock.productCodeEntry)  
       nameToSearch = str(alienItemBlock.productNameEntry)  
   
       callTrigger('startWaitingModeTrigger')  
       productResultBlock.initQuery()  
       productResultBlock.prodCodeEntry = codeToSearch+"%"  
       productResultBlock.prodNameEntry = nameToSearch+"%"  
       productResultBlock.processQuery()  
       callTrigger('endWaitingModeTrigger')  
   
       recordCount = productResultBlock.getRecordCount()  
       if recordCount > 1:  
         def callback (returnValue):  
           global block  
           if returnValue >= 0:  
             productResultBlock.jumpRecord(returnValue)  
             callTrigger('afterProductSearchTrigger')  
   
         runForm ('productSelect.gfd', {'data': productResultBlock, 'callback': callback})  
       elif recordCount == 1:  
         productResultBlock.jumpRecord(0)  
         callTrigger('afterProductSearchTrigger')  
   </trigger>  
   
   <trigger name="afterProductSearchTrigger" type="NAMED">  
     alienItemBlock.productCodeEntry = str(productResultBlock.prodCodeEntry)  
     alienItemBlock.productNameEntry = str(productResultBlock.prodNameEntry)  
     alienItemBlock.productEntry = str(productResultBlock.prodIdEntry)  
     alienItemBlock.taxPercentEntry = str(productResultBlock.prodIVATaxEntry)  
   </trigger>  
   
   <trigger name="productDeleteTrigger" type="NAMED">  
     alienItemBlock.productCodeEntry = ""  
     alienItemBlock.productNameEntry = ""  
     alienItemBlock.qtyEntry = 0.00  
     alienItemBlock.unitPriceEntry = 0.00  
     alienItemBlock.productEntry = "0"  
     alienItemBlock.taxAmountEntry = 0  
     alienItemBlock.taxPercentEntry = 0  
     alienItemBlock.discountEntry = 0.00  
     alienItemBlock.itemTotalEntry = 0.00  
   
     callTrigger('totalCalcTrigger')  
   </trigger>  
   
   <trigger name="resultFocusOutTrigger" type="NAMED">  
    import hack  
    alienDocumentShowBlock.clear()  
    if resultBlock.getRecordCount() > 0 and not resultBlock.getCurrentRecord().isEmpty():  
      alienDocumentShowBlock.initQuery()  
      alienDocumentShowBlock.idEntry = ("%s" % resultBlock.idREntry)  
      alienDocumentShowBlock.processQuery()  
   
      alienItemShowBlock.initQuery()  
      alienItemShowBlock.alienDocumentEntry = ("%s" % alienDocumentShowBlock.idEntry)  
      alienItemShowBlock.processQuery()  
   
      recordCount = alienItemShowBlock.getRecordCount()  
      alienItemShowBlock.firstRecord()  
      setParameter('invoiceDate',str(alienDocumentShowBlock.dateEntry))  
   
   </trigger>  
   
   <trigger name="providerTrigger" type="NAMED">  
    runForm('provider.gfd')  
   </trigger>  
   
   <trigger name="productTrigger" type="NAMED">  
    runForm('product.gfd')  
   </trigger>  
   
   <trigger name="lookUpTax" type="NAMED"><![CDATA[  
     from hack import search  
   
     # do the bartman  
     search (lookUpTaxBlock, lookUpTaxBlock.searchThisProductEntry, alienItemBlock.productEntry)  
     alienItemBlock.taxPercentEntry= lookUpTaxBlock.foundTaxEntry  
     # back to normal broadcasting  
     callTrigger ('totalCalcTrigger')  
   ]]></trigger>  
   
   <trigger name="totalChanged" type="NAMED">  
    import hack  
   
    alienDocumentBlock.taxTotalEntry = hack.a2f(otherTaxBlock.otherTaxAmountEntry,2)+hack.a2f(alienDocumentBlock.ivaTotalEntry,2)  
     
    alienDocumentBlock.totalEntry = hack.a2f(alienDocumentBlock.netTotalEntry,2) + \  
                                    hack.a2f(alienDocumentBlock.taxTotalEntry,2)  
    payBlock.cashEntry = str(hack.a2f(alienDocumentBlock.totalEntry,2))  
    payBlock.ctaCteEntry = 0.00  
   </trigger>  
   
   <trigger name="providerMultiCurrencyTrigger" type="NAMED">  
   import hack  
     
   if hack.a2f(payBlock.cashEntry,2) != 0.0:  
     tmpAmountBlock.cashAmountEntry = hack.a2f(payBlock.cashEntry,2)  
     tmpAmountBlock.ctaCteAmountEntry = hack.a2f(payBlock.ctaCteEntry,2)  
     currencyMovementBlock.clear()  
     
     def callback (returnValue):  
       if str(returnValue) == '1':  
         callTrigger('commitTrigger')  
     runForm ('providerMultiCurrency.gfd', {'currency': currencyMovementBlock, 'amount': tmpAmountBlock, 'callback': callback})  
   else:  
     callTrigger('commitTrigger')  
   
   </trigger>  
   
   <page name="Búsqueda de Facturas de Proveedor">  
 <!--   <trigger type="Pre-Focusout" src="resultFocusOutTrigger"/> -->  
     <box height="12" label="Factura de Productos de Proveedor"  
       name="invoiceSearchBox" width="107" x="0" y="0">  
   
     <block datasource="tmpSearchDataSource" name="alienDocumentSearchBlock" restrictInsert="">  
   
         <entry field="alien_document_type" hidden="" name="typeEntry" x="1" y="1"/>  
   
         <label name="providerLbl" text="Proveedor" x="1" y="1" />  
         <entry x="1" y="2" name="providerCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="1" y="3" name="providerNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
        </entry>  
         <entry x="1" y="2" field="alien_document.sender" name="providerSEntry" width="25" hidden=""/>  
         <button x="36" y="3" trigger="providerSearchPage1Trigger" width="7" label="Buscar"  
           name="providerSearchPage1Btn" height="1"/>  
   
   
         <label name="transportLbl" text="Transporte" x="56" y="1" />  
         <entry x="56" y="2" name="transportCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="56" y="3" name="transportNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
        </entry>  
         <entry x="57" y="3" field="alien_document.transport" name="transportSEntry" width="25" hidden=""/>  
         <button x="91" y="3" trigger="transportSearchPage1Trigger" width="7" label="Buscar"  
           name="transportSearchPage1Btn" height="1"/>  
   
         <label name="salesPersonLbl" text="Vendedor" x="1" y="4" />  
         <entry x="1" y="5" name="salesPersonCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="1" y="6" name="salesPersonNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
        </entry>  
         <entry x="1" y="5" field="alien_document.salesperson" name="salesPersonSEntry" width="25" hidden=""/>  
         <button x="36" y="6" trigger="notImplementedSearchTrigger" width="7" label="Buscar"  
           name="searchBtn" height="1"/>  
 <!--         <button x="36" y="6" trigger="salesPersonSearchTrigger" width="7" label="Buscar" -->  
 <!--           name="searchBtn" height="1"/> -->  
   
         <label name="receivedLbl" text="Recibido por:" x="56" y="4" />  
         <entry x="56" y="5" name="receivedCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="56" y="6" name="receivedNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
        </entry>  
         <entry x="27" y="5" field="alien_document.received_by" name="receivedSEntry" width="25" hidden="" />  
         <button x="91" y="6" trigger="notImplementedSearchTrigger" width="7" label="Buscar"  
           name="searchBtn" height="1"/>  
 <!--         <button x="91" y="6" trigger="receivedSearchTrigger" width="7" label="Buscar" -->  
 <!--           name="searchBtn" height="1"/> -->  
   
         <label name="numberLbl" text="Número" x="1" y="8" />  
         <entry name="prefNumberEntry" width="5" max_length="4" x="1" y="9">  
           <trigger type="PRE-FOCUSOUT" src="setSearchNumber" />  
         </entry>  
         <entry name="sufNumberEntry" width="9" max_length="8" x="6" y="9">  
           <trigger type="PRE-FOCUSOUT" src="setSearchNumber" />  
         </entry>  
   
         <entry field="number" name="numberSEntry" width="20" x="1" y="9" hidden="t"/>  
         <label name="dateLbl" text="Fecha" x="22" y="8" />  
         <entry field="date" name="dateSEntry" typecast="date"  
           rows="1" width="22" x="22" y="9"/>  
         <label name="guideNumberLbl" text="Número de guía" x="45" y="8" />  
         <entry field="guide_number" name="guideNumerSEntry" width="20" x="45" y="9"/>  
         <label name="bundlesLbl" text="Bultos" x="66" y="8" />  
         <entry field="bundles" name="bundlesSEntry" width="10" x="66" y="9"/>  
   
         <button x="77" y="9" trigger="searchTrigger" width="10" label="Buscar"  
           name="searchBtn" height="1"/>  
         <button x="88" y="9" trigger="newSearchTrigger" width="10" label="Cancelar"  
           name="newSearchBtn" height="1"/>  
       </block>  
     </box>  
   
     <box height="14" label="Facturas encontradas" name="searchResultBox"  
       width="107" x="0" y="11">  
       <block datasource="resultAlienDocumentDataSource" name="resultBlock">  
   
         <entry field="id" hidden="" name="idREntry" x="1" y="1"/>  
   
         <entry field="alien_document_type" hidden="" name="typeREntry" x="1" y="1"/>  
   
         <entry x="1" y="1" field="sender" name="providerREntry"  
           width="25" hidden=""/>  
   
         <entry x="27" y="2" field="transport" name="transportREntry"  
           width="25" hidden=""/>  
   
         <entry x="1" y="4" field="salesperson" name="salesPersonREntry"  
           width="25" hidden=""/>  
   
         <entry x="27" y="4" field="received_by" name="receivedREntry"  
           width="25" hidden=""/>  
   
         <entry field="number" name="numberREntry" hidden="" width="20" x="1" y="7"/>  
   
         <entry field="date" name="dateREntry" typecast="date" hidden=""  
           width="22" x="22" y="7"/>  
   
         <entry field="guide_number" name="guideNumerREntry" width="20" x="45" y="7" hidden=""/>  
   
         <entry field="bundles" name="bundlesREntry" width="10" x="66" y="7" hidden="" />  
   
   
   
         <label name="resNumberLbl" text="Número" x="1" y="1" />  
         <entry field="number" name="resNumberEntry" width="20" x="1" y="2" rows="9"/>  
         <label name="resDateLbl" text="Fecha" x="22" y="1" />  
         <entry field="date" name="resDateEntry" typecast="date" width="22" x="22" y="2" rows="9"/>  
         <scrollbar page="5"  
           x="45" y="2" width="1" height="9"/>  
   
       </block>  
     </box>  
   </page>  
   
   <!--   Página de Consulta/borrado de facturas -->  
   <page name="Factura de Proveedor (Consulta/borrado)">  
     <trigger type="PRE-FOCUSIN" src="resultFocusOutTrigger" />  
     <trigger type="PRE-FOCUSIN" src="bringInvoiceTypeShowTrigger" />  
     <trigger type="PRE-FOCUSIN" src="totalCalcShowTrigger" />  
     <box height="12" label="Factura de Productos de Proveedor"  
       name="invoiceHeaderBox" width="107" x="0" y="0">  
   
     <!--     Estos bloques son para la gestion del pago de la factura -->  
     <block name="proceedingBlock" datasource="proceedingDataSource" transparentBlock="">  
         <entry name="idEntry" field="id" hidden="" x="1" y="1" width="12"/>  
         <entry name="dateEntry" field="date" hidden="" x="1" y="1" width="12"/>  
     </block>  
   
     <!-- Este bloque esta repetido, pero con otro nombre, porque para borrar debe hacer commit en este primero -->  
     <block name="alienDocumentProceedingShowBlock" datasource="alienDocumentProceedingShowDataSource" transparentBlock="">  
           <entry name="proceedingEntry" field="proceeding" hidden="" x="1" y="1" width="12"/>  
           <entry name="alienDocumentEntry" field="alien_document" hidden="" x="1" y="1" width="12"/>  
           <entry name="amountEntry" field="amount" hidden="" x="1" y="1" width="12"/>  
     </block>  
   
     <block datasource="alienDocumentShowDataSource" name="alienDocumentShowBlock" restrictInsert="t">  
   
         <entry field="alien_document.id" hidden="" name="idEntry" x="1" y="1"/>  
         <entry field="alien_document.alien_document_type" hidden="" name="typeEntry" x="1" y="1"/>  
     
         <entry x="1" y="2" field="alien_document.sender" name="providerEntry" width="25" hidden="" />  
   
         <entry x="27" y="2" field="alien_document.transport" name="transportEntry" width="25" hidden="" />  
   
         <label name="numberLbl" text="Número" x="1" y="8" />  
         <entry field="alien_document.number" name="numberEntry" width="20" x="1" y="9" style="label"/>  
   
         <label name="dateLbl" text="Fecha" x="22" y="8" />  
         <entry field="alien_document.date" name="dateEntry" typecast="date"  
           rows="1" width="22" x="22" y="9" style="label"/>  
   
         <label name="invoiceTypeLbl" text="Tipo" x="48" y="8" />  
         <entry name="invoiceTypeEntry" width="4" x="48" y="9" readonly="t" style="label"/>  
   
         <label name="guideNumberLbl" text="Número de guía" x="53" y="8" />  
         <entry field="alien_document.guide_number" name="guideNumerEntry" width="20" x="53" y="9" style="label"/>  
   
         <label name="bundlesLbl" text="Bultos" x="74" y="8" />  
         <entry field="alien_document.bundles" name="bundlesEntry" width="10" x="74" y="9" style="label"/>  
   
       </block>  
   
       <block datasource="alienDocumentProviderShowDataSource" name="alienDocumentProviderShowBlock" restrictInsert="t">  
         <label name="providerLbl" text="Proveedor" x="1" y="1" />  
         <entry x="1" y="2" field="provider._table" name="providerCodeSEntry" readonly=""  
            width="20" style="textlookup" foreign_key="providerUIDDataSource._entity_data._table"  
            foreign_key_description="_entity_uid_data.uid" >  
         </entry>  
         <entry x="1" y="3" field="provider._table" name="providerNameSEntry" readonly=""  
            width="35" style="textlookup" foreign_key="providerNameDataSource._table"  
            foreign_key_description="name" >  
        </entry>  
   
       </block>  
       <block name="alienDocumentTaxShowBlock" datasource="alienDocumentTaxShowDataSource" transparentBlock="">  
         <entry name="alienDocumentEntry" field="alien_document" hidden="" x="1" y="1" width="12"/>  
       </block>  
         
       <block datasource="alienDocumentTransportShowDataSource" name="alienDocumentTransportShowBlock" restrictInsert="t">  
         <label name="transportLbl" text="Transporte" x="56" y="1" />  
         <entry x="56" y="2" field="transport._table" name="transportCodeSEntry" readonly=""  
            width="20" style="textlookup" foreign_key="transportUIDDataSource._entity_data._table"  
            foreign_key_description="_entity_uid_data.uid" >  
         </entry>  
         <entry x="56" y="3" field="transport._table" name="transportNameSEntry" readonly=""  
            width="35" style="textlookup" foreign_key="transportNameDataSource._table"  
            foreign_key_description="name" >  
         </entry>  
       </block>  
     </box>  
 <!--     <box height="12" label="Productos a facturar" name="invoiceItemBox" -->  
 <!--       width="107" x="0" y="11"> -->  
           <!-- for looking up taxes -->  
 <!--       <block name="lookUpTaxBlock" datasource="lookUpTaxDataSource"> -->  
 <!--         <entry name="searchThisProductEntry" field="product.id" hidden="" -->  
 <!--           x="1" y="1"/> -->  
 <!--         <entry name="foundTaxEntry" field="_product_tax_data.amount" hidden="" -->  
 <!--           x="1" y="1"/> -->  
 <!--       </block> -->  
     <block datasource="alienItemTaxShowDataSource" name="alienItemTaxShowBlock" restrictInsert="t">  
         <entry field="alien_item_tax.alien_item" name="alienItemEntry" hidden="" x="1" y="1"/>  
     </block>  
     <block datasource="alienItemDeleteDataSource" name="alienItemDeleteBlock" restrictInsert="t">  
         <entry field="alien_item.id" name="idEntry" hidden="" x="1" y="1"/>  
     </block>  
   
       <block datasource="alienItemShowDataSource" name="alienItemShowBlock" restrictInsert="t">  
         <entry field="alien_item.id" name="idEntry" hidden="" x="1" y="1"/>  
         <entry field="alien_item.alien_document" name="alienDocumentEntry" hidden="" x="1" y="1"/>  
   
         <label text="Productos a facturar" x="1" y="12"/>  
         <label text="Código" x="1" y="13"/>  
   
         <entry x="1" y="14" field="alien_product_item.product" name="productCodeEntry" readonly=""  
            width="14" style="textlookup" foreign_key="productNameDataSource._product_data.id"  
            foreign_key_description="_product_code_data.code" rows="7">  
         </entry>  
   
         <label text="Nombre" x="15" y="13"/>  
         <entry x="15" y="14" field="alien_product_item.product" name="productNameEntry" readonly=""  
            width="20" style="textlookup" foreign_key="productNameDataSource._product_data.id"  
            foreign_key_description="_product_data.canonical_name" rows="7">  
         </entry>  
   
         <entry x="15" y="4" field="alien_product_item.product" name="productEntry" width="20" rows="7" hidden=""/>  
   
         <label name="qtyLbl" text="Cantidad" x="43" y="13"/>  
         <entry field="alien_product_item.qty" name="qtyEntry" rows="7" typecast="number" displaymask="%0.4f" width="12" x="43" y="14" style="label" readonly="">  
         </entry>  
   
         <label name="priceLbl" text="Precio" x="55" y="13"/>  
         <entry x="55" y="14" field="alien_product_item.unit_price" name="unitPriceEntry" typecast="number" displaymask="%0.4f"  
                width="10" rows="7" style="label" readonly="">  
         </entry>  
         <label name="taxLbl" text="IVA" x="65" y="13" />  
         <entry x="65" y="14" name="taxPercentEntry" width="5" rows="7" style="label" typecast="number" displaymask="%0.2f"/>  
 <!--         <entry x="65" y="14" field="alien_product_item.product" name="taxPercentEntry" readonly="" -->  
 <!--            width="20" style="textlookup" foreign_key="productTaxDataSource._product_data.id" -->  
 <!--            foreign_key_description="_product_tax_data.amount" rows="7"> -->  
 <!--         </entry> -->  
   
 <!--         <entry x="65" y="14" readonly="" field="alien_item_tax.amount" name="taxAmountEntry" width="5" rows="5" hidden=""/> -->  
 <!--         <entry x="47" y="4" readonly="" field="alien_item_tax.tax" name="taxTypeEntry" width="5" rows="5" default="1" hidden=""/> -->  
   
         <label name="discountLbl" text="Descuento" x="71" y="13"/>  
         <entry field="alien_item.discount" name="discountEntry" typecast="number" displaymask="%0.2f"  
           rows="7" width="10" x="71" y="14" default="0" style="label" readonly="">  
         </entry>  
 <!--         <label name="itemTotalLbl" text="Total" x="82" y="13"/> -->  
 <!--         <entry name="itemTotalEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  -->  
 <!--           rows="10" width="10" x="82" y="14" readonly=""> -->  
 <!--         </entry> -->  
   
 <!--         <label name="bonusLbl" text="Bonificación" x="66" y="3"/> -->  
         <entry field="alien_item.bonus" name="bonusEntry" value="0" typecast="number" displaymask="%0.2f"  
           rows="7" width="12" x="66" y="4" default="0" hidden="">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <scrollbar page="5"  
           x="103" y="14" width="1" height="7"/>  
   
       </block>  
       <block name="otherTaxShowBlock" datasource="alienOtherTaxShowDataSource" restrictInsert="">  
         <label name="otherTaxLbl" text="Otros Impuestos" x="47" y="21"/>  
         <entry name="otherTaxAmountEntry" field="alien_document_tax.amount" x="47" y="22" width="12" style="label">  
         </entry>  
         <entry name="otherTaxTaxedAmountEntry" field="alien_document_tax.taxed_amount" readonly="" x="47" y="22" width="12"  
          hidden="" default="0.00" >  
         </entry>  
       </block>  
   
       <block datasource="alienDocumentShowDataSource" name="totalShowBlock">  
         <label name="totalDiscountLbl" text="Descuento sobre el Total: " x="1" y="22"/>  
         <label name="discountPercentLbl" text="Porcentaje" x="27" y="21"/>  
         <entry name="discountPercentEntry" field="discount_percent" style="label" typecast="number" displaymask="%0.2f"  
           width="10" x="27" y="22">  
         </entry>  
   
 <!--         <label name="totalLbl" text="Neto excento de IVA" x="54" y="23"/> -->  
 <!--         <entry name="exemptNetoEntry" field="alien_document.exempt_net_total" style="label" x="76" y="23" width="12"  -->  
 <!--                default="0.00"/> -->  
         <label name="totalLbl" text="Neto" x="76" y="21"/>  
         <entry name="netoEntry" field="alien_document.net_total" readonly="" style="label" x="76" y="22" width="12" default="0.00"/>  
         <label name="totalLbl" text="Total" x="87" y="21"/>  
         <entry name="totalEntry" readonly="" style="label" x="87" y="22" width="12" default="0.00"/>  
       </block>  
       <block datasource="alienDocumentIvaShowDataSource" name="ivaTotalShowBlock">  
         <label name="ivaLbl" text="IVA" x="65" y="21"/>  
         <entry name="ivaEntry" field="alien_document_tax.amount" readonly="" style="label" x="65" y="22" width="12" default="0.00"/>  
       </block>  
   
       <block datasource="nil" name="tmpBlock">  
         <button x="51" y="24" trigger="deleteTrigger" width="10" label="Borrar"  
           name="deleteBtn" height="1"/>  
   
 <!--         <button x="100" y="100" trigger="okTrigger" width="10" label='Aceptar' -->  
 <!--           name="deleteBtn" height="1"/> -->  
   
       </block>  
   </page>  
   
   <!--   Página de carga de facturas -->  
   <page name="Factura de Proveedor (Alta)">  
   
       <!--     Estos bloques son para la gestion del pago de la factura -->  
       <block name="proceedingBlock" datasource="proceedingDataSource" transparentBlock="">  
         <entry name="idEntry" field="id" hidden="" x="1" y="1" width="12"/>  
         <entry name="dateEntry" field="date" hidden="" x="1" y="1" width="12"/>  
       </block>  
     <!--busco own pos entityIdEntry-->  
     <neb:Sub neb:src="posDocument.nebc" ownPosBlock="ownPosBlock"  
       ownPosEntityIdEntry="ownPosEntityIdEntry"  
       searchOwnPosData="searchOwnPosData"  
       ownStorehouseBlock ="ownStorehouseBlock" ownStorehouseIdEntry="ownStorehouseIdEntry" />  
     <block datasource="alienDocumentDataSource" name="alienDocumentBlock" restrictInsert="t">  
   
         <entry field="id" hidden="" name="idEntry" x="1" y="1"/>  
         <entry field="alien_document_type" hidden="" name="typeEntry" x="1" y="1"/>  
         <!-- cargo el own-pos entity id -->  
         <entry field="own_entity" hidden="" name="ownEntityIdEntry" x="1" y="1"/>  
        <!-- /cargo el own-pos entity id -->  
         <label name="providerLbl" text="Proveedor" x="1" y="1" />  
 <!--         <entry x="1" y="2" field="alien_document.sender" name="providerCodeSEntry" -->  
 <!--            width="20" style="externalsearch" foreign_key="providerExternalSearchDataSource._entity_data.id"  -->  
 <!--            foreign_key_description="_entity_uid_data.uid" >  -->  
         <entry x="1" y="2" name="providerCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
 <!--         <entry x="1" y="3" field="alien_document.sender" name="providerNameSEntry" -->  
 <!--            width="35" style="externalsearch" foreign_key="providerExternalSearchDataSource._entity_data.id"  -->  
 <!--            foreign_key_description="_entity_data.name" >  -->  
         <entry x="1" y="3" name="providerNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
         </entry>  
         <entry x="1" y="2" field="alien_document.sender" name="providerEntry" width="25" hidden="" />  
         <button x="36" y="3" trigger="providerSearchPage2Trigger" width="7" label="Buscar"  
           name="providerSearchPage2Btn" height="1"/>  
   
         <label name="transportLbl" text="Transporte" x="56" y="1" />  
         <entry x="56" y="2" name="transportCodeSEntry" width="20">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="56" y="3" name="transportNameSEntry" width="35">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
         </entry>  
         <entry x="27" y="2" field="alien_document.transport" name="transportEntry" width="25" hidden="" />  
         <button x="91" y="3" trigger="transportSearchPage2Trigger" width="7" label="Buscar"  
           name="transportSearchPage2Btn" height="1"/>  
   
 <!--         <button x="53" y="2" trigger="providerTrigger" width="3" label="..." -->  
 <!--           name="providerBtn" height="1"/> -->  
   
         <label name="salesPersonLbl" text="Vendedor" x="1" y="4" />  
         <entry x="1" y="5" name="salesPersonCodeSEntry" width="20" readonly="">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="1" y="6" name="salesPersonNameSEntry" width="35" readonly="">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
         </entry>  
         <entry x="1" y="4" field="alien_document.salesperson" name="salesPersonEntry" width="25" hidden="" />  
         <button x="36" y="6" trigger="notImplementedSearchTrigger" width="7" label="Buscar"  
           name="searchBtn" height="1"/>  
 <!--         <button x="36" y="6" trigger="salesPersonSearchTrigger" width="7" label="Buscar" -->  
 <!--           name="searchBtn" height="1"/> -->  
   
         <label name="receivedLbl" text="Recibido por:" x="56" y="4" />  
         <entry x="56" y="5" name="receivedCodeSEntry" width="20" readonly="">  
           <options>  
             <option name="tip" value="Insertar el Código"/>  
           </options>  
         </entry>  
         <entry x="56" y="6" name="receivedNameSEntry" width="35" readonly="">  
           <options>  
             <option name="tip" value="Insertar el nombre o descripción"/>  
           </options>  
        </entry>  
         <entry x="27" y="4" field="alien_document.received_by" name="receivedEntry" width="25" hidden="" />  
         <button x="91" y="6" trigger="notImplementedSearchTrigger" width="7" label="Buscar"  
           name="searchBtn" height="1"/>  
 <!--         <button x="91" y="6" trigger="receivedSearchTrigger" width="7" label="Buscar" -->  
 <!--           name="searchBtn" height="1"/> -->  
   
         <label name="numberLbl" text="Número" x="1" y="8" />  
         <entry name="prefNumberEntry" width="5" max_length="4" x="1" y="9">  
           <trigger type="PRE-FOCUSOUT" src="setNumber" />  
         </entry>  
         <entry name="sufNumberEntry" width="9" max_length="8" x="6" y="9">  
           <trigger type="PRE-FOCUSOUT" src="setNumber" />  
         </entry>  
   
         <entry field="number" name="numberEntry" width="20" x="1" y="9" hidden="t"/>  
   
         <label name="dateLbl" text="Fecha" x="22" y="8" />  
         <entry field="date" name="dateEntry" typecast="date"  
           rows="1" width="22" x="22" y="9"/>  
   
         <button x="44" y="9" trigger="toDayTrigger" width="4" label="hoy"  
           name="dateBtn" height="1"/>  
   
         <label name="invoiceTypeLbl" text="Tipo" x="48" y="8" />  
         <entry name="invoiceTypeEntry" width="4" x="48" y="9">  
           <trigger type="PRE-FOCUSOUT" src="invoiceTypeValidation"/>  
         </entry>  
   
         <label name="guideNumberLbl" text="Número de guía" x="53" y="8" />  
         <entry field="guide_number" name="guideNumerEntry" width="20" x="53" y="9"/>  
   
         <label name="bundlesLbl" text="Bultos" x="74" y="8" />  
         <entry field="bundles" name="bundlesEntry" width="10" x="74" y="9"/>  
   
         <label name="totalDiscountLbl" text="Descuento sobre el Total: " x="1" y="22"/>  
         <label name="discountPercentLbl" text="Porcentaje" x="27" y="21"/>  
         <entry name="discountPercentEntry" field="discount_percent" default="0.00" typecast="number" displaymask="%0.2f"  
           width="10" x="27" y="22">  
           <trigger type="PRE-FOCUSOUT" src="discountCalcTrigger" />  
         </entry>  
   
         <label name="totalLbl" text="Neto" x="76" y="21"/>  
         <entry name="netTotalEntry" field="net_total" x="76" y="22" width="11" default="0.00">  
           <trigger type="Pre-Focusout" src="totalChanged"/>  
         </entry>  
   
   
 <!--         <label name="totalLbl" text="Neto excento de IVA" x="54" y="23"/> -->  
 <!--         <entry name="exemptNetTotalEntry" field="exempt_net_total" x="76" y="23" width="11" default="0.00"> -->  
 <!--           <trigger type="Pre-Focusout" src="totalChanged"/> -->  
 <!--         </entry> -->  
   
         <label name="ivaLbl" text="IVA" x="64" y="21"/>  
         <entry name="ivaTotalEntry" x="64" y="22" width="11" default="0.00">  
           <trigger type="Pre-Focusout" src="totalChanged"/>  
         </entry>  
         <entry name="taxTotalEntry" field="tax_total" x="64" y="22" width="11" default="0.00" hidden="">  
         </entry>  
         <label name="totalLbl" text="Total" x="87" y="21"/>  
         <entry name="totalEntry" readonly="" style="label" x="87" y="22" width="12" default="0.00"/>  
   
       </block>  
   
       <block name="otherTaxBlock" datasource="alienOtherTaxDataSource" restrictInsert="">  
         <label name="otherTaxLbl" text="Otros Impuestos" x="47" y="21"/>  
         <entry name="otherTaxAmountEntry" field="alien_document_tax.amount" x="47" y="22" width="12" default="0.00">  
           <trigger type="Pre-Focusout" src="totalChanged"/>  
         </entry>  
         <entry name="otherTaxTaxedAmountEntry" field="alien_document_tax.taxed_amount" readonly="" x="47" y="22" width="12"  
          hidden="" default="0.00"/>  
         <entry name="otherTaxIdEntry" field="alien_document_tax.tax" readonly="" x="47" y="22" width="12" hidden="" default="3"/>  
       </block>  
       <block name="alienIvaTaxBlock" datasource="alienIvaTaxDataSource" restrictInsert="">  
         <entry name="alienIvaTaxAmountEntry" field="alien_document_tax.amount" x="47" y="22" width="12" hidden=""/>  
         <entry name="alienIvaTaxedAmountEntry" field="alien_document_tax.taxed_amount" x="47" y="22" width="12" hidden=""/>  
         <entry name="alienTaxIdEntry" field="alien_document_tax.tax" readonly="" x="47" y="22" width="12" hidden="" default="1"/>  
       </block>  
   
 <!-- \/\/\/\/ Estos bloques los hice con la idea de grabar los totales -->  
   
 <!--       <block name="alienIvaNITaxBlock" datasource="alienIvaNITaxDataSource" restrictInsert=""> -->  
 <!--         <entry name="alienIvaNITaxAmountEntry" field="alien_document_tax.amount" x="47" y="22" width="12" hidden=""/> -->  
 <!--         <entry name="alienIvaNITaxedAmountEntry" field="alien_document_tax.taxed_amount" x="47" y="22" width="12" hidden=""/> -->  
 <!--       </block> -->  
   
 <!-- /\/\/\/\ Fin de bloques que hice con la idea de grabar los totales -->  
   
 <!--     </box> -->  
   
 <!--     <box height="12" label="Productos a facturar" name="invoiceItemBox" -->  
 <!--       width="107" x="0" y="11"> -->  
           <!-- for looking up taxes -->  
       <block name="lookUpTaxBlock" datasource="lookUpTaxDataSource">  
         <entry name="searchThisProductEntry" field="product.id" hidden=""  
           x="1" y="1"/>  
         <entry name="foundTaxEntry" field="_product_tax_data.amount" hidden=""  
           x="1" y="1"/>  
       </block>  
       <block datasource="alienItemDataSource" name="alienItemBlock">  
   
         <entry field="alien_item.alien_document" name="alienDocumentEntry" hidden="" x="1" y="1"/>  
   
         <label text="Productos a facturar" x="1" y="12"/>  
         <label text="Código" x="1" y="13"/>  
         <entry name="productCodeEntry" width="14" x="1" y="14" rows="7">  
             <options>  
               <option name="tip" value="Insertar el código"/>  
             </options>  
         </entry>  
         <label text="Nombre" x="15" y="13"/>  
         <entry name="productNameEntry" width="20" x="15" y="14" rows="7">  
             <options>  
               <option name="tip" value="Insertar el nombre o descripción del producto"/>  
             </options>  
         </entry>  
         <entry x="15" y="4" field="alien_product_item.product" name="productEntry" width="20" rows="5" hidden=""/>  
         <button name="productSearchButton" trigger="productSearchTrigger" label="Buscar" width="7" height="7" x="35" y="14"/>  
   
         <label name="qtyLbl" text="Cantidad" x="42" y="13"/>  
         <entry field="alien_product_item.qty" value="0" name="qtyEntry" rows="7" typecast="number" displaymask="%0.4f" width="12" x="42" y="14">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
   
 <!--         <label name="productLbl" text="Producto" x="15" y="3"/> -->  
 <!--         <button x="32" y="3" trigger="productTrigger" width="3" label="..." -->  
 <!--           name="productBtn" height="1"/> -->  
   
 <!--         <entry x="15" y="4" field="alien_product_item.product" name="productEntry" -->  
 <!--                width="20" rows="5" style="dropdown" foreign_key="productDataSource.id" -->  
 <!--                foreign_key_description="canonical_name"> -->  
 <!--           HERE -->  
 <!--           <trigger type="PRE-FOCUSOUT" src="lookUpTax"/> -->  
 <!--         </entry> -->  
         <label name="priceLbl" text="Precio" x="54" y="13"/>  
         <entry x="54" y="14" field="alien_product_item.unit_price" name="unitPriceEntry" typecast="number" displaymask="%0.4f"  
                width="10" rows="7">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <label name="taxLbl" text="IVA" x="64" y="13" />  
         <entry x="64" y="14" name="taxPercentEntry" width="5" rows="7" typecast="number" displaymask="%0.2f">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
   
         <entry x="65" y="14" readonly="" field="alien_item_tax.amount" name="taxAmountEntry" width="5" rows="5" hidden=""/>  
         <entry x="47" y="4" readonly="" field="alien_item_tax.tax" name="taxTypeEntry" width="5" rows="5" default="1" hidden=""/>  
   
         <label name="discountLbl" text="Dto." x="69" y="13"/>  
         <entry field="alien_item.discount" name="discountEntry" typecast="number" displaymask="%0.2f"  
           rows="7" width="6" x="69" y="14" default="0">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <entry name="totalDiscountEntry" typecast="number" rows="7" width="10" x="69" y="14" default="0.00" hidden="t">  
         </entry>  
   
         <label name="itemNetoLbl" text="Neto " x="76" y="13"/>  
         <entry name="itemNetoEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="7" width="10" x="76" y="14">  
         </entry>  
   
         <label name="itemTotalLbl" text="Total" x="87" y="13"/>  
         <entry name="itemTotalEntry" style="label" default="0.00" typecast="number" displaymask="%0.2f"  
           rows="7" width="10" x="87" y="14">  
         </entry>  
   
         <button name="productDeleteButton" trigger="productDeleteTrigger" label="Borrar" width="7" height="7" x="96" y="14"/>  
 <!--         <label name="bonusLbl" text="Bonificación" x="66" y="3"/> -->  
         <entry field="alien_item.bonus" name="bonusEntry" value="0" typecast="number" displaymask="%0.2f"  
           rows="5" width="12" x="66" y="4" default="0" hidden="">  
           <trigger type="PRE-FOCUSOUT" src="totalCalcTrigger" />  
         </entry>  
         <scrollbar page="5"  
           x="104" y="14" width="1" height="7"/>  
       </block>  
   
      <!--  <block datasource="alienItemDataSourceToUpd" name="alienItemToUpdBlock"> -->  
 <!--         <entry name="alienDocumentToUpdEntry" field="alien_item.alien_document" hidden="" x="1" y="109" width="10"/> -->  
 <!--         <entry name="prodIdEntry" field="alien_product_item.product" hidden="" x="11" y="109" width="10"/> -->  
 <!--         <entry name="qtyEntry" field="alien_product_item.qty" hidden="" x="22" y="109" width="10"/> -->  
 <!--         <entry name="levelEntry" field="_product_store_data.level" hidden="" x="33" y="109" width="10"/> -->  
 <!--         <entry name="productEntry" field="_product_store_data.product" hidden="" x="33" y="109" width="10"/> -->  
 <!--         <entry name="storehouseEntry" field="_product_store_data.storehouse" hidden="" x="33" y="109" width="10"/> -->  
 <!--         <entry name="hiwaterEntry" field="_product_store_data.hiwater" hidden="" x="33" y="109" width="10"/> -->  
 <!--         <entry name="lowaterEntry" field="_product_store_data.lowater" hidden="" x="33" y="109" width="10"/> -->  
 <!--         <entry name="tableEntry" field="_product_store_data._table" hidden="" x="33" y="109" width="10"/> -->  
 <!--       </block> -->  
 <!--           Bloques que sirven para el pago -->  
     <neb:Sub neb:src="setStock.nebc"  
       alienDocumentId="tmpValuesDataSource.idEntry"  
       storehouseEntityId="ownStorehouseBlock.ownStorehouseIdEntry"    
       stockAddTrigger="stockAddTrigger" stockSubstractTrigger="stockSubstractTrigger" />  
       <block name="alienDocumentProceedingBlock" datasource="alienDocumentProceedingDataSource" transparentBlock="">  
           <entry name="proceedingEntry" field="proceeding" hidden="" x="1" y="1" width="12"/>  
           <entry name="alienDocumentEntry" field="alien_document" hidden="" x="1" y="1" width="12"/>  
           <entry name="amountEntry" field="amount" hidden="" x="1" y="1" width="12"/>  
       </block>  
       <block name="currencyMovementBlock" datasource="currencyMovementDataSource" transparentBlock="">  
           <entry name="proceedingEntry" field="movement.proceeding" hidden="" x="1" y="1" width="12"/>  
           <entry name="movementTypeEntry" field="movement.movement_type" hidden="" x="1" y="1" width="12"/>  
           <entry name="amountEntry" field="movement.amount" hidden="" x="1" y="1" width="12"/>  
           <entry name="currencyTypeEntry" field="currency_movement.currency_type" hidden="" x="1" y="1" width="12"/>  
       </block>  
 <!--     </box> -->  
   
     <box height="4" label="Pago de la factura" name="payBox"  
       width="107" x="0" y="24">  
       <block datasource="payDataSource" name="payBlock">  
       <label text="Efectivo : " x="1" y="1"/>  
       <entry name="cashEntry" x="11" y="1" width="12" typecast="number" displaymask="%0.2f" default="0.00">  
         <trigger type="Pre-Focusout">  
            import hack  
            payBlock.ctaCteEntry = str(round(hack.a2f(alienDocumentBlock.totalEntry,2) - hack.a2f(payBlock.cashEntry,2),2))  
         </trigger>  
       </entry>  
       <label text="Cta. Cte. : " x="24" y="1"/>  
       <entry name="ctaCteEntry" x="35" y="1" width="12" typecast="number" displaymask="%0.2f" default="0.00">  
         <trigger type="Pre-Focusout">  
            import hack  
            payBlock.cashEntry = str(round(hack.a2f(alienDocumentBlock.totalEntry,2) - hack.a2f(payBlock.ctaCteEntry,2),2))  
         </trigger>  
       </entry>  
   
         <button x="49" y="1" trigger="providerMultiCurrencyTrigger" width="10" label="Aceptar"  
           name="commitBtn" height="1"/>  
         <button x="60" y="1" trigger="rollbackTrigger" width="10" label="Cancelar"  
           name="rollbackBtn" height="1"/>  
   
       </block>  
     </box>  
     <block name="providerResultBlock" datasource="providerSearchDataSource">  
       <entry name="idEntry" field="_entity_data.id" hidden="" x="1" y="1" width="12"/>  
       <entry name="providerCodeEntry" field="_entity_uid_data.uid" x="1" y="1" width="12" hidden=""/>  
       <entry name="providerNameEntry" field="_entity_data.name" x="1" y="1" width="12" hidden=""/>  
       <entry name="providerIvaTaxProfileEntry" field="_persona_tax_profile_data.tax_profile" x="1" y="1" width="12" hidden=""/>  
     </block>  
     <block name="transportResultBlock" datasource="providerSearchDataSource">  
       <entry name="idEntry" field="_entity_data.id" hidden="" x="1" y="1" width="12"/>  
       <entry name="transportCodeEntry" field="_entity_uid_data.uid" x="1" y="1" width="12" hidden=""/>  
       <entry name="transportNameEntry" field="_entity_data.name" x="1" y="1" width="12" hidden=""/>  
     </block>  
      <!--   En este bloque se almacena el reultado final/real de la búsqueda para seleccion el correcto -->  
      <block name="productResultBlock" datasource="productSearchDataSource" restrictInsert="" transparentBlock="">  
        <entry name="prodNameEntry" field="_product_data.canonical_name" x="1" y="1" width="15" rows="2" hidden=""/>  
        <entry name="prodIdEntry" field="_product_data.id" x="15" y="1" width="5" rows="2" hidden=""/>  
        <entry name="prodCodeEntry" field="_product_code_data.code" x="20" y="1" width="10" rows="2" hidden=""/>  
        <entry name="prodCodeTypeEntry" field="_product_code_data.product_code_type" x="30" y="1" width="5" rows="2" hidden=""/>  
        <entry name="prodIVATaxEntry" field="_product_tax_data.amount" x="50" y="1" width="20" rows="2" hidden=""/>  
      </block>  
      <block name="currentSearchIdBlock" datasource="currentSearchIdDataSource">  
        <entry name="searchId" hidden="" x="1" y="1" width="12"/>  
      </block>  
      <block name="ownOrganizationBlock" datasource="ownOrganizationDataSource">  
        <entry name="condIVAEntry" field="_tax_profile_data._table" hidden="" x="1" y="1" width="10"/>  
      </block>  
      <block name="tmpAmountBlock" datasource="tmpAmountDataSource">  
        <entry name="ctaCteAmountEntity" hidden="" x="1" y="1" width="12"/>  
        <entry name="cashAmountEntity" hidden="" x="1" y="1" width="12"/>  
      </block>      
   </page>  
8    
9    <neb:Sub neb:src="alien_document.nebc"
10    document_name="Factura"
11    document_type_A="2"
12    document_type_B="10"
13    document_type_C="11"
14    stock_alta="stockAddTrigger"
15    stock_borrado="stockSubstractTrigger"
16    />
17  </form>  </form>

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

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