typedef struct tagCMA_PACKAGE {
CHAR szName[51];
CHAR szSearchFilename[13];
INT nEntryStampType;
INT nEntryStringStampLength1;
INT nEntryStringStampLength2;
INT nInvoiceType;
DWORD dwCMAVersion;
INT nOrgUpdateMethod;
INT nContactUpdateMethod;
INT nInvoiceUpdateMethod;
INT nPaymentUpdateMethod;
INT nProductUpdateMethod;
} CMA_PACKAGE;
typedef struct tagCMA_CTRLINFO {
CHAR szDataPath[256];
CHAR szCompanyName[41];
} CMA_CTRLINFO;
typedef struct tagCMA_CTRLINFO {
HWND hwndParent;
DWORD dwUser;
DWORD dwCurrencyCode;
CHAR szDescription[256];
CHAR szDataPath[256];
SYSTEMTIME stFiscalYearEnd;
BOOL fDualCurrency;
SYSTEMTIME stDateModified;
CHAR szCompanyName[41];
} CMA_CTRLINFO;
typedef struct tagCMA_STREETADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szStreet1[101];
CHAR szStreet2[101];
CHAR szPOBox[51];
CHAR szCity[51];
CHAR szState[51];
CHAR szRegion[51];
CHAR szCountry[51];
CHAR szPostalCode[51];
} CMA_STREETADDRESS;
typedef struct tagCMA_PHONENUMBER {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szNumber[51];
} CMA_PHONENUMBER;
typedef struct tagCMA_WEBADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szAddress[1025];
} CMA_WEBADDRESS;
typedef struct tagCMA_ORGANIZATION {
LONG lOrganizationCount;
CHAR szOrganizationID[51];
INT nOrganizationType;
CHAR szOrganizationName[51];
} CMA_ORGANIZATION;
typedef struct tagCMA_STREETADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szStreet1[101];
CHAR szStreet2[101];
CHAR szPOBox[51];
CHAR szCity[51];
CHAR szState[51];
CHAR szRegion[51];
CHAR szCountry[51];
CHAR szPostalCode[51];
} CMA_STREETADDRESS;
typedef struct tagCMA_PHONENUMBER {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szNumber[51];
} CMA_PHONENUMBER;
typedef struct tagCMA_WEBADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szAddress[1025];
} CMA_WEBADDRESS;
typedef struct tag_CMA_PARTY {
CHAR szParentOrganizationID[51];
} CMA_PARTY;
typedef struct tagCMA_CONTACT {
LONG lContactCount;
CHAR szContactID[51];
INT nContactType;
CHAR szCompanyName[51];
CHAR szFullName[101];
CHAR szJobTitle[51];
CHAR szTitle[51];
} CMA_CONTACT;
typedef struct tagCMA_STREETADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szStreet1[101];
CHAR szStreet2[101];
CHAR szPOBox[51];
CHAR szCity[51];
CHAR szState[51];
CHAR szRegion[51];
CHAR szCountry[51];
CHAR szPostalCode[51];
} CMA_STREETADDRESS;
typedef struct tagCMA_PHONENUMBER {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szNumber[51];
} CMA_PHONENUMBER;
typedef struct tagCMA_WEBADDRESS {
LONG nArrayIndex;
INT nCommunicationPointType;
INT nCommunicationPointUsage;
BOOL fPrimary;
CHAR szAddress[1025];
} CMA_WEBADDRESS;
typedef struct tagCMA_INVOICEHEADER {
LONG lInvoiceCount;
CHAR szOrganizationID[51];
CHAR szInvoiceNumber[51];
LONG lInvoiceKey;
DWORD dwCurrencyCode;
BOOL fSaleInvoice;
CHAR szSalespersonID[51];
SYSTEMTIME stOrderDate;
SYSTEMTIME stInvoiceDate;
CMACY cyFreight;
CMACY cyDiscount
CMACY cyVATFederal;
CMACY cyVATProvincial;
CMACY cyVATCity;
CMACY cySalesTax;
CMACY cyTotalAmount;
BOOL fVoid;
SYSTEMTIME stDateModified;
} CMA_INVOICEHEADER;
typedef struct tagCMA_INVOICEDETAIL {
LONG lInvoiceKey;
LONG lLineNumber;
DWORD dwCurrencyCode;
CHAR szProductID[31];
DOUBLE dQuantity;
CMACY cyFreight;
CMACY cyDiscount;
CMACY cyVATFederal;
CMACY cyVATProvincial;
CMACY cyVATCity;
CMACY cySalesTax;
CMACY cyTotalAmount;
CMACY cyUnitCost;
SYSTEMTIME stDateModified;
} CMA_INVOICEDETAIL;
typedef struct tagCMA_PRODUCTINFO {
LONG lProductCount;
CHAR szProductID[31];
CHAR szProductName[31];
BOOL fInventoryItem;
SYSTEMTIME stDateModified;
} CMA_PRODUCTINFO;
The Import Wizard is structured to allow you to use a different update method for each type of Customer Manager information.
For invoice information, the update method is selected based on the value of the nInvoiceUpdateMethod member of the CMA_PACKAGE structure. If nInvoiceUpdateMethod is set to UPDATEMETHOD_DATE, the Import Wizard reads each lInvoiceKey member in the CMA_INVOICEHEADER structure. The Import Wizard determines the following: 1) whether this record already exists in the database from a previous import, and 2) whether there have been any modifications to the record based on the value in the stDateModified member of CMA_INVOICEHEADER. If the record already exists, and the record in the filter structure has a newer stDateModified value, the filter runs a delete query based on the specified invoice key before bringing in the invoice records. In short, the filter replaces the records if there have been changes to them as indicated by the last date modified.
For instances where an invoice is deleted, the recommended process is to set the fVoid member of the CMA_INVOICEHEADER structure to True. This will set the invoice record to a void state. However, if the import filter cannot determine if any invoices have been deleted or modified, the filter performs a complete import every time by setting the nInvoiceUpdateMethod member of the CMA_PACKAGE structure to UPDATEMETHOD_NONE.
For payment information, the update method is selected based on the value of the nPaymentUpdateMethod member of the CMA_PACKAGE structure. If nPaymentUpdateMethod is set to UPDATEMETHOD_DATE, the Import Wizard reads each lInvoiceKey member in the CMA_PAYMENTDETAIL structure. The Import Wizard determines the following: 1) whether this record already exists in the database from a previous import, and 2) whether there have been any modifications to the record based on the value in the stDateModified member of CMA_PAYMENTDETAIL. If the record already exists and the record in the filter structure has a newer stDateModified value, the filter will run a delete query based on the specified invoice key before bringing in the invoice records. In short, the filter replaces the records if there have been changes to them as indicated by the last date modified.
If the import filter cannot determine if any payments have been deleted or modified, the filter performs a complete import every time by setting the nPaymentUpdateMethod member of the CMA_PACKAGE structure to UPDATEMETHOD_NONE.
For contact information, the update method is selected based on the value of the nContactUpdateMethod member of the CMA_PACKAGE structure. If nContactUpdateMethod is set to UPDATEMETHOD_DATE, the Import Wizard reads each szContactID member in the CMA_CONTACT structure. The Import Wizard determines the following: 1) whether this record already exists in the database from a previous import, and 2) whether there have been any modifications to the record based on the value in the stDateModified member of CMA_PARTY. If the record already exists and the record in the filter structure has a newer stDateModified value, the filter will run a delete query based on the specified contact ID before bringing in the contact record. In short, the filter replaces the records if there have been changes to them as indicated by the last date modified.
For instances where a contact is deleted or set to inactive, the recommended process is to set the nStatus member of the CMA_PARTY structure to PARTYSTATUS_INACTIVE. However, if the import filter cannot determine if any contacts have been deleted or modified, the filter performs a complete import every time by setting the nContactUpdateMethod member of the CMA_PACKAGE structure to UPDATEMETHOD_NONE.
For contact information, the update method is selected based on the value of the nOrgUpdateMethod member of the CMA_PACKAGE structure. If nOrgUpdateMethod is set to UPDATEMETHOD_DATE, the Import Wizard reads each szOrganizationID member in the CMA_ORGANIZATION structure. The Import Wizard determines the following: 1) whether this record already exists in the database from a previous import, and 2) whether there have been any modifications to the record based on the value in the stDateModified member of CMA_PARTY. If the record already exists and the record in the filter structure has a newer stDateModified value, the filter will run a delete query based on the specified organization ID before bringing in the organization record. In short, the filter replaces the records if there have been changes to them as indicated by the last date modified.
For instances where an organization is deleted or set to inactive, the recommended process is to set the nStatus member of the CMA_PARTY structure to PARTYSTATUS_INACTIVE. However, if the import filter cannot determine if any contacts have been deleted or modified, the filter performs a complete import every time by setting the nOrgUpdateMethod member of the CMA_PACKAGE structure to UPDATEMETHOD_NONE.
For contact information, the update method is selected based on the value of the nProductUpdateMethod member of the CMA_PACKAGE structure. If nProductUpdateMethod is set to UPDATEMETHOD_DATE, the Import Wizard reads each szProductID member in the CMA_PRODUCTINFO structure. The Import Wizard determines the following: 1) whether this record already exists in the database from a previous import, and 2) whether there have been any modifications to the record based on the value in the stDateModified member of CMA_PRODUCTINFO. If the record already exists and the record in the filter structure has a newer stDateModified value, the filter will run a delete query based on the specified organization ID before bringing in the organization record. In short, the filter replaces the records if there have been changes to them as indicated by the last date modified.
For instances where an organization is deleted, the recommended process is to set the fDiscontinued member of the CMA_PRODUCTINFO structure to False. However, if the import filter cannot determine if any products have been deleted or modified, the filter performs a complete import every time by setting the nProductUpdateMethod member of the CMA_PACKAGE structure to UPDATEMETHOD_NONE.
These update methods cover most situations, but they may not be suitable for determining incremental update information to pass to the filter for your application. In such a case, you need to implement a method for determining incremental update information within the filter. Methods can include storing pertinent information in the accounting application's data or in the Windows registry.
The szPaymentNumber and lPaymentKey members of CMA_PAYMENTDETAIL and CMA_DUEDATEDETAIL serve the same purposes as szInvoiceNumber and lInvoiceKey on the settlement side of the invoice transaction (when the invoice is paid).
DueDate | Amount |
date1 | 100 |
date2 | 110 |
Payment | Amount |
payment1 | 50 |
payment2 | 150 |
In th example above, payment1 and part of payment2 apply to date1, and the remainder of payment2 applies to the remainder of date1 and part of date2. A third table links payments to due dates as follows:
LinkNumber | DueDateNumber | PaymentNumber |
link1 | date1 | payment1 |
link2 | date1 | payment2 |
link3 | date2 | payment2 |
In this way, each link connects one payment to one due date. The data in this table can be used to fill the CMA_PAYMENTDETAIL structures. In other words, payments are split across all the pertinent due dates.
The approach in this SDK to handling multiple currency information is to require that any information that has a currency amount be duplicated to handle the amount in different currencies. The following example uses the CMA_INVOICEHEADER structure, assuming the source system tracks invoices in both French Francs and Euros.
Invoice # 101 Total Amount 1,000 FF Total Amount 166 Euro
The filter process will pass two lines of data during the CMA_LoadInvoiceHeader function for this one invoice. The first line will include the details of the invoice header with the amount of 1000.00 and the dwCurrencyCode member set to CMACYID_FRANCE. The second line will include the same details of the invoice header, except that the amount will be 166.00 and the dwCurrencyCode member will be set to CMACYID_EURO. So, in essence, the SBCM database will contain lines that are duplicated except for the dwCurrencyCode value and the amount.
Note If fDualCurrency is True, the value of CMA_CTRLINFO.dwCurrencyCode is considered to be the default currency and other currencies will be read from CMA_INVOICEHEADER.dwCurrencyCode. If fDualCurrency is False, set all dwCurrencyCode members to zero or the applicable currency code as defined in aacommon.h.