Plugin Directory

Changeset 2586168


Ignore:
Timestamp:
08/20/2021 08:16:25 PM (5 years ago)
Author:
kakaroto84
Message:

1.2

  • Update to 1.8 Version of Yabi
  • Change numeric variables to strings
Location:
wc-yabi/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wc-yabi/trunk/content/product.php

    r2469031 r2586168  
    55    }
    66   
    7     <?php if( $person['accountid'] == 2 ): ?>
     7    <?php if( $person['accountid'] == 'NATURAL' ): ?>
    88   
    99        .data-commercialname, #identifier-instruction
     
    2121    var accountid = jQuery('#accountid').val();
    2222   
    23     if( parseInt( accountid ) == 1 )
     23    if( accountid == 'LEGAL' )
    2424    {
    2525        jQuery('.data-commercialname').show(500);
    2626        jQuery('#identifier-instruction').show();
    2727       
    28         jQuery('#type').val(31);
     28        jQuery('#type').val('NIT');
    2929    }
    3030    else
     
    3333        jQuery('#identifier-instruction').hide();
    3434       
    35         jQuery('#type').val(13);
     35        jQuery('#type').val('CC');
    3636    }
    3737}
     
    129129    </tr>
    130130   
    131     <tr class="data-commercialname">
     131    <tr>
    132132        <th><?php echo __('Tax Level Code','yabi-wc'); ?>:</th>
    133133        <td>
  • wc-yabi/trunk/includes/transaction.php

    r2520098 r2586168  
    33function yabi_create_commercial( $person )
    44{
    5     if( $person['accountid'] == 1 )
    6     {
    7         $taxlevelcode = $person['taxlevelcode'];
    8         $pieces = explode( ',', $taxlevelcode );
    9         $pieceformat = array();
    10         foreach( $pieces as $p )
    11         {
    12             $tax = trim( $p );
    13             if( !empty( $tax ) )
    14             {
    15                 array_push( $pieceformat, '"'. $tax .'"' );
    16             }
    17         }
    18         $taxlevelcode = implode( ',', $pieceformat );
    19        
     5    $taxlevelcode = $person['taxlevelcode'];
     6    $pieces = explode( ',', $taxlevelcode );
     7    $pieceformat = array();
     8    foreach( $pieces as $p )
     9    {
     10        $tax = trim( $p );
     11        if( !empty( $tax ) )
     12        {
     13            array_push( $pieceformat, '"'. $tax .'"' );
     14        }
     15    }
     16    $taxlevelcode = implode( ',', $pieceformat );
     17   
     18    if( $person['accountid'] == 'LEGAL' )
     19    {      
    2020        $taxscheme = '';
    2121        if( $person['taxscheme'] )
     
    3232    else
    3333    {
    34         $commercial = 'partyTaxRegime:"49"';
     34        $commercial = 'partyTaxScheme:{
     35            taxLevelCode:['. $taxlevelcode .']
     36        }';
    3537    }
    3638   
     
    5759    }   
    5860   
    59     $invoicetypecode = "01";
    60     if( $person['accountid'] == 1 )
    61     {
    62         $invoicetypecode = "02";
     61    $invoicetypecode = "SALES_INVOICE";
     62    if( $person['accountid'] == 'LEGAL' )
     63    {
     64        $invoicetypecode = "SALES_INVOICE";
    6365    }
    6466   
     
    8688        invoiceAcquirerId:{
    8789          identifier:"'. $person['identifier'] .'"
    88           type:"'. $person['type'] .'"
     90          type:'. $person['type'] .'
    8991        }
    9092        invoiceConsecutive:"'. $invoiceConsecutive .'"
     
    9496          ]
    9597          paymentMeans:{
    96             id:"1"
     98            id:IN_CASH
    9799            paymentDueDate:"'. $payment['dueDate'] .'"
    98100            paymentId:"'. $payment['id'] .'"
     
    104106          documentCurrencyId:"COP"
    105107          dueDate:"'. $payment['dueDate'] .'"
    106           invoiceOperationCode:"10"
    107           invoiceTypeCode:"'. $invoicetypecode .'"
     108          invoiceTypeCode:'. $invoicetypecode .'
    108109          issueDateTime:"'. $payment['dateTime'] .'"
    109110        }
     
    111112          id:1
    112113          taxAmount:'. $data_products['total_tax'] .'
    113           taxSchemeId:"01"
     114          taxSchemeId:IVA
    114115          taxSubtotal:['. $tax_subtotal .']
    115116        }]
     
    166167              baseQuantity:1
    167168              currencyId:"COP"
    168               unitCode:"ZZ"
     169              unitCode:"UnitCode"
    169170              value:'. $basevalue .'
    170171            }
    171172            quantity:'. $item['quantity'] .'
    172173            standardItemId:{
    173               agencyId:""
     174              agencyId:OFE_STD
    174175              id:"'. $item['id'] .'"
    175               name:"Estándar de Adopción del contribuyente"
    176               schemaId:"999"
     176              name:OFE_STD
     177              schemaId:OFE_STD
    177178            }
    178179            taxTotals:[{
    179180              id:1
    180               taxSchemeId:"01"
     181              taxSchemeId:IVA
    181182              taxSubtotal:{
    182183                percent:'. $item['percent'] .'
     
    185186              }
    186187            }]
    187             unit:"ZZ"
     188            unit:"Unit"
    188189          }';
    189190         
  • wc-yabi/trunk/readme.txt

    r2520098 r2586168  
    44Donate link: https://www.paypal.me/datakun
    55Requires at least: 5.5
    6 Tested up to: 5.7.1
     6Tested up to: 5.8
    77Requires PHP: 7.4
    88Stable tag: trunk
     
    8282= 1.1.1 =
    8383* Timeout was increased as Yabi servers started experiencing service delays
     84= 1.2 =
     85* Update to 1.8 Version of Yabi
     86* Change numeric variables to strings
  • wc-yabi/trunk/wc-yabi.php

    r2520098 r2586168  
    99 * Plugin URI:        https://mireunion.com/yabi
    1010 * Description:       Create your electronic invoices of purchases made in woocommerce with Yabi
    11  * Version:           1.1.1
     11 * Version:           1.2
    1212 * Author:            Mex Avila
    1313 * Author URI:        https://datakun.com/
     
    8787    $yabi_invoice = get_post_meta( $post->ID, 'yabi_invoice', true );
    8888    $thetypes = array(
    89         13 => 'Cédula de ciudadanía',
    90         31 => 'NIT',
    91         12 => 'Tarjeta de identidad',
    92         21 => 'Tarjeta de extranjería',
    93         22 => 'Cédula de extranjería',
    94         41 => 'Pasaporte',
    95         42 => 'Documento de identificación extranjero',
    96         50 => 'NIT de otro país',
    97         91 => 'NUIP *'
     89        'CC'    => 'Cédula de ciudadanía',
     90        'NIT'   => 'NIT',
     91        'TI'    => 'Tarjeta de identidad',
     92        'TE'    => 'Tarjeta de extranjería',
     93        'CE'    => 'Cédula de extranjería',
     94        'P'     => 'Pasaporte',
     95        'RC'    => 'Registro Civil',
     96        'DIE'   => 'Documento de identificación extranjero',
     97        'NITE'  => 'Número de Identificación Tributaria Extranjera',
     98        'NUIP'  => 'Número Único de Identificación Personal'
    9899    );
    99100    $typesperson = array(
    100         1 => 'Persona Jurídica',
    101         2 => 'Persona Natural'
     101        'LEGAL'     => 'Persona Jurídica',
     102        'NATURAL'   => 'Persona Natural'
    102103    );
    103104    $person = get_post_meta( $post->ID, 'yabi_person', true );
     
    121122           
    122123            $identifier = get_post_meta( $post->ID, 'nit', true );
    123             $type = 13;
    124             $accountid = 2;
     124            $type = 'CC';
     125            $accountid = 'NATURAL';
    125126            $commercialname = '';
    126             $taxlevelcode = '';
     127            $taxlevelcode = 'O-48';
    127128            $taxscheme = 0;
    128129           
Note: See TracChangeset for help on using the changeset viewer.