reprintInvoices::reprintInvoices(QWidget    *parent,
                                 const char *name,
                                 bool        modal,
                                 Qt::WFlags  fl)
    : reprintMulticopyDocument("InvoiceCopies",     "InvoiceWatermark",
                               "InvoiceShowPrices",
                               parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  list()->addColumn(tr("Invoice #"),      _orderColumn, Qt::AlignRight, true, "docnumber");
  list()->addColumn(tr("Doc. Date"),       _dateColumn, Qt::AlignCenter,true, "invchead_invcdate");
  list()->addColumn(tr("Cust. #"),                  -1, Qt::AlignLeft,  true, "cust_number");
  list()->addColumn(tr("Customer"),                 -1, Qt::AlignLeft,  true, "cust_name");
  list()->addColumn(tr("Total Amount"),_bigMoneyColumn, Qt::AlignRight, true, "extprice" );
  list()->addColumn(tr("Balance"),     _bigMoneyColumn, Qt::AlignRight, true, "balance" );
  list()->addColumn(tr("Report"),                   -1, Qt::AlignLeft,  false,"reportname");

  QString      errmsg;
  bool         ok  = false;
  MetaSQLQuery mql = MQLUtil::mqlLoad("invoices", "detail", errmsg, &ok);
  if (! ok)
    ErrorReporter::error(QtCriticalMsg, this, tr("Error Getting Invoices"),
                         errmsg, __FILE__, __LINE__);

  setDoctype("IN");
  setReportKey("invchead_id");
  _docListQueryString = mql.getSource();
}
示例#2
0
printInvoices::printInvoices(QWidget *parent, const char *name, bool modal, Qt::WFlags fl)
    : printMulticopyDocument("InvoiceCopies",     "InvoiceWatermark",
                             "InvoiceShowPrices", "PostMiscInvoices",
                             parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  setDoctype("IN");
  setReportKey("invchead_id");
  _distributeInventory = true;

  _shipvia->populate( "SELECT MIN(invchead_id), invchead_shipvia "
                      "  FROM invchead "
                      " WHERE ( (NOT invchead_printed)"
                      "   AND   (NOT invchead_posted) )"
                      " GROUP BY invchead_shipvia"
                      " ORDER BY invchead_shipvia;" );

  QString      errmsg;
  bool         ok  = false;
  MetaSQLQuery mql = MQLUtil::mqlLoad("invoices", "print", errmsg, &ok);
  if (ok)
    _docinfoQueryString = mql.getSource();
  else
    ErrorReporter::error(QtCriticalMsg, this, tr("Getting Invoices to Print"),
                         errmsg, __FILE__, __LINE__);

  _markAllPrintedQry = "UPDATE invchead"
                       "   SET invchead_printed=TRUE "
                       " WHERE invchead_id IN ("
                       "<? foreach('printedDocs') ?>"
                       "  <? if not isfirst('printedDocs') ?>, <? endif ?>"
                       "  <? value('printedDocs') ?>"
                       "<? endforeach ?>"
                       ");" ;
              
  _postFunction = "postInvoice";
  _postQuery    = "SELECT postInvoice(<? value('docid') ?>) AS result;" ;

  _askBeforePostingQry = "SELECT invoiceTotal(<? value('docid') ?>) = 0 AS ask;" ;
  _askBeforePostingMsg = tr("<p>Invoice %1 has a total value of 0.<br/>"
                            "Would you like to post it anyway?</p>");

  _errCheckBeforePostingQry =
         "SELECT EXISTS(SELECT *"
         "                FROM curr_rate, invchead "
         "               WHERE ((curr_id=invchead_curr_id)"
         "                 AND  (invchead_invcdate BETWEEN curr_effective AND curr_expires)"
         "                 AND  (invchead_id=<? value('docid') ?>))) AS ok;" ;
  _errCheckBeforePostingMsg =
          tr("Could not post Invoice %1 because of a missing exchange rate.");

  connect(this, SIGNAL(aboutToStart(XSqlQuery*)), this, SLOT(sHandleAboutToStart(XSqlQuery*)));
  connect(this, SIGNAL(finishedWithAll()),        this, SLOT(sHandleFinishedWithAll()));
}
printStatementsByCustomerType::printStatementsByCustomerType(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : printSinglecopyDocument(parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  _asOf->setDate(omfgThis->dbDate(), true);
  _customerTypes->setType(ParameterGroup::CustomerType);
  if (_preferences->boolean("XCheckBox/forgetful"))
    _dueonly->setChecked(true);
  setPrintEnabled(true);

  setDoctype("AR");
  setReportKey("cust_id");

  bool    ok = false;
  QString msg;
  MetaSQLQuery custm = MQLUtil::mqlLoad("customers", "statement", msg, &ok);
  if (ok)
    _docinfoQueryString = custm.getSource();
  else
    ErrorReporter::error(QtCriticalMsg, this, tr("Getting Customers to Print"),
                         msg, __FILE__, __LINE__);
}