void ContractorWidget::loadUi()
{
	splitter->setStretchFactor(0, 1);
	setIcon( QString(":/TransactionRecord/Resources/contractors.png") );
	setName( "ContractorWidget" );

	// --------------------------------------------------------

	QStringList list;
	list << tr("id") << tr("Title");
	contractorTable->createColumns( list );
	contractorTable->setAlignRight(false);

	QStringList list1;
	list1 << tr("id") << tr("Number") << tr("Currency");
	accountTable->createColumns( list1 );

	createSortConnection( contractorTable );

	// --------------------------------------------------------

	newContractorAction = new QAction( this );
	newContractorAction->setText( tr("New contractor") );
	newContractorAction->setIcon( QIcon(":/TransactionRecord/Resources/filenew.png") );
	newContractorAction->setShortcut( tr("Ctrl+N") );

	editContractorAction = new QAction( this );
	editContractorAction->setText( tr("Edit contractor") );
	editContractorAction->setIcon( QIcon(":/TransactionRecord/Resources/edit.png") );
	editContractorAction->setShortcut( tr("Ctrl+E") );

	removeContractorAction = new QAction( this );
	removeContractorAction->setText( tr("Delete contractor") );
	removeContractorAction->setShortcut( tr("Del") );

	reloadAction = new QAction( this );
	reloadAction->setText( tr("Reload") );
	reloadAction->setIcon( QIcon(":/TransactionRecord/Resources/reload.png") );
	reloadAction->setShortcut( tr("Ctrl+R") );

	toolBar->addAction( newContractorAction, 1 );
	toolBar->addAction( editContractorAction, 1, 1 );
	toolBar->addAction( removeContractorAction, 0, 1 );
	toolBar->addAction( reloadAction, 1 );

	connect( newContractorAction, SIGNAL( triggered() ), this, SLOT( addContractor() ) );
	connect( removeContractorAction, SIGNAL( triggered() ), this, SLOT( removeContractor() ) );
	connect( editContractorAction, SIGNAL( triggered() ), this, SLOT( editContractor() ) );
	connect( reloadAction, SIGNAL( triggered() ), this, SLOT( reload() ) );

        connect( accountTable, SIGNAL( cellDoubleClicked( int, int ) ), this, SLOT( doubleClicked( int, int ) ) );
	connect( contractorTable, SIGNAL( rowSelected(int) ), this, SLOT( loadAccountRequest() ) );
	connect( contractorTable, SIGNAL( cellDoubleClicked(int, int) ), this, SLOT( editContractor() ) );
	connect( allRadioButton, SIGNAL( clicked() ), this, SLOT( reload() ) );
	connect( firmsRadioButton, SIGNAL( clicked() ), this, SLOT( reload() ) );

	connect( qApp, SIGNAL( focusChanged(QWidget *, QWidget *) ), this, SLOT( changeFocus(QWidget *, QWidget *) ) );
}
예제 #2
0
void DocumentZALController::exec(QString symbol)
{
    this->edition = true;
    this->totalFromBase=true;
    manager->getDocumentZALPolicy()->setDocumentZAL(zalService->getDocumentZAL(symbol));
    manager->getDocumentZALPolicy()->setOldDocumentZAL(manager->getDocumentZALPolicy()->getDocumentZAL());
    manager->setContractor(manager->getDocumentZALPolicy()->getDocumentZAL().getContractor());
    view->setLineDocumentSymbol(manager->getDocumentZALPolicy()->getDocumentZAL().getSymbol());
    view->getWayToPay()->setCurrentIndex(view->getWayToPay()->findData(QVariant::fromValue(manager->getDocumentZALPolicy()->getDocumentZAL().getMethodOfPayment().getId())));
    view->setLineDocumentPlace(manager->getDocumentZALPolicy()->getDocumentZAL().getDocumentPlace());
    view->setDateIssue(manager->getDocumentZALPolicy()->getDocumentZAL().getDocumentDate());
    view->setSaleOrStoreDate(manager->getDocumentZALPolicy()->getDocumentZAL().getSaleDate());
    view->setPaymentDate(manager->getDocumentZALPolicy()->getDocumentZAL().getPaymentDate());
    view->setLineDiscount(manager->getDocumentZALPolicy()->getDocumentZAL().getDiscount());
    view->setLineIssueName(manager->getDocumentZALPolicy()->getDocumentZAL().getIssueName());
    view->setLineReceiveName(manager->getDocumentZALPolicy()->getDocumentZAL().getReceiveName());
    view->setCheckPaid(manager->getDocumentZALPolicy()->getDocumentZAL().isPaid());
    if(this->symbol!="ZAL")
        view->setCheckStoreUpdate(manager->getDocumentZALPolicy()->getDocumentZAL().getStoreResult());
    if(ApplicationManager::getInstance()->containsModule(ModuleManager::Order))
        view->getLineOrderSymbol()->setText(manager->getDocumentZALPolicy()->getDocumentZAL().getOrder());
    manager->getDocumentZALPolicy()->setPreviousZAL(manager->getDocumentZALPolicy()->getDocumentZAL().getPreviousDocumentsZAL());
    manager->getDocumentZALPolicy()->setPreviousZALVector(manager->getDocumentZALPolicy()->getDocumentZAL().getPreviousDocumentsZAL());
    view->getLineDocumentSymbol()->setEnabled(false);
    this->addToTable();

    if(symbol.contains("FV"))
        view->getComboBox()->setCurrentIndex(1);
    else
        view->getComboBox()->setCurrentIndex(0);

    manager->setDocumentPositions(manager->getDocumentZALPolicy()->getDocumentZAL().getDocumentPositions());

    addGood();
    addContractor();
    if(totalFromBase==true)
    {
        view->setAdvance(manager->getDocumentZALPolicy()->getDocumentZAL().getPaidValue());
        view->setLineGoodsValue(manager->getDocumentZALPolicy()->getDocumentZAL().getTotal());
        totalFromBase=false;
    }
    if (view->exec())
    {

        getDocumentData();
        if(isChangesOccured())
        {
            zalService->editDocumentZAL(manager->getDocumentZALPolicy()->getDocumentZAL());
            this->printDoc();
            return;
        }
    }
}
예제 #3
0
void DocumentFMController::exec(QString Symbol)
{
    this->edition = true;
    this->totalFromBase=true;
    manager->getInvoicePolicy()->setInvoice(invoiceService->getInvoice(Symbol));
    manager->getInvoicePolicy()->setOldInvoice(manager->getInvoicePolicy()->getInvoice());
    view->setLineDocumentSymbol(manager->getInvoicePolicy()->getInvoice().getSymbol());
    manager->setContractor(manager->getInvoicePolicy()->getInvoice().getContractor());
    view->getWayToPay()->setCurrentIndex(view->getWayToPay()->findData(QVariant::fromValue(manager->getInvoicePolicy()->getInvoice().getMethodOfPayment().getId())));
    view->setLineDocumentPlace(manager->getInvoicePolicy()->getInvoice().getDocumentPlace());
    view->setDateIssue(manager->getInvoicePolicy()->getInvoice().getDocumentDate());
    view->setSaleOrStoreDate(manager->getInvoicePolicy()->getInvoice().getSaleDate());
    view->setPaymentDate(manager->getInvoicePolicy()->getInvoice().getPaymentDate());
    view->setLineDiscount(manager->getInvoicePolicy()->getInvoice().getDiscount());
    view->setLineIssueName(manager->getInvoicePolicy()->getInvoice().getIssueName());
    view->setLineReceiveName(manager->getInvoicePolicy()->getInvoice().getReceiveName());
    view->setCheckPaid(manager->getInvoicePolicy()->getInvoice().isPaid());
    if(ApplicationManager::getInstance()->containsModule(ModuleManager::Order))
    view->getLineOrderSymbol()->setText(manager->getInvoicePolicy()->getInvoice().getOrder());
    view->setCheckStoreUpdate(manager->getInvoicePolicy()->getInvoice().getStoreResult());
    manager->setDocumentPositions(manager->getInvoicePolicy()->getInvoice().getDocumentPositions());
    view->getLineDocumentSymbol()->setEnabled(false);
    addGood();
    addContractor();
    if(totalFromBase==true)
    {
    view->setLineGoodsValueDiscount(manager->getInvoicePolicy()->getInvoice().getTotal());
    totalFromBase=false;
    }
    if (view->exec())
    {
        getDocumentData();
        if(isChangesOccured())
        {
        invoiceService->editInvoice(manager->getInvoicePolicy()->getInvoice());
        this->printDoc();
       }
    }
}