Example #1
0
reprintCreditMemos::reprintCreditMemos(QWidget    *parent,
                                       const char *name,
                                       bool        modal,
                                       Qt::WFlags  fl)
    : reprintMulticopyDocument("CreditMemoCopies",     "CreditMemoWatermark",
                               "CreditMemoShowPrices", parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  list()->addColumn(tr("C/M #"),    _orderColumn, Qt::AlignRight, true,  "docnumber");
  list()->addColumn(tr("Doc. Date"), _dateColumn, Qt::AlignCenter,true,  "cmhead_docdate");
  list()->addColumn(tr("Cust. #"),            -1, Qt::AlignLeft,  true,  "cust_number");
  list()->addColumn(tr("Customer"),           -1, Qt::AlignLeft,  true,  "cust_name");
  list()->addColumn(tr("Report"),             -1, Qt::AlignLeft,  false, "reportname");

  _docListQueryString = "SELECT cmhead_id, cust_id,"
                        "      cmhead_number AS docnumber, cmhead_docdate,"
                        "      cust_number, cust_name,"
                        "      findCustomerForm(cust_id, 'C') AS reportname"
                        "  FROM cmhead"
                        "  JOIN custinfo ON (cmhead_cust_id=cust_id)"
                        " WHERE checkCreditMemoSitePrivs(cmhead_id)"
                        " ORDER BY cmhead_docdate DESC;" ;
  setDoctype("CM");
  setReportKey("cmhead_id");

  sPopulate();
}
Example #2
0
printPurchaseOrder::printPurchaseOrder(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : printMulticopyDocument("POCopies",     "POWatermark",
                             "POShowPrices", "",
                             parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  setDoctype("PO");
  setReportKey("pohead_id");

  _docinfoQueryString =
         "SELECT pohead_id       AS docid, pohead_id,"
         "       pohead_number   AS docnumber,"
         "       pohead_printed  AS printed,"
         "       false           AS posted,"
         "       'PurchaseOrder' AS reportname,"
         "       pohead_saved"
         "  FROM pohead"
         " WHERE (pohead_id=<? value('docid') ?>);" ;

  _markOnePrintedQry = "UPDATE pohead"
                       "   SET pohead_printed=TRUE "
                       " WHERE (pohead_id=<? value('docid') ?>);" ;

  connect(_po,  SIGNAL(newId(int, QString)),   this, SLOT(setId(int)));
  connect(this, SIGNAL(docUpdated(int)),       this, SLOT(sHandleDocUpdated(int)));
  connect(this, SIGNAL(populated(XSqlQuery*)), this, SLOT(sHandlePopulated(XSqlQuery*)));
}
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();
}
printQuote::printQuote(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : printSinglecopyDocument(parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());
  
  setDoctype("QT");
  setReportKey("quhead_id");

  _docinfoQueryString = "SELECT quhead_id AS docid, quhead_id,"
                        "       quhead_number AS docnumber,"
                        "       false         AS printed,"
                        "<? if exists('reportname') ?>"
                        "       <? value('reportname') ?>"
                        "<? else ?>"
                        "       findCustomerForm(quhead_cust_id, 'Q')"
                        " <? endif ?> AS reportname"
                        "  FROM quhead"
                        " WHERE (quhead_id=<? value('docid') ?>);" ;

  connect(_quote,          SIGNAL(newId(int)), this, SLOT(sHandleNewQuoteId()));
  connect(_report,         SIGNAL(newID(int)), this, SLOT(sHandleButtons()));
  connect(this,     SIGNAL(finishedWithAll()), this, SLOT(sFinishedWithAll()));
  connect(this, SIGNAL(populated(XSqlQuery*)), this, SLOT(sPopulate(XSqlQuery*)));
}
Example #5
0
printPoForm::printPoForm(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
  : printSinglecopyDocument(parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  setDoctype("PO");
  setReportKey("pohead_id");

  _docinfoQueryString = "SELECT pohead_id      AS docid, pohead_id,"
                        "       pohead_number  AS docnumber,"
                        "       pohead_printed AS printed,"
                        "<? if exists('reportname') ?>"
                        "       (SELECT form_report_name"
                        "          FROM form"
                        "         WHERE ((form_name=<? value('reportname') ?>)"
                        "            AND (form_key='PO')))"
                        "<? else ?>"
                        "       COALESCE((SELECT MIN(form_report_name)"
                        "                   FROM form WHERE (form_key='PO')),"
                        "                'PurchaseOrder')"
                        "<? endif ?> AS reportname"
                        "  FROM pohead"
                        " WHERE (pohead_id=<? value('docid') ?>);" ;

  _report->populate( "SELECT form_id, form_name, form_name "
                     "FROM form "
                     "WHERE (form_key='PO') "
                     "ORDER BY form_name;" );

  connect(_po,    SIGNAL(newId(int, QString)), this, SLOT(sHandleNewOrderId()));
  connect(_report,         SIGNAL(newID(int)), this, SLOT(sHandleButtons()));
  connect(this,     SIGNAL(finishedWithAll()), this, SLOT(sFinishedWithAll()));
  connect(this, SIGNAL(populated(XSqlQuery*)), this, SLOT(sPopulate(XSqlQuery*)));
}
Example #6
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()));
}
printShippingForms::printShippingForms(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : printMulticopyDocument("ShippingFormCopies",     "ShippingFormWatermark",
                             "ShippingFormShowPrices", "",
                             parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  setDoctype("P");
  setReportKey("shiphead_id");
  _distributeInventory = false;

  if (_preferences->boolean("XCheckBox/forgetful"))
  {
    _printNew->setChecked(true);
    _printDirty->setChecked(true);
  }

  // TODO: tohead?
  _docinfoQueryString =
             "SELECT shiphead_id               AS docid,"
             "       shiphead_number           AS docnumber,"
             "       (shiphead_sfstatus = 'P') AS printed,"
             "       NULL                      AS posted,"
             "       shipform_report_name      AS reportname,"
             "       shiphead_id, shiphead_shipchrg_id"
             "  FROM shiphead"
             "     JOIN cohead   ON (shiphead_order_id=cohead_id"
	     "                   AND shiphead_order_type='SO')"
             "     JOIN shipform ON (shipform_id=COALESCE(shiphead_shipform_id,"
             "                                            cohead_shipform_id))"
             " WHERE NOT shiphead_shipped"
             "<? if exists('printFlags') ?>"
             "   AND (shiphead_sfstatus IN ("
             "    <? foreach('printFlags') ?>"
             "      <? if not isfirst('printFlags') ?> , <? endif ?>"
             "      <? value('printFlags') ?>"
             "    <? endforeach ?>"
             "    ))"
             "<? endif ?>"
             " ORDER BY shiphead_id;" ;

  _markOnePrintedQry = "UPDATE shiphead"
                       "   SET shiphead_sfstatus='P'"
                       " WHERE (shiphead_id=<? value('docid') ?>);" ;
}
Example #8
0
printApOpenItem::printApOpenItem(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : printSinglecopyDocument(parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  _docinfoQueryString = "SELECT apopen_id        AS docid, apopen_id,"
                        "       apopen_docnumber AS docnumber,"
                        "       false            AS printed,"
                        "       'APOpenItem'     AS reportname,"
                        "       apopen_doctype"
                        "  FROM apopen"
                        " WHERE (apopen_id=<? value('docid') ?>);" ;
  setReportKey("apopen_id");

  connect(_apopen,        SIGNAL(valid(bool)), this, SLOT(setPrintEnabled(bool)));
  connect(this, SIGNAL(populated(XSqlQuery*)), this, SLOT(sPopulate(XSqlQuery*)));
}
printCreditMemos::printCreditMemos(QWidget* parent, const char* name, bool modal, Qt::WFlags fl)
    : printMulticopyDocument("CreditMemoCopies",     "CreditMemoWatermark",
                             "CreditMemoShowPrices", "PostARDocuments",
                             parent, name, modal, fl)
{
  setupUi(optionsWidget());
  setWindowTitle(optionsWidget()->windowTitle());

  setDoctype("CM");
  setReportKey("cmhead_id");
  _distributeInventory = true;

  _docinfoQueryString =
             "SELECT cmhead_id      AS docid,"
             "       cmhead_number  AS docnumber,"
             "       cmhead_printed AS printed,"
             "       cmhead_posted  AS posted,"
             "       cmhead_cust_id,"
             "       findCustomerForm(cmhead_cust_id, 'C') AS reportname"
             "  FROM cmhead "
             " WHERE (NOT cmhead_hold"
             "    AND NOT COALESCE(cmhead_printed, false)"
             "    AND checkCreditMemoSitePrivs(cmhead_id));" ;

  _markAllPrintedQry = "UPDATE cmhead"
                       "   SET cmhead_printed=TRUE "
                       " WHERE cmhead_id IN ("
                       "<? foreach('printedDocs') ?>"
                       "  <? if not isfirst('printedDocs') ?>, <? endif ?>"
                       "  <? value('printedDocs') ?>"
                       "<? endforeach ?>"
                       ");" ;
              
  _postFunction = "postCreditMemo";
  _postQuery    = "SELECT postCreditMemo(<? value('docid') ?>, 0) AS result;" ;

  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__);
}