<form class="form-horizontal" role=form>
    <h2>Product Ledger</h2>

    <div class="form-group">
        <label for="txtStartDate" class="col-md-2 control-label">Date</label>

        <div class="col-md-5">
            <div class="input-group">
                <input class="form-control" id="txtStartDate" type="text" datepicker-popup="dd-MMM-yyyy"
                       ng-model="info.StartDate"/>
                <span class="input-group-btn">
                    <button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
            </div>
        </div>
        <div class="col-md-5">
            <div class="input-group">
                <input type="text" id="txtFinishDate" class="form-control" datepicker-popup="dd-MMM-yyyy"
                       ng-model="info.FinishDate"/>
                <span class="input-group-btn">
                    <button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="txtProduct" class="col-md-2 control-label">Product</label>

        <div class="col-md-10">
            <div class="input-group">
                <input type="text" id="txtProduct" class="form-control" ng-model="info.Product"
                       typeahead="product as product.Name for product in products($viewValue)"
                       typeahead-editable="false" on-return="show()"/>
                    <span class="input-group-btn">
                        <button class="btn btn-info" ng-click="show()">Show <i class="glyphicon glyphicon-eye-open"></i>
                        </button>
                    </span>
            </div>
        </div>
    </div>
    <table id="gvGrid" class="table table-condensed table-bordered table-striped">
        <thead>
        <tr>
            <th>Date</th>
            <th>Particulars</th>
            <th>Type</th>
            <th>Narration</th>
            <th class="text-right">Debit Q</th>
            <th class="text-right">Debit A</th>
            <th class="text-right">Credit Q</th>
            <th class="text-right">Credit A</th>
            <th class="text-right">Running Q</th>
            <th class="text-right">Running A</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in info.Body">
            <td>{{item.Date}}</td>
            <td><a href="{{item.Url}}">{{item.Name}}</a></td>
            <td>{{item.Type}}</td>
            <td>{{item.Narration}}</td>
            <td class="text-right">{{item.DebitQ | number:2 | clr}}</td>
            <td class="text-right">{{item.DebitA | currency | clr}}</td>
            <td class="text-right">{{item.CreditQ | number:2 | clr}}</td>
            <td class="text-right">{{item.CreditA | currency | clr}}</td>
            <td class="text-right">{{item.RunningQ | number:2}}</td>
            <td class="text-right">{{item.RunningA | currency}}</td>
        </tr>
        </tbody>
        <tfoot>
        <tr>
            <td class="no-wrap">{{info.Footer.Date}}</td>
            <td>{{info.Footer.Name}}</td>
            <td>{{info.Footer.Type}}</td>
            <td>{{info.Footer.Narration}}</td>
            <td class="text-right">{{info.Footer.DebitQ | number:2}}</td>
            <td class="text-right">{{info.Footer.DebitA | currency}}</td>
            <td class="text-right">{{info.Footer.CreditQ | number:2}}</td>
            <td class="text-right">{{info.Footer.CreditA | currency}}</td>
            <td class="text-right">{{info.Footer.RunningQ | number:2}}</td>
            <td class="text-right">{{info.Footer.RunningA | currency}}</td>
        </tr>
        </tfoot>
    </table>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button class="btn btn-info" ng-click="downloadTable()">Download <i
                    class="glyphicon glyphicon-download-alt"></i></button>
        </div>
    </div>
</form>
