none
Desarrollo Txt a txt con layout RRS feed

  • Pregunta

  • Estimados,

    necesito pasar datos de un txt (representa factura) con un layout particular a otro txt con otro layout.

    coloco código que utilice para abrir el txt y pasar parametros a las variables. 

    que me conviene hacer para pasar los datos al "txt resultado"?.

    Dim cod_dhl, edi_dhl As String

    Dim registro, linea, edi_registro, edi_linea As Integer

     

    Private Sub Cmd_Procesar_Click()

    Dim alea_fc As Integer

    Dim register_code_cien, invoice_number_cien, invoice_date_cien, exporter_code_cien, currency_cien, country_procedence_cien, total_value_packing_cien, total_value_inland_freight_cien, invoice_total_value_cien, importer_code_cien, plant_code_cien, incoterm_cien, payment_condition_cien As String

    Dim register_code_dos, invoice_number_dos, invoice_date_dos, exporter_code_dos, part_number_dos, quantity_dos, unit_value_dos, unit_measure_dos, country_origin_dos, manufacturer_code_dos As String

    '----------------

    n_file = FreeFile

     

        Open App.Path & "\dhl.txt" For Input As #n_file

     

        While Not EOF(n_file)

        alea_fc = 0

       ' tipo_transacao_cien = I

        'tipo_ordem_cien = 0

        Line Input #n_file, cod_dhl

            registro = Mid(cod_dhl, 1, 3)

           

            Select Case registro

                Case "100":

                   

                    register_code_cien = Mid(cod_dhl, 1, 3)

                    invoice_number_cien = Mid(cod_dhl, 4, 25)

                    invoice_date_cien = Mid(cod_dhl, 29, 10)

                    exporter_code_cien = Mid(cod_dhl, 39, 10)

                    currency_cien = Mid(cod_dhl, 49, 3)

                    country_procedence_cien = Mid(cod_dhl, 52, 3)

                    total_value_packing_cien = Mid(cod_dhl, 55, 14)

                    total_value_inland_freight_cien = Mid(cod_dhl, 69, 14)

                    invoice_total_value_cien = Mid(cod_dhl, 83, 14)

                    importer_code_cien = Mid(cod_dhl, 97, 10)

                    plant_code_cien = Mid(cod_dhl, 107, 4)

                    incoterm_cien = Mid(cod_dhl, 111, 3)

                    payment_condition_cien = Mid(cod_dhl, 114, 4)            

                Case "200":

                    register_code_dos = Mid(cod_dhl, 1, 3)

                    invoice_number_dos = invoice_number_cien

                    invoice_date_dos = invoice_date_cien

                    exporter_code_dos = exporter_code_cien

                    part_number_dos = Mid(cod_dhl, 49, 20)

                    quantity_dos = Mid(cod_dhl, 69, 12)

                    unit_value_dos = Mid(cod_dhl, 81, 14)

                    unit_measure_dos = Mid(cod_dhl, 95, 3)

                    country_origin_dos = Mid(cod_dhl, 98, 3)

                    manufacturer_code_dos = Mid(cod_dhl, 101, 10)

             End Select

            Wend

    End Sub

    viernes, 24 de julio de 2015 13:35