Exemplo n.º 1
0
void clientMenu(Client *clients, Order *orders, Product *products,
        int *clientCount, int *orderCounts, int *productCount) {
    int op, posLogged = 0;
    posLogged = loginClient(clients, clientCount);
    if (posLogged != EOF) {
        do {
            clientMenuPrint();
            readInt(&op, MENU_OPT_MIN, MENU_OPT_MAX, MENU_MSG_OPT);
            switch (op) {
                case 0: //exit
                    break;
                case 1:
                    cleanScreen();
                    listProducts(products, productCount);
                    break;
                case 2:
                    cleanScreen();
                    addOrder(orders, orderCounts, products, productCount, clients[posLogged].bi);
                    break;
                case 3:
                    cleanScreen();
                    listMyOrders(orders, orderCounts, clients[posLogged].bi);
                    removeOrderClient(orders, orderCounts, clients[posLogged].bi);
                    break;
                case 4: //
                    cleanScreen();
                    listMyClient(clients[posLogged]);
                    printf("\n\n");
                    break;
                case 5: //
                    cleanScreen();
                    editClient(clients, clientCount, posLogged);
                    printf("\n\n");
                    break;
                case 6: //
                    cleanScreen();
                    listMyOrders(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                case 7: //
                    cleanScreen();
                    listMyOrdersPendingApproval(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                case 8: //
                    cleanScreen();
                    listMyOrdersPendingDelivery(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                default:
                    printf(MENU_MSG_OPT_INVALID);
            }
        } while (op != 0);
    }
}
Exemplo n.º 2
0
void ClientWidget::loadUi()
{
	splitter->setStretchFactor(0, 1);
	setIcon( QString(":/TransactionRecord/Resources/clients.png") );
	setName( "ClientWidget" );

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

	QStringList cList;
	cList << tr("id") << tr("Name") << tr("Phone") << tr("Phone 2") << tr("Fax") << tr("Mail") << tr("ICQ") << tr("Other");
	clientTable->createColumns( cList );

	QStringList aList;
	aList << tr("id") << tr("Number") << tr("Currency") << tr("Saldo");
	accountTable->createColumns( aList );
	accountTable->setColumnForDouble(3);

	createSortConnection( clientTable );

	//------------------------------------------
	newClientAction = new QAction( this );
	newClientAction->setText( tr("New client") );
	newClientAction->setIcon( QIcon(":/TransactionRecord/Resources/client_add.png") );
	newClientAction->setShortcut( tr("Ctrl+N") );
	
	editClientAction = new QAction( this );
	editClientAction->setText( tr("Edit client") );
	editClientAction->setIcon( QIcon(":/TransactionRecord/Resources/edit.png") );
	editClientAction->setShortcut( tr("Ctrl+E") );

	removeClientAction = new QAction( this );
	removeClientAction->setText( tr("Delete client") );
	removeClientAction->setShortcut( tr("Del") );

	newClientAccountAction = new QAction( this );
	newClientAccountAction->setText( tr("New client account") );
	newClientAccountAction->setShortcut( tr("Ctrl+Shift+N") );

	removeClientAccountAction = new QAction( this );
	removeClientAccountAction->setText( tr("Delete client account") );
	removeClientAccountAction->setShortcut( tr("Ctrl+Del") );

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

	toolBar->addAction( newClientAction, 1 );
	toolBar->addAction( editClientAction, 1 );
	toolBar->addAction( removeClientAction, 0, 1 );
	toolBar->addAction( newClientAccountAction, 1 );
	toolBar->addAction( removeClientAccountAction, 0, 1 );
	toolBar->addAction( reloadAction, 1 );

	connect( newClientAction, SIGNAL( triggered() ), this, SLOT( newClient() ) );
	connect( editClientAction, SIGNAL( triggered() ), this, SLOT( editClient() ) );
	connect( newClientAccountAction, SIGNAL( triggered() ), this, SLOT( newClientAccount() ) );
	connect( removeClientAccountAction, SIGNAL( triggered() ), this, SLOT( removeClientAccount() ) );
	connect( removeClientAction, SIGNAL( triggered() ), this, SLOT( removeClientRequest() ) );
	connect( reloadAction, SIGNAL( triggered() ), this, SLOT( reload() ) );

	connect( allRadioButton, SIGNAL( clicked() ), this, SLOT( reload() ) );
	connect( clientsRadioButton, SIGNAL( clicked() ), this, SLOT( reload() ) );

	connect( clientTable, SIGNAL( rowSelected(int) ), this, SLOT( enableActions() ) );
	connect( clientTable, SIGNAL( rowSelected(int) ), this, SLOT( accountRequest(int) ) );
	connect( clientTable, SIGNAL( cellDoubleClicked(int, int) ), this, SLOT( editClient() ) );

	connect( accountTable, SIGNAL( cellDoubleClicked( int, int ) ), this, SLOT( doubleClicked( int, int ) ) );
	connect( accountTable, SIGNAL( rowSelected(int) ), this, SLOT( enableActions() ) );

	connect( qApp, SIGNAL( focusChanged(QWidget *, QWidget *) ), this, SLOT( changeFocus(QWidget *, QWidget *) ) );
}