示例#1
0
</td>
                              <td class="numeric"><?php 
    echo org_openpsa_helpers::format_number($view['cost']);
    ?>
</td>
                          <?php 
} else {
    ?>
                              <td class="numeric"><?php 
    echo $view['costPerUnit'];
    ?>
 %</td>
                              <td class="numeric">&nbsp;</td>
                              <td class="numeric">&nbsp;</td>
                              <td class="numeric"><?php 
    echo org_openpsa_helpers::format_number($view['cost']);
    ?>
</td>
                          <?php 
}
?>
                        </tr>
                      </tbody>
                    </table>
                    </td>
                </tr>
            <tbody>
        </table>
    </div>

    <div class="wide">
    $paid = ", " . midcom::get('i18n')->get_string('paid', 'org.openpsa.invoices') . ": " . strftime('%x', $invoice->paid);
} else {
    if ($invoice->due < time()) {
        $paid = ", " . midcom::get('i18n')->get_string('not paid', 'org.openpsa.invoices');
    }
}
?>

<li class="invoice" id="org_openpsa_relatedto_line_&(link['guid']);">
    <span class="icon">&(data['icon']:h);</span>
    <span class="title">&(data['title']:h);</span>
    <ul class="metadata">
    <?php 
// Customer
if ($invoice->customer) {
    $customer = midcom_db_group::get_cached($invoice->customer);
    echo "<li>" . midcom::get('i18n')->get_string('customer', 'org.openpsa.invoices') . ": {$customer->official}</li>";
}
echo "<li>" . midcom::get('i18n')->get_string('sum', 'org.openpsa.invoices') . ": " . org_openpsa_helpers::format_number($invoice->sum) . " (" . midcom::get('i18n')->get_string('due', 'org.openpsa.invoices') . ": " . strftime('%x', $invoice->due) . "{$paid})</li>";
?>
    </ul>

    <div id="org_openpsa_relatedto_details_&(invoice.guid);" class="details hidden" style="display: none;">
    </div>

  <?php 
//TODO: necessary JS stuff to load details (which should in turn include the invoice's own relatedtos) via AHAH
echo org_openpsa_relatedto_handler_relatedto::render_line_controls($link, $data['other_obj']);
?>
</li>
示例#3
0
}
$footer_data = array('customer' => $data['l10n']->get('totals'), 'sum' => org_openpsa_helpers::format_number($grid->get_provider()->get_column_total('index_sum')));
$grid->set_option('loadonce', true);
if (!array_key_exists('deliverable', $data)) {
    $grid->set_option('caption', $data['list_label']);
}
$grid->set_column('number', $data['l10n']->get('invoice'), 'width: 80, align: "center", fixed: true, classes: "title"', 'string');
if (!is_a($data['customer'], 'org_openpsa_contacts_group_dba')) {
    $grid->set_column('customer', $data['l10n']->get('customer'), 'classes: "ui-ellipsis"');
}
if (!is_a($data['customer'], 'org_openpsa_contacts_person_dba')) {
    $grid->set_column('contact', $data['l10n']->get('customer contact'), 'classes: "ui-ellipsis"');
}
if (array_key_exists('deliverable', $data)) {
    $grid->set_column('item_sum', $data['deliverable']->title, 'width: 80, fixed: true, align: "right"', 'number');
    $footer_data['item_sum'] = org_openpsa_helpers::format_number($data['totals']['deliverable']);
}
$grid->set_column('due', $data['l10n']->get('due'), 'width: 80, align: "center", formatter: "date"')->set_column('sum', $data['l10n']->get('amount'), 'width: 80, fixed: true, align: "right", title: false, classes: "sum"', 'number');
if ($data['list_type'] != 'paid') {
    $grid->set_column('action', $data['l10n']->get('next action'), 'width: 80, align: "center", title: false');
} else {
    $grid->set_column('paid', $data['l10n']->get('paid date'), 'width: 80, align: "center", formatter: "date"');
}
$grid->set_footer_data($footer_data);
?>

<div class="org_openpsa_invoices <?php 
echo $classes;
?>
 full-width crop-height">
