在表中复合不同的检索数据?

时间:2016-04-15 08:17:38

标签: php mysql symfony twig

我有一个问题,因为我正在开发的系统的要求现在需要复合两个不同的数据,这意味着来自数据库的两个不同的检索数据将显示在同一行和列中,是否可能? 我很感激你的回答,谢谢!我想在同一行和列中加入Filename和FA状态,我该怎么做?

这是我的代码:

<div class="col-xs-12">
<div class="panel panel-info">
    <div class="panel-heading">Outbound Transactions</div>
        <div class="panel-body table-responsive spacer">
            <table class="table table-striped table-bordered" cellspacing="0">
                <tbody>
                    <tr>
                        <th>Receiver</th>
                        <th>Send Date</th>
                        <th>Filename</th>
                        <th>ISA</th>
                        <th>GS</th>
                        <th>Trans</th>
                        <th>Sender ID</th>
                        <th>Receiver ID</th>
                        <th>FA Status</th>
                        <th style="width: 5%;">Action</th>
                    </tr>
                    {% if transaction != null %}
                        {% for trans in transaction %}
                            <tr>
                                <td style="width: 8%;">
                                  {{ render(controller('MatrixEdiBundle:Matrix:getTradingPartnerName', {'timexID' : trans.ediTransaction.receiverId, 'customerID' : trans.ediTransaction.senderId })) }}
                                </td>

                                {% 
                                   set result=render(controller('MatrixEdiBundle:Matrix:getFile', {'fileName' : trans.ediTransaction.fileName, 'senderId': trans.ediTransaction.senderId , 'receiverId' : trans.ediTransaction.receiverId, 'gsNumber' : trans.ediTransaction}))|split('+', 4)
                                %}

                                <td style="width: 7%;">{{ result[0] }}</td>
                                <td style="width: 30%;">{{ result[3] }}</td>
                                <td style="width: 7%;">{{ result[2] }}</td>
                                <td style="width: 5%;">{{ result[1] }}</td>
                                <td style="width: 3%;">{{ trans.noOfTrans }}</td>
                                <td style="width: 7%;">{{ trans.ediTransaction.receiverId }}</td>
                                <td style="width: 7%;">{{ trans.ediTransaction.senderId }}</td>
                                <td style="width: 8%;">
                                    {% if trans.errorCodeId == 2 %}
                                        <span style="background-color: yellow;">Accepted but <br/>errors were <br/>noted</span>
                                    {% elseif trans.errorCodeId == 3 %}
                                        <span style="background-color: yellow;">Partially<br/> Accepted</span><br/><br/>
                                            {{ trans.acceptedTrans }} Accepted,<br/>
                                            {{ trans.noOfTrans - trans.acceptedTrans }} Rejected
                                    {% else %}
                                        <span style="background-color: yellow;">Rejected</span>
                                    {% endif %}
                                    <br/><br/>

                                    {% 
                                        set error=render(controller('MatrixEdiBundle:Matrix:getError', {'id': trans.edi997DetailId }))|split('+') 
                                    %}
                                    <span>
                                        <p style="white-space: normal;">
                                            {% if error[0] != "0" %}
                                                {{ error[0] }}{{ "%02d"|format(error[1]) }}<br/>
                                                {{ error[2] }}
                                            {% else %}
                                                Errors were not specified in 997 file
                                            {% endif %}
                                        </p>
                                    </span>
                                </td>

                                <td>
                                  <a href="" data-href="{{ path('matrix_edi_deleteFile', { 'id':trans.ediTransaction.ediTransactionId,'filename': trans.ediTransaction.fileName, 'url': 'matrix_edi_rejectedOutboundTrans' }) }}" data-toggle="modal" data-target="#confirm-delete"><center><i class="fa fa-trash o" style="color:#1975A3;"></i></center></a>
                                </td>
                            </tr>
                        {% endfor %}
                    {% else %}
                        <tr>
                            <td colspan="15" class="alignment result"> No Result Found </td>
                        </tr>
                    {% endif %}
                </tbody>
            </table>
                <div class="panel-footer"> 
      {% if transaction | length > 0 and pagination['pages_count'] is defined and pagination['pages_count'] > 0 %}
          {#-----------------Pager------------------#}

0 个答案:

没有答案