This commit is contained in:
2022-07-04 14:05:15 +00:00
parent 0aee758735
commit 11cfe45fef
5 changed files with 375 additions and 96 deletions

View File

@@ -159,6 +159,12 @@
<Compile Include="SetQBClass.Designer.cs">
<DependentUpon>SetQBClass.cs</DependentUpon>
</Compile>
<Compile Include="SetQBImportServiceRateAccounts.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SetQBImportServiceRateAccounts.Designer.cs">
<DependentUpon>SetQBImportServiceRateAccounts.cs</DependentUpon>
</Compile>
<Compile Include="SetQBInvoiceTemplate.cs">
<SubType>Form</SubType>
</Compile>
@@ -248,6 +254,9 @@
<EmbeddedResource Include="SetQBClass.resx">
<DependentUpon>SetQBClass.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SetQBImportServiceRateAccounts.resx">
<DependentUpon>SetQBImportServiceRateAccounts.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SetQBInvoiceTemplate.resx">
<DependentUpon>SetQBInvoiceTemplate.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -115,48 +115,36 @@ namespace AyaNovaQBI
w.Ops = "Importing from QuickBooks...";
try
{
foreach (DataGridViewRow r in gridQB.SelectedRows)
{
var QBItemName = r.Cells[0].Value.ToString();
var QBItemId = r.Cells[1].Value.ToString();
w.Step = QBItemName;
switch (_Type)
{
case AyaType.Customer:
foreach (object o in moveData.Rows)
{
w.Step = ((QBNameID)o).Name;
await util.ImportQBCustomer(((QBNameID)o).ID, alErrors);
}
await util.ImportQBCustomer(QBItemId, alErrors);
break;
case AyaType.Vendor:
foreach (object o in moveData.Rows)
{
w.Step = ((QBNameID)o).Name;
Util.ImportQBVendor(((QBNameID)o).ID, this._currentVendorType, alErrors);
}
await util.ImportQBVendor(QBItemId, alErrors);
break;
case AyaType.Rate:
foreach (object o in moveData.Rows)
{
w.Step = ((QBNameID)o).Name;
Util.ImportQBRate(((QBNameID)o).ID, this._currentRateType, _MostLikelyRateUnitChargeDescriptionID, alErrors);
}
case AyaType.ServiceRate:
await util.ImportQBServiceRate(QBItemId, alErrors);
break;
case AyaType.TravelRate:
await util.ImportQBTravelRate(QBItemId, alErrors);
break;
case AyaType.Part:
foreach (object o in moveData.Rows)
{
w.Step = ((QBNameID)o).Name;
Util.ImportQBPart(((QBNameID)o).ID, alErrors);
}
await util.ImportQBPart(QBItemId, alErrors);
break;
default:
throw new System.NotSupportedException("ImportToAyaNova: NOT SUPPORTED (STUB): " + _Type.ToString());
}
}
//display errors if any
if (alErrors.Count != 0)
@@ -172,20 +160,14 @@ namespace AyaNovaQBI
}
CopyableMessageBox cb = new CopyableMessageBox(sb.ToString());
cb.ShowDialog();
}
}
catch (Exception ex)
{
w.Visible = false;
Util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:ImportToAyaNova");//case 3717
//CopyableMessageBox cb = new CopyableMessageBox("ImportToAyaNova error: \r\n" + Util.CrackException(ex));
//cb.ShowDialog();
await util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:ImportToAyaNova");
}
finally
{
@@ -208,26 +190,23 @@ namespace AyaNovaQBI
w.Ops = "Importing from AyaNova...";
try
{
bool firstPass = true;
foreach (DataGridViewRow r in gridAya.SelectedRows)
{
string AyaName = r.Cells[0].Value.ToString();
long AyaId = (long)r.Cells[1].Value;
w.Step = AyaName;
switch (_Type)
{
case AyaType.Customer:
foreach (object o in moveData.Rows)
{
w.Step = ((AyaNameID)o).Name;
util.ImportAyaClient(((AyaNameID)o).ID, alErrors);
}
await util.ImportAyaCustomer(AyaId, alErrors);
break;
case AyaType.Vendor:
foreach (object o in moveData.Rows)
{
w.Step = ((AyaNameID)o).Name;
Util.ImportAyaVendor(((AyaNameID)o).ID, alErrors);
}
await util.ImportAyaVendor(AyaId, alErrors);
break;
case AyaType.Rate:
case AyaType.ServiceRate:
{
if (firstPass)
{
SetQBImportServiceRateAccounts s = new SetQBImportServiceRateAccounts();
if (s.ShowDialog() != DialogResult.OK)
@@ -236,16 +215,30 @@ namespace AyaNovaQBI
return;
}
s.Dispose();
RatePickList rpl = RatePickList.GetList(false);
foreach (object o in moveData.Rows)
{
w.Step = ((AyaNameID)o).Name;
Util.ImportAyaRate(((AyaNameID)o).ID, rpl, alErrors);
firstPass = false;
}
await util.ImportAyaServiceRate(AyaId, alErrors);
}
break;
case AyaType.TravelRate:
{
if (firstPass)
{
SetQBImportServiceRateAccounts s = new SetQBImportServiceRateAccounts();
if (s.ShowDialog() != DialogResult.OK)
{
s.Dispose();
return;
}
s.Dispose();
firstPass = false;
}
await util.ImportAyaTravelRate(AyaId, alErrors);
}
break;
case AyaType.Part:
{
if (firstPass)
{
SetQBImportInventoryAccounts s = new SetQBImportInventoryAccounts();
if (s.ShowDialog() != DialogResult.OK)
@@ -254,17 +247,15 @@ namespace AyaNovaQBI
return;
}
s.Dispose();
foreach (object o in moveData.Rows)
{
w.Step = ((AyaNameID)o).Name;
Util.ImportAyaPart(((AyaNameID)o).ID, alErrors);
firstPass = false;
}
await util.ImportAyaPart(AyaId, alErrors);
}
break;
default:
throw new System.NotSupportedException("ImportToQuickBooks: NOT SUPPORTED (STUB): " + _Type.ToString());
}
}
//display errors if any
if (alErrors.Count != 0)
@@ -289,10 +280,7 @@ namespace AyaNovaQBI
catch (Exception ex)
{
//CopyableMessageBox cb=new CopyableMessageBox("ImportToQuickBooks error: " + ex.Message);
//cb.ShowDialog();
//cb.Dispose();
Util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:ImportToQuickBooks");//case 3717
await util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:ImportToQuickBooks");
}
finally
{

View File

@@ -0,0 +1,130 @@
namespace AyaNovaQBI
{
partial class SetQBImportServiceRateAccounts
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.cbIncomeAccount = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(357, 176);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 16;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(19, 176);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 15;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("Tahoma", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(16, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(419, 32);
this.label1.TabIndex = 17;
this.label1.Text = "Default account";
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Top;
this.label3.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(16, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(419, 30);
this.label3.TabIndex = 19;
this.label3.Text = "Sales information:";
//
// cbIncomeAccount
//
this.cbIncomeAccount.Dock = System.Windows.Forms.DockStyle.Top;
this.cbIncomeAccount.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbIncomeAccount.FormattingEnabled = true;
this.cbIncomeAccount.Location = new System.Drawing.Point(16, 96);
this.cbIncomeAccount.Name = "cbIncomeAccount";
this.cbIncomeAccount.Size = new System.Drawing.Size(419, 21);
this.cbIncomeAccount.TabIndex = 21;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Location = new System.Drawing.Point(16, 78);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(419, 18);
this.label2.TabIndex = 20;
this.label2.Text = "Income account";
//
// SetQBImportServiceRateAccounts
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(451, 218);
this.ControlBox = false;
this.Controls.Add(this.cbIncomeAccount);
this.Controls.Add(this.label2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnCancel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "SetQBImportServiceRateAccounts";
this.Padding = new System.Windows.Forms.Padding(16);
this.ShowInTaskbar = false;
this.Text = "Import Rate";
this.Load += new System.EventHandler(this.SetQBImportServiceRateAccounts_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cbIncomeAccount;
private System.Windows.Forms.Label label2;
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AyaNovaQBI
{
public partial class SetQBImportServiceRateAccounts : Form
{
public SetQBImportServiceRateAccounts()
{
InitializeComponent();
}
private void SetQBImportServiceRateAccounts_Load(object sender, EventArgs e)
{
btnCancel.Text = util.AyaTranslations["Cancel"];
btnOK.Text = util.AyaTranslations["OK"];
cbIncomeAccount.DisplayMember = "FullName";
cbIncomeAccount.ValueMember = "ID";
cbIncomeAccount.DataSource = util.QBAccounts;
if (!string.IsNullOrEmpty(util.QDat.QBServiceIncomeAccountRef))
cbIncomeAccount.SelectedValue = util.QDat.QBServiceIncomeAccountRef;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>