<?php 
示例#4
0
        continue;
    }
    $view_product = $data['datamanager_product']->get_content_html();
    $entry = array();
    $path = $product->get_path();
    $link_html = "<a href='{$prefix}product/{$path}/'>";
    $next_marker = false;
    $entry['id'] = $product->id;
    $entry['index_code'] = $product->code;
    $entry['code'] = $link_html . $product->code . '</a>';
    $entry['index_title'] = $product->title;
    $entry['title'] = $link_html . $product->title . '</a>';
    $entry['orgOpenpsaObtype'] = $view_product['orgOpenpsaObtype'];
    $entry['delivery'] = $view_product['delivery'];
    $entry['index_price'] = $product->price;
    $entry['price'] = org_openpsa_helpers::format_number($product->price);
    $entry['unit'] = $view_product['unit'];
    $entries[] = $entry;
}
echo '<script type="text/javascript">//<![CDATA[';
echo "\nvar " . $grid_id . '_entries = ' . json_encode($entries);
echo "\n//]]></script>";
?>

<div class="org_openpsa_products full-width">

<table id="&(grid_id);"></table>
<div id="p_&(grid_id);"></div>

</div>
示例#5
0
文件: view.php 项目: nemein/openpsa
 private function _build_deliverable_toolbar($deliverable)
 {
     $toolbar = '';
     if ($deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATUS_DECLINED) {
         //new, proposed
         $toolbar .= "<input type=\"submit\" class=\"order\" name=\"order\" value=\"" . $this->_l10n->get('mark ordered') . "\" />\n";
         $toolbar .= "<input type=\"submit\" class=\"decline\" name=\"decline\" value=\"" . $this->_l10n->get('mark declined') . "\" />\n";
     } else {
         if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATUS_DECLINED) {
             //declined, nothing to do...
         } else {
             if ($deliverable->state < org_openpsa_sales_salesproject_deliverable_dba::STATUS_DELIVERED) {
                 //started, ordered
                 if ($deliverable->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) {
                     $entries = $deliverable->get_at_entries();
                     if (isset($entries[0])) {
                         $toolbar .= "<p>" . sprintf($this->_l10n->get('next invoice will be generated on %s'), strftime('%x', $entries[0]->start));
                         if ($entries[0]->status == midcom_services_at_entry_dba::SCHEDULED && midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) {
                             $toolbar .= ' <input type="hidden" name="at_entry" value="' . $entries[0]->guid . "\" />\n";
                             $toolbar .= ' <input type="submit" class="run_cycle" name="run_cycle" value="' . $this->_l10n->get('generate now') . "\" />\n";
                         }
                         $toolbar .= "</p>\n";
                     }
                 } else {
                     if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATUS_ORDERED) {
                         $toolbar .= "<input type=\"submit\" class=\"deliver\" name=\"deliver\" value=\"" . $this->_l10n->get('mark delivered') . "\" />\n";
                     }
                 }
             } else {
                 if ($deliverable->state == org_openpsa_sales_salesproject_deliverable_dba::STATUS_INVOICED) {
                     //delivered, invoiced
                     if ($deliverable->invoiced > 0) {
                         $toolbar .= "<p>" . $this->_l10n->get('invoiced') . ': ' . org_openpsa_helpers::format_number($deliverable->invoiced, 2) . "</p>\n";
                     }
                 } else {
                     if ($deliverable->orgOpenpsaObtype != org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION && midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) {
                         //not invoiced yet
                         $client_class = $this->_config->get('calculator');
                         $client = new $client_class();
                         $client->run($deliverable);
                         if ($client->get_price() > 0) {
                             $toolbar .= "<input type=\"submit\" class=\"invoice\" name=\"invoice\" value=\"" . sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('invoice')) . "\" />\n";
                         }
                     }
                 }
             }
         }
     }
     return $toolbar;
 }
示例#6
0
     <th><?php 
echo $data['l10n']->get('value');
?>
</th>
     <td><?php 
echo org_openpsa_helpers::format_number($view['value']);
?>
</td>
    </tr>
    <tr>
     <th><?php 
echo $data['l10n']->get('profit');
?>
</th>
     <td><?php 
echo org_openpsa_helpers::format_number($view['profit']);
?>
</td>
    </tr>
    <?php 
$owner_card = org_openpsa_widgets_contact::get($salesproject->owner);
?>
    <tr>
     <th><?php 
echo $data['l10n']->get('owner');
?>
</th>
     <td><?php 
