Use Account structure in ImportEngine instead of simply id for unresolved accounts (more information can be given)
Remove "Operating expenses" default category and add "Car" in replacement
This commit is contained in:
@@ -66,10 +66,11 @@ ImportPanel::ImportPanel(KissCount* kiss, wxUI *parent) : KissPanel(kiss, parent
|
||||
vbox->Add(hbox, 0);
|
||||
|
||||
_accountsGrid = new wxGrid(this, wxID_ANY);
|
||||
_accountsGrid->CreateGrid(0, 2);
|
||||
_accountsGrid->CreateGrid(0, 3);
|
||||
_accountsGrid->SetRowLabelSize(0);
|
||||
_accountsGrid->SetColLabelValue(0, _("File account"));
|
||||
_accountsGrid->SetColLabelValue(1, _("Internal account"));
|
||||
_accountsGrid->SetColLabelValue(1, _("Account name"));
|
||||
_accountsGrid->SetColLabelValue(2, _("Internal account"));
|
||||
_accountsGrid->Fit();
|
||||
|
||||
wxStaticBoxSizer* staticBoxSizer = new wxStaticBoxSizer (staticAccount, wxVERTICAL);
|
||||
@@ -134,7 +135,7 @@ void ImportPanel::OnFileEnter(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void ImportPanel::ProcessFile()
|
||||
{
|
||||
std::vector<wxString> accounts;
|
||||
std::vector<Account> accounts;
|
||||
User* user = _kiss->GetUser();
|
||||
int i;
|
||||
wxGridCellChoiceEditor* accountEditor;
|
||||
@@ -174,16 +175,16 @@ void ImportPanel::ProcessFile()
|
||||
|
||||
_buttonLoadOperations->Enable();
|
||||
|
||||
// std::cout << "Insert " << accounts.size() << " rows\n";
|
||||
_accountsGrid->AppendRows(accounts.size());
|
||||
|
||||
for (i=0; i<(int)accounts.size(); i++)
|
||||
{
|
||||
_accountsGrid->SetCellValue(i, 0, accounts[i]);
|
||||
_accountsGrid->SetCellValue(i, 0, accounts[i].number);
|
||||
_accountsGrid->SetReadOnly(i, 0);
|
||||
_accountsGrid->SetCellValue(i, 1, userAccounts[0]);
|
||||
_accountsGrid->SetCellValue(i, 1, accounts[i].name);
|
||||
_accountsGrid->SetCellValue(i, 2, userAccounts[0]);
|
||||
|
||||
_accountsGrid->SetCellEditor(i, 1, accountEditor);
|
||||
_accountsGrid->SetCellEditor(i, 2, accountEditor);
|
||||
}
|
||||
|
||||
_accountsGrid->AutoSize();
|
||||
@@ -212,7 +213,7 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event))
|
||||
nbAccounts = 0;
|
||||
for(i=0; i<_accountsGrid->GetNumberRows(); i++)
|
||||
{
|
||||
if (_accountsGrid->GetCellValue(i, 1) == _("Create one"))
|
||||
if (_accountsGrid->GetCellValue(i, 2) == _("Create one"))
|
||||
nbAccounts++;
|
||||
}
|
||||
|
||||
@@ -227,9 +228,12 @@ void ImportPanel::OnLoadOperations(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
for(i=0; i<_accountsGrid->GetNumberRows(); i++)
|
||||
{
|
||||
if (_accountsGrid->GetCellValue(i, 1) == _("Create one"))
|
||||
if (_accountsGrid->GetCellValue(i, 2) == _("Create one"))
|
||||
{
|
||||
account.name = _accountsGrid->GetCellValue(i, 0);
|
||||
if (_accountsGrid->GetCellValue(i, 1).Length())
|
||||
account.name = _accountsGrid->GetCellValue(i, 1);
|
||||
else
|
||||
account.name = _accountsGrid->GetCellValue(i, 0);
|
||||
account.number = _accountsGrid->GetCellValue(i, 0);
|
||||
account.shared = false;
|
||||
account.blocked = false;
|
||||
|
Reference in New Issue
Block a user