echo $owner_card->show_inline();
?>
</td>
示例#7
0
 }
 $row['index_closeest'] = '';
 $row['closeest'] = '';
 if ($salesproject->closeEst) {
     $row['index_closeest'] = $salesproject->closeEst;
     $row['closeest'] = strftime("%x", $salesproject->closeEst);
 }
 $row['index_value'] = $salesproject->value;
 $row['value'] = org_openpsa_helpers::format_number($salesproject->value);
 if ($data['mode'] == 'active') {
     $row['probability'] = $salesproject->probability . '%';
     $row['index_weightedvalue'] = $salesproject->value / 100 * $salesproject->probability;
     $row['weightedvalue'] = org_openpsa_helpers::format_number($salesproject->value / 100 * $salesproject->probability);
 }
 $row['index_profit'] = $salesproject->profit;
 $row['profit'] = org_openpsa_helpers::format_number($salesproject->profit);
 $row['prev_action'] = '';
 $action = $salesproject->prev_action;
 switch ($action['type']) {
     case 'noaction':
         break;
     case 'event':
         $datelabel = strftime('%x %H:%M', $action['time']);
         $row['prev_action'] = "<a href=\"{$salesproject_url}#{$action['obj']->guid}\" class=\"event\">{$datelabel}: {$action['obj']->title}</a>";
         break;
     case 'task':
         $datelabel = strftime('%x', $action['time']);
         $row['prev_action'] = "<a href=\"{$salesproject_url}#{$action['obj']->guid}\" class=\"task\">{$datelabel}: {$action['obj']->title}</a>";
         break;
 }
 $row['next_action'] = '';
示例#8
0
文件: list.php 项目: nemein/openpsa
 public function get_row(midcom_core_dbaobject $invoice)
 {
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     $entry = array();
     $number = $invoice->get_label();
     $link_html = "<a href='{$prefix}invoice/{$invoice->guid}/'>" . $number . "</a>";
     if ($number == "") {
         $number = "n/a";
     }
     $entry['id'] = $invoice->id;
     $entry['index_number'] = $number;
     $entry['number'] = $link_html;
     if (!is_a($this->_customer, 'org_openpsa_contacts_group_dba')) {
         try {
             $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer);
             $entry['customer'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$customer->guid}/\">" . $customer->get_label() . "</a>";
         } catch (midcom_error $e) {
             $entry['customer'] = '';
         }
     }
     if (!is_a($this->_customer, 'org_openpsa_contacts_person_dba')) {
         try {
             $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact);
             $entry['contact'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$contact->guid}/\">" . $contact->get_label() . "</a>";
         } catch (midcom_error $e) {
             $entry['contact'] = '';
         }
     }
     if (!empty($this->_request_data['deliverable'])) {
         $constraints = array('invoice' => $invoice->id, 'deliverable' => $this->_request_data['deliverable']->id);
         $item_sum = org_openpsa_invoices_invoice_item_dba::get_sum($constraints);
         $this->_request_data['totals']['deliverable'] += $item_sum;
         $entry['index_item_sum'] = $item_sum;
         $entry['item_sum'] = '<span title="' . $this->_l10n->get('sum including vat') . ': ' . org_openpsa_helpers::format_number($item_sum / 100 * $invoice->vat + $item_sum) . '">' . org_openpsa_helpers::format_number($item_sum) . '</span>';
     }
     $entry['index_sum'] = $invoice->sum;
     $entry['sum'] = '<span title="' . $this->_l10n->get('sum including vat') . ': ' . org_openpsa_helpers::format_number($invoice->sum / 100 * $invoice->vat + $invoice->sum) . '">' . org_openpsa_helpers::format_number($invoice->sum) . '</span>';
     $entry['due'] = '';
     if ($invoice->due > 0) {
         $entry['due'] = strftime('%Y-%m-%d', $invoice->due);
     }
     $colname = 'action';
     if ($this->_list_type == 'paid') {
         $colname = 'paid';
     }
     $entry[$colname] = $this->_master->render_invoice_actions($invoice);
     return $entry;
 }
示例#9
0
    echo org_openpsa_helpers::format_number($invoice->sum / 100 * $invoice->vat + $invoice->sum);
    ?>
</td>
           </tr>
        </tfoot>
        <tbody>
        <?php 
    $invoice_sum = 0;
    foreach ($data['invoice_items'] as $item) {
        echo "<tr class='invoice_item_row'>";
        echo "<td>";
        echo $item->render_link();
        echo "</td>";
        echo "<td class='numeric'>" . org_openpsa_helpers::format_number($item->pricePerUnit) . "</td>";
        echo "<td class='numeric'>" . $item->units . "</td>";
        echo "<td class='numeric'>" . org_openpsa_helpers::format_number($item->units * $item->pricePerUnit) . "</td>";
        echo "</tr>\n";
        $invoice_sum += $item->units * $item->pricePerUnit;
    }
    ?>
        </tbody>

        </table>
        <?php 
}
if ($view['files'] != "") {
    ?>
        <p><strong><?php 
    echo $data['l10n']->get('files');
    ?>
</strong></p>