From 96e61546c3e4ef613032d4b4810ffaf5c2b1f8ea Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Sat, 21 Jan 2017 18:38:19 -0600 Subject: [PATCH] Updated the main form with a slightly new look. Finished all the code for the main for to pull in all the data from the database and perform calculations on it. Currently can only load the most recent date. Added detection for holidays in the weekly and taxable lists. --- AdvertsingProfitControl/APCDatabase.accdb | Bin 2932736 -> 2932736 bytes .../AdvertsingProfitControl.csproj | 1 + AdvertsingProfitControl/BackPageGenerator.cs | 2 +- AdvertsingProfitControl/DatabaseReader.cs | 87 +- AdvertsingProfitControl/FrmDeleteRecord.cs | 14 +- AdvertsingProfitControl/FrmMain.Designer.cs | 1162 +++++++------ AdvertsingProfitControl/FrmMain.cs | 1547 ++++++++++------- AdvertsingProfitControl/FrmModifyRecord.cs | 77 +- AdvertsingProfitControl/FrontPageGenerator.cs | 2 +- AdvertsingProfitControl/Holiday.cs | 89 + AdvertsingProfitControl/NewModifyRecord.cs | 89 +- ...AdvertsingProfitControl.vshost.application | 2 +- ...dvertsingProfitControl.vshost.exe.manifest | 6 +- 13 files changed, 1821 insertions(+), 1257 deletions(-) create mode 100644 AdvertsingProfitControl/Holiday.cs diff --git a/AdvertsingProfitControl/APCDatabase.accdb b/AdvertsingProfitControl/APCDatabase.accdb index 90e06c4051d7e242bd0c0b6b6508154d6b0f6fe0..ce1c2c490c31e3af8fbc73b1527d0230400fa18b 100644 GIT binary patch delta 6822 zcmZo@*vtsR8<_Yw(^PjdF)=bSGHw>+d(SvofsbvIzz%+81{MYe2F`{PzpHir`#*d7 z`~Uy%|Np)J|G)nI$N%3y{;vQ3XRZ9Fu2k*nE7xe4%p1jYt2cJb2;&(&ovK$56(Q&ydNG%#g}(vRIyv z!GS@Tar(XcTuR%u1sUh^vhI4kp?1dfvvQ1*%mpHh)9>YTD7ACTGq!WfGi~RVXWn>$ zQDpnx_skiRObiUu)j3(r8Kt(zbFzr2Fg4t4FV$t)UaHGF{}SW~oGjH)1u z85pN8%w;i{?vT&Q)m|jeHoZumeFC2hk58DR&x_kjc^DaVcs4Fn;Ms1lhW7&VHUoC1 z1YQAtkgVN{S{_CQh0THjqWseh=CE^2*U{&>ww-AKyW9k>g4}@laZC&he!SDQ3^+=d zSQw@+FyN3jV2xyBVBle3W?*69WMN={1i20a2Ll&Kf{lTZffX#l#0YYnvBCD&1{~as z5e)zTOa1>J_y0e`|Np-K|1{c8=c;&lBgeq^cR(+|ih$ZlJ}!Bimo zil-19!VC$;M%$Lt6&3BMDotJC7qXNro9!7!buVpzkO%{BI#1h2K3=9J5 z5SCSK5-4Xe{Qqa9uVSKSU=YmU#o)!j#PI*Wz;q2cPEEsvl5~htDCsZz&O=DbPvZL-86G%H)Cu*2% zua)OqtiZ(ql4f9F@DrG><-nO<@4)bn5uEm!7#JCtkkY=i>_0|uZsBKOVqgYKK;prH zfr9}o!Nb6Wl8rQA61)sd&};q8;H(8w4A;dnm4U&Bk%8gBFA-3tQlBo* ztQ59=tuv?eAMOcLctPfY@b=60T>1jM(^x>60VKf4ux$EAIVH!98^TzoKValz*?wRN zR|W^;>FJtlxpEkpreEC6;Vvr1z{n-Tz{e24kjhX5E+X?7O19rw%caJ&ohgB9H9sTc z^mX}MN=!RCwqMHUGBDun;zQUlYrEhDW?jCC8c_akoPJP8R(^WFz6i&3|7u>z>GD<5Nb)Rj!0_Fa}U2g5Ons$#%cDloTE-BVk zE6m!bPmjOPrNVQQfuX>-4z18s6QGBW(**|_i% z52$q@F#YIKA(iP7^Em~kPdFwlus!Ur@EWG=Oaip3=V5Mkfez{@1S`vqK+LM&jJ9(aK5C#2voSSS?Bv0dks z@Dm9!7?1TNOF?@=n~q2R3s1 zBVBemrfm<{mtmG;TW}X(DoooBVAGPr$V{N&#uuuFNkEbsy3@bdj-Td*A^!aYhzahWm`u6R+}0O}9U%ASqSEzyNB@*fAI} zC^5(}uz~9wc~*vdjMG2la%fENaN-w}R|D0CcNrK!0p`cx#9+jrhfsMJL*-HihRUc3 zJQynPV5q#!z>vSSA5-ORB$aYt+lv?&*cM??d24#32fw=98;}ccLE36&3|b6Q3}Ofu z-ki>;%V#2W0a6}dc=ZP3^u(2%hLV*G44}ra4TAxL0)q@f`*kEM4lyufPb%lZu;LoT zilqz;-kw=J7*&A^1H%DEEQ-z`DUxJnWLW!21k(ej(cC5Zoq@sWDi(#O z&=tOAV5mQgMd3+Qg)(9myRfJ_fvzfG4i;6%(N($0VNrDq9NXJNH2K!Bfy;)c3=E7< zk;(=Kj_Zt&vhubepE}=mrUGs=0oLaX42;has+Kiy3QTL@wqSk9z`*ztAr3Ahw=*r^ z`^P_RgPi4d%L#lZ`5{JZw`dSJ#Sg6(L5YZw0ouj+H4xR}whw&a0gT7CM>z1W(C1@h z+`|uPIx#RvGfWo{U^U-vzkoHBXXA#QOqwhV4;UC2{{Q1=I8n^Qz{SAGz>ZyLx}hX< zqA(UYa7h1TU|{@-7FM)ugMuvGZt;Ns1V0}qqaCp+2y4`6L|0+<$RkdAi zCD&@E?URo4=W&4au>NCUVEl*XP*@}?2%O*t#XK7mBLgE7a5L2Rzf)#R*7C34#Nck%57q zkpbLge(=NrLQn6#%Ox}YQ!a;wXdDA3jG1l~FHp(habj`pj0aB~rpI4Jbjc4vDjuXR z`M-P)E7nQ|2F6N+$GjOCm06oXPGn$UkY_k{zW02{`M-S2_&oSN@y_OT<$cF9gU6ZY zCU-Np4)-OlN-hPi#=y+*SDttJ@-hKk<^&1l>F3J?6nFzs0IGqF0of0RhQ`KTC_eZDHh-xcRxg_v85kQIq58n5Qb3nEV7lS- z&N>0<>HU=gY`j4Xc1U5e2&CXZYS8pkmEah#N0R$qDWJ=ePTP}RJu63}IC@E4kXuu4E& z$k@QZ08N2)wScbf0y!IK2yvl?kdcw4fu)g=ABv-Ts|9qm7Syg)~Y5M$H0SR7Iokwaxp=>BV{Y|Za6q-iiIssjl2_cUdr`yzFXiTgV z&}F``(HxY16w#8-c92Gg8|h5bAJkzuhpirD<4&#V{!mwe%I>fNxJjAfzbg>#j0}u?NL9(Q22O!(4jjvv zpzV;4yvumD2mI%qz%>0nBOmMb+aQ7I0snb7a35u0U|?iWV_;xVn4Z|jqc}abp9kv4 z7z3b3q%hQ!V5oZpy174_PW}N;z zkVRdn0V2v=#K`cOk%8g=|NqnfIB`l&f4h;1m*f9`29_d52J`8DO;Wns<(ZXM@@x}O zTEW-8LQlMXg`PzF3O&j86?#(bEA*t>SLn&Kuh5fiU!f=0zCura`wBgU%@akB@*O>T zq~?hJkw=H89`-o=pJ~&f)I;qB2Nc>14k)%498hX6IH25Ka6qNK;DBm-!2z}Qf&=R9 z1qU?R3l3;*FF2qzsh;Nxw4`HT_|LFiV1v$I#_hHXSkrkXZuqFh!oUl1Hflo=tI+fh V>jaaScp2M2`fG3h=&!?H001mpIEw%P delta 4442 zcmZo@*vtsR8<_Yw4=U|sVq#=uWZW#s_nvXG0w3EZfgSwH3JeSk47`jpURJMp@Bjb* z@Bjb5|NnRT|Nr{;AOC;<_`Cl9kMha4JQLsM3;FZe8M7xZER|!GXJ8PN-?%WBV^hO1c}9lK$LGrzDmkZ|UEccOi37-T zPlh~(GKPGHOon8JRECqqntTin3{R%tz0ak*U0aZGE-&lFGmnbAJYw;In}2B-ze?0eY+9IIV+Ax?@cK}51u$okKZaFC492@k{|;E z!*vD*kh@(NTo_!YD+n=)O}~)KA;!9Np2H{k>92D+^x0gv85|f^O;^a{FlSroJI6)m z%=Fki4r%u7j0_Xjo3L-M&*NxRoWf(lx|D%|aq0HJ5Zlf0lX%1_nsNhh#Z5h5!FE(KAIBW?-ARP-CQEvAQNC_9K6dZJiS?t zQw&A)h#bsLQ#3mj<-vwyxMq8;Jm+Esc!WA|rcbZDz#%z(&q6j%U1kO*24e*?=@1_mEUz^~kH=*&6&4|hX12iW`zMv2=m+jHp)EN5!q z6xhy`z_ps6F=hI?d@dy>gVODn^0^EQc-OFiQZz_CBg3BQALW!BH*UybnQl-Z%`)9! zp^(D%2Tv3ivP}PXmsenWbtKnx=It796>l*y@o-OP*}$d3yO}4S$C`(o=NNYzx6}4S z0hV1{6E_4i@=Qc~GRAF@T~Sk`~l= zb7@Nb|7Q-71;xENLMy{;Slsg>#XZ9;kZ7wMCu)i?*u$ln`2U}&8Q2~peHBm=KynAe z3p^(V4+Yf$MiENd8MW=n9Zv= zUH%kr#q@%AN*vqWUMuZlnJzGkclQ<{3jx-53=E9#P>tR8fiFCOk!^c~1OE#BZ4Mk0 zQOvB56ylj~eTG+Hy24yu#p%6KLJiv=y-|{5-YzhU*O+OEkN`XwHI9}`VkGlTOw$C! zELi_CFfjf_*t^Yvg9TqUYhqzsPi)k0U&Jl=5-D2w7#S_OVFB;RFkRpRR|C^Y?(G{x zxR}_tPjVMrCb8XO1OEwrXi&4UF)}c+F>c?e#OTkvaYHfFHV2M+0|O|BA_`7MhwcCCIhh5# znAw`4&X#95cE0y~$az-&ZF~uQLVSmLOL^6JZ}4>UX!6|V?%}rLe#te1%bn{R=R!_z z&fgqsIbu0@Irg&Wvj1jV#^%qqaUnAsBhU1LQUTrROG^c0dA%7-81xwQ7?>IU^7BkT z4-#i76OiWhL=o316VRQWSSDb>o5tV|RsWWkXZkXbxN*6FppdbFk&(Fzg8@_$WY|Bb zq!=%%cv!iB?)1kHO@@YOn$|%j(KWGE2 z0J`=qAo0370kP@-D+Jhhy%@}p94b^PpsVr!pL1eTQet{4h82dM4CY9x^D6~(r!T1# z5a)G8vHAp5TyQ#Hl>i%>q+%6BlYoekg^_`gsS&E)Dwy>2{Z#_&XnHSK3FxXCFmR!I z-N?w&z|zRb4aE(*)dITHld1(od7Z&72F2@MexB(q)dIST94H1@8W|W^8abgTy9LtD zUn8Kw8^!>Ufg}r;8UbAeb`3|bmkUMHZd#EIfX zV?$#DBTGxvko*VIuTm=@AZTP@Y=|N`J)~Y>&9njzi|rN{_)hU}XA0mm6JX7Mg~THB%?s3!x(>=iWnJ+ z85tNrEvxdYFqC89qbxKuQcy50e|z55b{_@Bd$xB1Q&tCWuAthQi|QhQbo< zhQgBVhQdnu0gd*81De|l4rooP z=ZWHjbe$O(&M<5jaL}H~xZQpMYbwvi4dINMEZ~ag|37|)6U96XTnvm1?AV2-8%i=K SvVi2;Kl*EL|LCv7UjP8tC?;(H diff --git a/AdvertsingProfitControl/AdvertsingProfitControl.csproj b/AdvertsingProfitControl/AdvertsingProfitControl.csproj index a01a4af..b74595e 100644 --- a/AdvertsingProfitControl/AdvertsingProfitControl.csproj +++ b/AdvertsingProfitControl/AdvertsingProfitControl.csproj @@ -109,6 +109,7 @@ + Form diff --git a/AdvertsingProfitControl/BackPageGenerator.cs b/AdvertsingProfitControl/BackPageGenerator.cs index 00fb202..90c3aa6 100644 --- a/AdvertsingProfitControl/BackPageGenerator.cs +++ b/AdvertsingProfitControl/BackPageGenerator.cs @@ -36,7 +36,7 @@ namespace AdvertsingProfitControl } } - public void GenerateWeeklyInventoryControlPage(string dateId) + public void GenerateWeeklyInventoryControlPage(int dateId) { var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); diff --git a/AdvertsingProfitControl/DatabaseReader.cs b/AdvertsingProfitControl/DatabaseReader.cs index 7532ecb..d13dae2 100644 --- a/AdvertsingProfitControl/DatabaseReader.cs +++ b/AdvertsingProfitControl/DatabaseReader.cs @@ -42,10 +42,10 @@ namespace AdvertsingProfitControl /// /// The connection string for the database. /// The ID number as a string. - public string RetrieveMostRecentDateId(string connectionString) + public int RetrieveMostRecentDateId(string connectionString) { - var dateId = "0"; - var oleDbCommand = new OleDbCommand() + int dateId = 0; + var oleDbCommand = new OleDbCommand { CommandText = "SELECT WeekEnding.ID FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = (SELECT MAX(WeekEnding.EndOfWeekDate) FROM WeekEnding)" }; @@ -61,7 +61,7 @@ namespace AdvertsingProfitControl { while (reader != null && reader.Read()) { - dateId = reader[0].ToString(); + dateId = int.Parse(reader[0].ToString()); } } } @@ -70,6 +70,34 @@ namespace AdvertsingProfitControl return dateId; } + public DateTime RetrieveMostRecentDate(string connectionString) + { + var date = new DateTime(); + var oleDbCommand = new OleDbCommand + { + CommandText = "SELECT WeekEnding.EndOfWeekDate FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = (SELECT MAX(WeekEnding.EndOfWeekDate) FROM WeekEnding)" + }; + var connection = new OleDbConnection(connectionString); + oleDbCommand.Connection = connection; + + using (connection) + { + using (oleDbCommand) + { + connection.Open(); + using (var reader = oleDbCommand.ExecuteReader()) + { + while (reader != null && reader.Read()) + { + date = DateTime.Parse(reader[0].ToString()); + } + } + } + } + + return date; + } + /// /// Returns the date ID of the date string that is passed. /// Preferred format is short date (1/20/2017). @@ -106,7 +134,7 @@ namespace AdvertsingProfitControl return dateId; } - public string RetrieveDateStringById(string dateId, string connectionString) + public string RetrieveDateStringById(int dateId, string connectionString) { string dateString = ""; var oleDbCommand = new OleDbCommand() @@ -222,7 +250,7 @@ namespace AdvertsingProfitControl public DateTime RetrieveMostRecentDateString(string connectionString) { - DateTime dateTimeObject = new DateTime(); + var dateTimeObject = new DateTime(); var oleDbCommand = new OleDbCommand() { CommandText = "SELECT WeekEnding.EndOfWeekDate FROM WeekEnding WHERE WeekEnding.EndOfWeekDate = (SELECT MAX(WeekEnding.EndOfWeekDate) FROM WeekEnding)" @@ -370,7 +398,7 @@ namespace AdvertsingProfitControl return id; } - public List RetrieveUsedAdItemListByDateId(string dateId, string connectionString) + public List RetrieveUsedAdItemListByDateId(int dateId, string connectionString) { var adItemList = new List(); var oleDbCommand = new OleDbCommand @@ -444,35 +472,6 @@ namespace AdvertsingProfitControl #region Comment Functions - public string RetrieveComments(string dateId, string connectionString) - { - var comments = ""; - var oleDbCommand = new OleDbCommand() - { - CommandText = "SELECT Comment.Comment FROM Comment WHERE Comment.FK_DateID = ?" - }; - oleDbCommand.Parameters.AddWithValue("DateID", dateId); - var connection = new OleDbConnection(connectionString); - oleDbCommand.Connection = connection; - - using (connection) - { - using (oleDbCommand) - { - connection.Open(); - using(var reader = oleDbCommand.ExecuteReader()) - { - while(reader != null && reader.Read()) - { - comments = reader[0].ToString(); - } - } - } - } - - return comments; - } - /// /// Created for the new modify record form, returns the ID of the comment being grabbed. /// @@ -715,7 +714,7 @@ namespace AdvertsingProfitControl #region Table Return Functions - public DataTable ReturnApcTableForReport(string dateId, string connectionString) + public DataTable ReturnApcTableForReport(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -741,7 +740,7 @@ namespace AdvertsingProfitControl return dataTable; } - public DataTable ReturnProjectionsTable(string dateId, string connectionString) + public DataTable ReturnProjectionsTable(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -766,7 +765,7 @@ namespace AdvertsingProfitControl return dataTable; } - public DataTable ReturnActualSales(string dateId, string connectionString) + public DataTable ReturnActualSales(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -791,7 +790,7 @@ namespace AdvertsingProfitControl return dataTable; } - public DataTable ReturnInventoryTable(string dateId, string connectionString) + public DataTable ReturnInventoryTable(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -817,7 +816,7 @@ namespace AdvertsingProfitControl } - public DataTable ReturnInvoiceTable(string dateId, string connectionString) + public DataTable ReturnInvoiceTable(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -842,7 +841,7 @@ namespace AdvertsingProfitControl return dataTable; } - public DataTable ReturnWeeklySalesFromDateId(string dateId, string connectionString) + public DataTable ReturnWeeklySalesFromDateId(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand() @@ -867,7 +866,7 @@ namespace AdvertsingProfitControl return dataTable; } - public DataTable ReturnTaxableFromDateId(string dateId, string connectionString) + public DataTable ReturnTaxableFromDateId(int dateId, string connectionString) { var dataTable = new DataTable(); var oleDbCommand = new OleDbCommand @@ -948,7 +947,7 @@ namespace AdvertsingProfitControl #region Supplier And Invoices Functions - public string RetrieveSupplierNameById(string supplierId, string connectionString) + public string RetrieveSupplierNameById(int supplierId, string connectionString) { var supplierName = ""; var oleDbCommand = new OleDbCommand() diff --git a/AdvertsingProfitControl/FrmDeleteRecord.cs b/AdvertsingProfitControl/FrmDeleteRecord.cs index bde3c19..d621986 100644 --- a/AdvertsingProfitControl/FrmDeleteRecord.cs +++ b/AdvertsingProfitControl/FrmDeleteRecord.cs @@ -164,27 +164,27 @@ namespace AdvertsingProfitControl var databaseTracker = new DatabaseTracker(); var dataBaseReader = new DatabaseReader(); - string dateId; + int dateId; //Check to see if a parameter has been passed. if (dateString == "") { //IF non were, then grab the most recent date ID from the database and use that. dateId = dataBaseReader.RetrieveMostRecentDateId(databaseTracker.DatabaseConnectionString); - _console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable."); + _console.WriteToLog(FrmLogConsole.Level.Info, dateId != 0 ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable."); } else { //ELSE IF one was passed, then use it's ID to build the tables. - dateId = dataBaseReader.RetrieveDateIdByDateString(dateString, databaseTracker.DatabaseConnectionString).ToString(); - _console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database."); - if (dateId == "0") + dateId = dataBaseReader.RetrieveDateIdByDateString(dateString, databaseTracker.DatabaseConnectionString); + _console.WriteToLog(FrmLogConsole.Level.Info, dateId != 0 ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database."); + if (dateId == 0) { _gDateStringCollection.Remove(dateString); } } //Now check to make sure there were no errors grabbing the ID, IF there were return. - if (dateId == "0") return; + if (dateId == 0) return; //Clear all DataGridViews since the date supplied is valid and in the database. projectionsDataGridView.DataSource = null; inventoryDataGridView.DataSource = null; @@ -198,7 +198,7 @@ namespace AdvertsingProfitControl suppliersDataGridView.DataSource = dataBaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString); weeklySalesDataGridView.DataSource = dataBaseReader.ReturnWeeklySalesFromDateId(dateId, databaseTracker.DatabaseConnectionString); - commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString); + commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString)[1]; if (commentsTextBox.Text.StartsWith("No comments")) { commentsTextBox.Enabled = false; diff --git a/AdvertsingProfitControl/FrmMain.Designer.cs b/AdvertsingProfitControl/FrmMain.Designer.cs index 5a3b83e..7c3513c 100644 --- a/AdvertsingProfitControl/FrmMain.Designer.cs +++ b/AdvertsingProfitControl/FrmMain.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); - this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.printPreviewButton = new System.Windows.Forms.Button(); this.mainMenu = new System.Windows.Forms.MenuStrip(); this.fileMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.exitFileMainMenu = new System.Windows.Forms.ToolStripMenuItem(); @@ -37,100 +37,107 @@ this.addRecordsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.modifyRecordMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.deleteRecordsMainMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.newFormTestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.newModifyRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.adSpecialKeyWordsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.manageItemsToolsMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.helpMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.showHideConsoleHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem(); this.dbVersionHelpMainMenu = new System.Windows.Forms.ToolStripMenuItem(); + this.mainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); this.commentMainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); - this.commentMainGroupBox = new System.Windows.Forms.GroupBox(); - this.commentsTextBox = new System.Windows.Forms.TextBox(); this.profitAnalysisMainGroupBox = new System.Windows.Forms.GroupBox(); + this.errorLabel = new System.Windows.Forms.Label(); this.shrinkLinkLabel = new System.Windows.Forms.LinkLabel(); - this.totalProfitReturnLabel = new System.Windows.Forms.Label(); - this.totalProfitReturnFromRemaingLabel = new System.Windows.Forms.Label(); - this.totalProfitFromAdItemsLabel = new System.Windows.Forms.Label(); - this.remainingSalesLabel = new System.Windows.Forms.Label(); - this.salesProducedLabel = new System.Windows.Forms.Label(); this.departmentSalesLabel = new System.Windows.Forms.Label(); - this.grossProfitGroupBox = new System.Windows.Forms.GroupBox(); - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label(); - this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label(); - this.perfectGrossProfitLabel = new System.Windows.Forms.Label(); - this.grossProfitTotalSales = new System.Windows.Forms.Label(); - this.grossProfitLessCostOfSales = new System.Windows.Forms.Label(); - this.costAnalysisGroupBox = new System.Windows.Forms.GroupBox(); - this.usePreRenderedFilesCheckbox = new System.Windows.Forms.CheckBox(); - this.dateSelectorPanel = new System.Windows.Forms.Panel(); - this.printPreviewButton = new System.Windows.Forms.Button(); - this.yearComboBox = new System.Windows.Forms.ComboBox(); - this.dayComboBox = new System.Windows.Forms.ComboBox(); - this.monthComboBox = new System.Windows.Forms.ComboBox(); - this.dateSelectLabel = new System.Windows.Forms.Label(); + this.totalProfitReturnLabel = new System.Windows.Forms.Label(); + this.salesProducedLabel = new System.Windows.Forms.Label(); + this.totalProfitReturnFromRemaingLabel = new System.Windows.Forms.Label(); + this.remainingSalesLabel = new System.Windows.Forms.Label(); + this.totalProfitFromAdItemsLabel = new System.Windows.Forms.Label(); + this.weeklySalesGroupBox = new System.Windows.Forms.GroupBox(); + this.saturdayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.totalWeeklySalesLabel = new System.Windows.Forms.Label(); + this.thursdayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.fridayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.mondayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.tuesadayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.wednesdayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.sundayWeeklySalesLabel = new System.Windows.Forms.Label(); + this.taxableGroupBox = new System.Windows.Forms.GroupBox(); + this.mondayTaxableLabel = new System.Windows.Forms.Label(); + this.tuesdayTaxableLabel = new System.Windows.Forms.Label(); + this.saturdayTaxableLabel = new System.Windows.Forms.Label(); + this.totalTaxableLabel = new System.Windows.Forms.Label(); + this.fridayTaxableLabel = new System.Windows.Forms.Label(); + this.thursdayTaxableLabel = new System.Windows.Forms.Label(); + this.wednesdayTaxableLabel = new System.Windows.Forms.Label(); + this.sundayTaxableLabel = new System.Windows.Forms.Label(); + this.dateTimeGroupBox = new System.Windows.Forms.GroupBox(); + this.monthCalendar = new System.Windows.Forms.MonthCalendar(); this.mainViewTabControl = new System.Windows.Forms.TabControl(); this.projectionTab = new System.Windows.Forms.TabPage(); - this.projectedSalesMainDataGrid = new System.Windows.Forms.DataGridView(); + this.projectionsDataGridView = new System.Windows.Forms.DataGridView(); this.inventoryTabPage = new System.Windows.Forms.TabPage(); this.inventoryDataGridView = new System.Windows.Forms.DataGridView(); this.actualSalesTab = new System.Windows.Forms.TabPage(); this.actualSalesMainLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); - this.actualSalesMainDataGidView = new System.Windows.Forms.DataGridView(); + this.actualSalesDataGridView = new System.Windows.Forms.DataGridView(); this.suppliersTabPage = new System.Windows.Forms.TabPage(); - this.suppliersDataGridView = new System.Windows.Forms.DataGridView(); - this.WeeklySalesTabPage = new System.Windows.Forms.TabPage(); - this.weeklySalesDataGridView = new System.Windows.Forms.DataGridView(); - this.taxableTabPage = new System.Windows.Forms.TabPage(); - this.taxableDataGridView = new System.Windows.Forms.DataGridView(); - this.debugTabPage = new System.Windows.Forms.TabPage(); - this.monthCalendar = new System.Windows.Forms.MonthCalendar(); - this.mainTableLayoutPanel.SuspendLayout(); + this.invoicesDataGridView = new System.Windows.Forms.DataGridView(); + this.commentsAndAnalysisLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); + this.costAnalysisGroupBox = new System.Windows.Forms.GroupBox(); + this.informationLabel = new System.Windows.Forms.Label(); + this.suppliesLabel = new System.Windows.Forms.Label(); + this.salaryDollarsLabel = new System.Windows.Forms.Label(); + this.salaryPercentageLabel = new System.Windows.Forms.Label(); + this.salesPerManHourLabel = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.commentMainGroupBox = new System.Windows.Forms.GroupBox(); + this.commentsTextBox = new System.Windows.Forms.TextBox(); + this.grossProfitGroupBox = new System.Windows.Forms.GroupBox(); + this.usePreRenderedFilesCheckbox = new System.Windows.Forms.CheckBox(); + this.grossProfitLessCostOfSales = new System.Windows.Forms.Label(); + this.grossProfitTotalSales = new System.Windows.Forms.Label(); + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel = new System.Windows.Forms.Label(); + this.perfectGrossProfitLabel = new System.Windows.Forms.Label(); + this.grossProfitDollarGrossProfitLabel = new System.Windows.Forms.Label(); this.mainMenu.SuspendLayout(); + this.mainTableLayoutPanel.SuspendLayout(); this.commentMainTableLayoutPanel.SuspendLayout(); - this.commentMainGroupBox.SuspendLayout(); this.profitAnalysisMainGroupBox.SuspendLayout(); - this.grossProfitGroupBox.SuspendLayout(); - this.costAnalysisGroupBox.SuspendLayout(); - this.dateSelectorPanel.SuspendLayout(); + this.weeklySalesGroupBox.SuspendLayout(); + this.taxableGroupBox.SuspendLayout(); + this.dateTimeGroupBox.SuspendLayout(); this.mainViewTabControl.SuspendLayout(); this.projectionTab.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).BeginInit(); this.inventoryTabPage.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).BeginInit(); this.actualSalesTab.SuspendLayout(); this.actualSalesMainLayoutPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.actualSalesMainDataGidView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.actualSalesDataGridView)).BeginInit(); this.suppliersTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).BeginInit(); - this.WeeklySalesTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).BeginInit(); - this.taxableTabPage.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.taxableDataGridView)).BeginInit(); - this.debugTabPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.invoicesDataGridView)).BeginInit(); + this.commentsAndAnalysisLayoutPanel.SuspendLayout(); + this.costAnalysisGroupBox.SuspendLayout(); + this.commentMainGroupBox.SuspendLayout(); + this.grossProfitGroupBox.SuspendLayout(); this.SuspendLayout(); // - // mainTableLayoutPanel + // printPreviewButton // - this.mainTableLayoutPanel.ColumnCount = 1; - this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.mainTableLayoutPanel.Controls.Add(this.mainMenu, 0, 0); - this.mainTableLayoutPanel.Controls.Add(this.commentMainTableLayoutPanel, 0, 2); - this.mainTableLayoutPanel.Controls.Add(this.mainViewTabControl, 0, 1); - this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0); - this.mainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.mainTableLayoutPanel.Name = "mainTableLayoutPanel"; - this.mainTableLayoutPanel.RowCount = 3; - this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 41F)); - this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65F)); - this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35F)); - this.mainTableLayoutPanel.Size = new System.Drawing.Size(1734, 892); - this.mainTableLayoutPanel.TabIndex = 0; + this.printPreviewButton.Location = new System.Drawing.Point(313, 277); + this.printPreviewButton.Name = "printPreviewButton"; + this.printPreviewButton.Size = new System.Drawing.Size(138, 49); + this.printPreviewButton.TabIndex = 4; + this.printPreviewButton.Text = "Print Preview"; + this.printPreviewButton.UseVisualStyleBackColor = true; + this.printPreviewButton.Visible = false; + this.printPreviewButton.Click += new System.EventHandler(this.DisplayPrintPreview); // // mainMenu // + this.mainTableLayoutPanel.SetColumnSpan(this.mainMenu, 2); this.mainMenu.Dock = System.Windows.Forms.DockStyle.Fill; this.mainMenu.ImageScalingSize = new System.Drawing.Size(24, 24); this.mainMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -141,7 +148,7 @@ this.mainMenu.Location = new System.Drawing.Point(0, 0); this.mainMenu.Name = "mainMenu"; this.mainMenu.Padding = new System.Windows.Forms.Padding(10, 3, 0, 3); - this.mainMenu.Size = new System.Drawing.Size(1734, 41); + this.mainMenu.Size = new System.Drawing.Size(1847, 40); this.mainMenu.TabIndex = 1; this.mainMenu.Text = "menuStrip1"; // @@ -150,7 +157,7 @@ this.fileMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exitFileMainMenu}); this.fileMainMenu.Name = "fileMainMenu"; - this.fileMainMenu.Size = new System.Drawing.Size(56, 35); + this.fileMainMenu.Size = new System.Drawing.Size(56, 34); this.fileMainMenu.Text = "&File"; // // exitFileMainMenu @@ -164,11 +171,9 @@ this.recordsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addRecordsToolStripMenuItem, this.modifyRecordMainMenu, - this.deleteRecordsMainMenu, - this.newFormTestToolStripMenuItem, - this.newModifyRecordToolStripMenuItem}); + this.deleteRecordsMainMenu}); this.recordsToolStripMenuItem.Name = "recordsToolStripMenuItem"; - this.recordsToolStripMenuItem.Size = new System.Drawing.Size(98, 35); + this.recordsToolStripMenuItem.Size = new System.Drawing.Size(98, 34); this.recordsToolStripMenuItem.Text = "&Records"; // // addRecordsToolStripMenuItem @@ -192,29 +197,16 @@ this.deleteRecordsMainMenu.Size = new System.Drawing.Size(323, 34); this.deleteRecordsMainMenu.Text = "&Delete Existing record"; this.deleteRecordsMainMenu.ToolTipText = "Currently Unavailable in this Version."; + this.deleteRecordsMainMenu.Visible = false; this.deleteRecordsMainMenu.Click += new System.EventHandler(this.deleteRecordsMainMenu_Click); // - // newFormTestToolStripMenuItem - // - this.newFormTestToolStripMenuItem.Name = "newFormTestToolStripMenuItem"; - this.newFormTestToolStripMenuItem.Size = new System.Drawing.Size(323, 34); - this.newFormTestToolStripMenuItem.Text = "&New Form Test"; - this.newFormTestToolStripMenuItem.Click += new System.EventHandler(this.newFormTestToolStripMenuItem_Click); - // - // newModifyRecordToolStripMenuItem - // - this.newModifyRecordToolStripMenuItem.Name = "newModifyRecordToolStripMenuItem"; - this.newModifyRecordToolStripMenuItem.Size = new System.Drawing.Size(323, 34); - this.newModifyRecordToolStripMenuItem.Text = "New Modify Record"; - this.newModifyRecordToolStripMenuItem.Click += new System.EventHandler(this.newModifyRecordToolStripMenuItem_Click); - // // toolsMainMenu // this.toolsMainMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.adSpecialKeyWordsToolsMainMenu, this.manageItemsToolsMainMenu}); this.toolsMainMenu.Name = "toolsMainMenu"; - this.toolsMainMenu.Size = new System.Drawing.Size(72, 35); + this.toolsMainMenu.Size = new System.Drawing.Size(72, 34); this.toolsMainMenu.Text = "&Tools"; // // adSpecialKeyWordsToolsMainMenu @@ -222,7 +214,6 @@ this.adSpecialKeyWordsToolsMainMenu.Name = "adSpecialKeyWordsToolsMainMenu"; this.adSpecialKeyWordsToolsMainMenu.Size = new System.Drawing.Size(282, 34); this.adSpecialKeyWordsToolsMainMenu.Text = "&Register Ad Special"; - this.adSpecialKeyWordsToolsMainMenu.Click += new System.EventHandler(this.adSpecialKeyWordsToolsMainMenu_Click); // // manageItemsToolsMainMenu // @@ -237,7 +228,7 @@ this.showHideConsoleHelpMainMenu, this.dbVersionHelpMainMenu}); this.helpMainMenu.Name = "helpMainMenu"; - this.helpMainMenu.Size = new System.Drawing.Size(68, 35); + this.helpMainMenu.Size = new System.Drawing.Size(68, 34); this.helpMainMenu.Text = "&Help"; // // showHideConsoleHelpMainMenu @@ -254,81 +245,81 @@ this.dbVersionHelpMainMenu.Text = "Get &Database Version"; this.dbVersionHelpMainMenu.Click += new System.EventHandler(this.dbVersionHelpMainMenu_Click); // + // mainTableLayoutPanel + // + this.mainTableLayoutPanel.ColumnCount = 2; + this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 75F)); + this.mainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.mainTableLayoutPanel.Controls.Add(this.commentMainTableLayoutPanel, 0, 2); + this.mainTableLayoutPanel.Controls.Add(this.mainMenu, 0, 0); + this.mainTableLayoutPanel.Controls.Add(this.mainViewTabControl, 0, 1); + this.mainTableLayoutPanel.Controls.Add(this.commentsAndAnalysisLayoutPanel, 1, 1); + this.mainTableLayoutPanel.Controls.Add(this.grossProfitGroupBox, 1, 2); + this.mainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.mainTableLayoutPanel.Location = new System.Drawing.Point(0, 0); + this.mainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.mainTableLayoutPanel.Name = "mainTableLayoutPanel"; + this.mainTableLayoutPanel.RowCount = 3; + this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F)); + this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F)); + this.mainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); + this.mainTableLayoutPanel.Size = new System.Drawing.Size(1847, 892); + this.mainTableLayoutPanel.TabIndex = 0; + // // commentMainTableLayoutPanel // this.commentMainTableLayoutPanel.ColumnCount = 4; - this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 28F)); - this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26F)); - this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26F)); - this.commentMainTableLayoutPanel.Controls.Add(this.commentMainGroupBox, 0, 0); - this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 1, 0); - this.commentMainTableLayoutPanel.Controls.Add(this.grossProfitGroupBox, 2, 0); - this.commentMainTableLayoutPanel.Controls.Add(this.costAnalysisGroupBox, 3, 0); - this.commentMainTableLayoutPanel.Controls.Add(this.dateSelectorPanel, 2, 1); + this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 355F)); + this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.5F)); + this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 27.5F)); + this.commentMainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45F)); + this.commentMainTableLayoutPanel.Controls.Add(this.profitAnalysisMainGroupBox, 3, 0); + this.commentMainTableLayoutPanel.Controls.Add(this.weeklySalesGroupBox, 1, 0); + this.commentMainTableLayoutPanel.Controls.Add(this.taxableGroupBox, 2, 0); + this.commentMainTableLayoutPanel.Controls.Add(this.dateTimeGroupBox, 0, 0); this.commentMainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(5, 600); + this.commentMainTableLayoutPanel.Location = new System.Drawing.Point(5, 557); this.commentMainTableLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.commentMainTableLayoutPanel.Name = "commentMainTableLayoutPanel"; - this.commentMainTableLayoutPanel.RowCount = 2; - this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); - this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); - this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23F)); - this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1724, 286); - this.commentMainTableLayoutPanel.TabIndex = 2; - // - // commentMainGroupBox - // - this.commentMainGroupBox.Controls.Add(this.commentsTextBox); - this.commentMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.commentMainGroupBox.Location = new System.Drawing.Point(5, 6); - this.commentMainGroupBox.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.commentMainGroupBox.Name = "commentMainGroupBox"; - this.commentMainGroupBox.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.commentMainTableLayoutPanel.SetRowSpan(this.commentMainGroupBox, 2); - this.commentMainGroupBox.Size = new System.Drawing.Size(334, 274); - this.commentMainGroupBox.TabIndex = 0; - this.commentMainGroupBox.TabStop = false; - this.commentMainGroupBox.Text = "Comments"; - // - // commentsTextBox - // - this.commentsTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.commentsTextBox.Enabled = false; - this.commentsTextBox.Location = new System.Drawing.Point(5, 28); - this.commentsTextBox.Multiline = true; - this.commentsTextBox.Name = "commentsTextBox"; - this.commentsTextBox.ReadOnly = true; - this.commentsTextBox.Size = new System.Drawing.Size(324, 240); - this.commentsTextBox.TabIndex = 0; + this.commentMainTableLayoutPanel.RowCount = 1; + this.commentMainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.commentMainTableLayoutPanel.Size = new System.Drawing.Size(1375, 329); + this.commentMainTableLayoutPanel.TabIndex = 5; // // profitAnalysisMainGroupBox // + this.profitAnalysisMainGroupBox.Controls.Add(this.errorLabel); this.profitAnalysisMainGroupBox.Controls.Add(this.shrinkLinkLabel); - this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnLabel); - this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnFromRemaingLabel); - this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitFromAdItemsLabel); - this.profitAnalysisMainGroupBox.Controls.Add(this.remainingSalesLabel); - this.profitAnalysisMainGroupBox.Controls.Add(this.salesProducedLabel); this.profitAnalysisMainGroupBox.Controls.Add(this.departmentSalesLabel); + this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnLabel); + this.profitAnalysisMainGroupBox.Controls.Add(this.salesProducedLabel); + this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitReturnFromRemaingLabel); + this.profitAnalysisMainGroupBox.Controls.Add(this.remainingSalesLabel); + this.profitAnalysisMainGroupBox.Controls.Add(this.totalProfitFromAdItemsLabel); this.profitAnalysisMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(349, 6); - this.profitAnalysisMainGroupBox.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.profitAnalysisMainGroupBox.Location = new System.Drawing.Point(918, 3); this.profitAnalysisMainGroupBox.Name = "profitAnalysisMainGroupBox"; - this.profitAnalysisMainGroupBox.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.commentMainTableLayoutPanel.SetRowSpan(this.profitAnalysisMainGroupBox, 2); - this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(472, 274); - this.profitAnalysisMainGroupBox.TabIndex = 1; + this.profitAnalysisMainGroupBox.Size = new System.Drawing.Size(454, 323); + this.profitAnalysisMainGroupBox.TabIndex = 2; this.profitAnalysisMainGroupBox.TabStop = false; this.profitAnalysisMainGroupBox.Text = "Profit Analysis"; // + // errorLabel + // + this.errorLabel.AutoSize = true; + this.errorLabel.Location = new System.Drawing.Point(11, 246); + this.errorLabel.Name = "errorLabel"; + this.errorLabel.Size = new System.Drawing.Size(62, 25); + this.errorLabel.TabIndex = 8; + this.errorLabel.Text = "errors"; + // // shrinkLinkLabel // this.shrinkLinkLabel.AutoSize = true; this.shrinkLinkLabel.LinkArea = new System.Windows.Forms.LinkArea(20, 6); this.shrinkLinkLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.shrinkLinkLabel.LinkColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.shrinkLinkLabel.Location = new System.Drawing.Point(0, 37); + this.shrinkLinkLabel.Location = new System.Drawing.Point(11, 29); this.shrinkLinkLabel.Name = "shrinkLinkLabel"; this.shrinkLinkLabel.Size = new System.Drawing.Size(272, 27); this.shrinkLinkLabel.TabIndex = 6; @@ -336,210 +327,264 @@ this.shrinkLinkLabel.Text = "Assuming 30% Shrink Change"; this.shrinkLinkLabel.UseCompatibleTextRendering = true; // - // totalProfitReturnLabel - // - this.totalProfitReturnLabel.AutoSize = true; - this.totalProfitReturnLabel.Location = new System.Drawing.Point(0, 251); - this.totalProfitReturnLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.totalProfitReturnLabel.Name = "totalProfitReturnLabel"; - this.totalProfitReturnLabel.Size = new System.Drawing.Size(178, 25); - this.totalProfitReturnLabel.TabIndex = 5; - this.totalProfitReturnLabel.Text = "Total Profit Return: "; - // - // totalProfitReturnFromRemaingLabel - // - this.totalProfitReturnFromRemaingLabel.AutoSize = true; - this.totalProfitReturnFromRemaingLabel.Location = new System.Drawing.Point(0, 216); - this.totalProfitReturnFromRemaingLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.totalProfitReturnFromRemaingLabel.Name = "totalProfitReturnFromRemaingLabel"; - this.totalProfitReturnFromRemaingLabel.Size = new System.Drawing.Size(380, 25); - this.totalProfitReturnFromRemaingLabel.TabIndex = 4; - this.totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: "; - // - // totalProfitFromAdItemsLabel - // - this.totalProfitFromAdItemsLabel.AutoSize = true; - this.totalProfitFromAdItemsLabel.Location = new System.Drawing.Point(0, 180); - this.totalProfitFromAdItemsLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.totalProfitFromAdItemsLabel.Name = "totalProfitFromAdItemsLabel"; - this.totalProfitFromAdItemsLabel.Size = new System.Drawing.Size(342, 25); - this.totalProfitFromAdItemsLabel.TabIndex = 3; - this.totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): "; - // - // remainingSalesLabel - // - this.remainingSalesLabel.AutoSize = true; - this.remainingSalesLabel.Location = new System.Drawing.Point(0, 143); - this.remainingSalesLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.remainingSalesLabel.Name = "remainingSalesLabel"; - this.remainingSalesLabel.Size = new System.Drawing.Size(170, 25); - this.remainingSalesLabel.TabIndex = 2; - this.remainingSalesLabel.Text = "Remaining Sales: "; - // - // salesProducedLabel - // - this.salesProducedLabel.AutoSize = true; - this.salesProducedLabel.Location = new System.Drawing.Point(0, 107); - this.salesProducedLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); - this.salesProducedLabel.Name = "salesProducedLabel"; - this.salesProducedLabel.Size = new System.Drawing.Size(300, 25); - this.salesProducedLabel.TabIndex = 1; - this.salesProducedLabel.Text = "Sales Produced By Ad Items (A):"; - // // departmentSalesLabel // this.departmentSalesLabel.AutoSize = true; - this.departmentSalesLabel.Location = new System.Drawing.Point(0, 72); + this.departmentSalesLabel.Location = new System.Drawing.Point(11, 61); this.departmentSalesLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); this.departmentSalesLabel.Name = "departmentSalesLabel"; this.departmentSalesLabel.Size = new System.Drawing.Size(179, 25); this.departmentSalesLabel.TabIndex = 0; this.departmentSalesLabel.Text = "Department Sales: "; // - // grossProfitGroupBox + // totalProfitReturnLabel // - this.grossProfitGroupBox.Controls.Add(this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel); - this.grossProfitGroupBox.Controls.Add(this.grossProfitDollarGrossProfitLabel); - this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel); - this.grossProfitGroupBox.Controls.Add(this.grossProfitTotalSales); - this.grossProfitGroupBox.Controls.Add(this.grossProfitLessCostOfSales); - this.grossProfitGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.grossProfitGroupBox.Location = new System.Drawing.Point(831, 6); - this.grossProfitGroupBox.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.grossProfitGroupBox.Name = "grossProfitGroupBox"; - this.grossProfitGroupBox.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.grossProfitGroupBox.Size = new System.Drawing.Size(438, 216); - this.grossProfitGroupBox.TabIndex = 2; - this.grossProfitGroupBox.TabStop = false; - this.grossProfitGroupBox.Text = "Gross Profit"; + this.totalProfitReturnLabel.AutoSize = true; + this.totalProfitReturnLabel.Location = new System.Drawing.Point(11, 221); + this.totalProfitReturnLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.totalProfitReturnLabel.Name = "totalProfitReturnLabel"; + this.totalProfitReturnLabel.Size = new System.Drawing.Size(178, 25); + this.totalProfitReturnLabel.TabIndex = 5; + this.totalProfitReturnLabel.Text = "Total Profit Return: "; // - // grossProfitEstimatedWeeklyDeptmartmentExpenseLabel + // salesProducedLabel // - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.AutoSize = true; - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(8, 177); - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Name = "grossProfitEstimatedWeeklyDeptmartmentExpenseLabel"; - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(368, 25); - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.TabIndex = 4; - this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly Department Expense: "; + this.salesProducedLabel.AutoSize = true; + this.salesProducedLabel.Location = new System.Drawing.Point(11, 93); + this.salesProducedLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.salesProducedLabel.Name = "salesProducedLabel"; + this.salesProducedLabel.Size = new System.Drawing.Size(300, 25); + this.salesProducedLabel.TabIndex = 1; + this.salesProducedLabel.Text = "Sales Produced By Ad Items (A):"; // - // grossProfitDollarGrossProfitLabel + // totalProfitReturnFromRemaingLabel // - this.grossProfitDollarGrossProfitLabel.AutoSize = true; - this.grossProfitDollarGrossProfitLabel.Location = new System.Drawing.Point(8, 107); - this.grossProfitDollarGrossProfitLabel.Name = "grossProfitDollarGrossProfitLabel"; - this.grossProfitDollarGrossProfitLabel.Size = new System.Drawing.Size(179, 25); - this.grossProfitDollarGrossProfitLabel.TabIndex = 2; - this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: "; + this.totalProfitReturnFromRemaingLabel.AutoSize = true; + this.totalProfitReturnFromRemaingLabel.Location = new System.Drawing.Point(11, 189); + this.totalProfitReturnFromRemaingLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.totalProfitReturnFromRemaingLabel.Name = "totalProfitReturnFromRemaingLabel"; + this.totalProfitReturnFromRemaingLabel.Size = new System.Drawing.Size(380, 25); + this.totalProfitReturnFromRemaingLabel.TabIndex = 4; + this.totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: "; // - // perfectGrossProfitLabel + // remainingSalesLabel // - this.perfectGrossProfitLabel.AutoSize = true; - this.perfectGrossProfitLabel.Location = new System.Drawing.Point(8, 142); - this.perfectGrossProfitLabel.Name = "perfectGrossProfitLabel"; - this.perfectGrossProfitLabel.Size = new System.Drawing.Size(196, 25); - this.perfectGrossProfitLabel.TabIndex = 3; - this.perfectGrossProfitLabel.Text = "Percent Gross Profit: "; + this.remainingSalesLabel.AutoSize = true; + this.remainingSalesLabel.Location = new System.Drawing.Point(11, 125); + this.remainingSalesLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.remainingSalesLabel.Name = "remainingSalesLabel"; + this.remainingSalesLabel.Size = new System.Drawing.Size(170, 25); + this.remainingSalesLabel.TabIndex = 2; + this.remainingSalesLabel.Text = "Remaining Sales: "; // - // grossProfitTotalSales + // totalProfitFromAdItemsLabel // - this.grossProfitTotalSales.AutoSize = true; - this.grossProfitTotalSales.Location = new System.Drawing.Point(8, 37); - this.grossProfitTotalSales.Name = "grossProfitTotalSales"; - this.grossProfitTotalSales.Size = new System.Drawing.Size(122, 25); - this.grossProfitTotalSales.TabIndex = 0; - this.grossProfitTotalSales.Text = "Total Sales: "; + this.totalProfitFromAdItemsLabel.AutoSize = true; + this.totalProfitFromAdItemsLabel.Location = new System.Drawing.Point(11, 157); + this.totalProfitFromAdItemsLabel.Margin = new System.Windows.Forms.Padding(5, 0, 5, 0); + this.totalProfitFromAdItemsLabel.Name = "totalProfitFromAdItemsLabel"; + this.totalProfitFromAdItemsLabel.Size = new System.Drawing.Size(342, 25); + this.totalProfitFromAdItemsLabel.TabIndex = 3; + this.totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): "; // - // grossProfitLessCostOfSales + // weeklySalesGroupBox // - this.grossProfitLessCostOfSales.AutoSize = true; - this.grossProfitLessCostOfSales.Location = new System.Drawing.Point(8, 72); - this.grossProfitLessCostOfSales.Name = "grossProfitLessCostOfSales"; - this.grossProfitLessCostOfSales.Size = new System.Drawing.Size(187, 25); - this.grossProfitLessCostOfSales.TabIndex = 1; - this.grossProfitLessCostOfSales.Text = "Less Cost of Sales: "; + this.weeklySalesGroupBox.Controls.Add(this.saturdayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.totalWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.thursdayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.fridayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.mondayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.tuesadayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.wednesdayWeeklySalesLabel); + this.weeklySalesGroupBox.Controls.Add(this.sundayWeeklySalesLabel); + this.weeklySalesGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.weeklySalesGroupBox.Location = new System.Drawing.Point(358, 3); + this.weeklySalesGroupBox.Name = "weeklySalesGroupBox"; + this.weeklySalesGroupBox.Size = new System.Drawing.Size(274, 323); + this.weeklySalesGroupBox.TabIndex = 3; + this.weeklySalesGroupBox.TabStop = false; + this.weeklySalesGroupBox.Text = "Weekly Sales"; // - // costAnalysisGroupBox + // saturdayWeeklySalesLabel // - this.costAnalysisGroupBox.Controls.Add(this.usePreRenderedFilesCheckbox); - this.costAnalysisGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.costAnalysisGroupBox.Location = new System.Drawing.Point(1277, 3); - this.costAnalysisGroupBox.Name = "costAnalysisGroupBox"; - this.costAnalysisGroupBox.Size = new System.Drawing.Size(444, 222); - this.costAnalysisGroupBox.TabIndex = 3; - this.costAnalysisGroupBox.TabStop = false; - this.costAnalysisGroupBox.Text = "Cost Analysis"; + this.saturdayWeeklySalesLabel.AutoSize = true; + this.saturdayWeeklySalesLabel.Location = new System.Drawing.Point(7, 221); + this.saturdayWeeklySalesLabel.Name = "saturdayWeeklySalesLabel"; + this.saturdayWeeklySalesLabel.Size = new System.Drawing.Size(97, 25); + this.saturdayWeeklySalesLabel.TabIndex = 7; + this.saturdayWeeklySalesLabel.Text = "Saturday:"; // - // usePreRenderedFilesCheckbox + // totalWeeklySalesLabel // - this.usePreRenderedFilesCheckbox.AutoSize = true; - this.usePreRenderedFilesCheckbox.Location = new System.Drawing.Point(206, 191); - this.usePreRenderedFilesCheckbox.Name = "usePreRenderedFilesCheckbox"; - this.usePreRenderedFilesCheckbox.Size = new System.Drawing.Size(239, 29); - this.usePreRenderedFilesCheckbox.TabIndex = 5; - this.usePreRenderedFilesCheckbox.Text = "Use Pre-rendered Files"; - this.usePreRenderedFilesCheckbox.UseVisualStyleBackColor = true; - this.usePreRenderedFilesCheckbox.Visible = false; + this.totalWeeklySalesLabel.AutoSize = true; + this.totalWeeklySalesLabel.Location = new System.Drawing.Point(7, 253); + this.totalWeeklySalesLabel.Name = "totalWeeklySalesLabel"; + this.totalWeeklySalesLabel.Size = new System.Drawing.Size(117, 25); + this.totalWeeklySalesLabel.TabIndex = 6; + this.totalWeeklySalesLabel.Text = "Total Sales:"; // - // dateSelectorPanel + // thursdayWeeklySalesLabel // - this.commentMainTableLayoutPanel.SetColumnSpan(this.dateSelectorPanel, 2); - this.dateSelectorPanel.Controls.Add(this.printPreviewButton); - this.dateSelectorPanel.Controls.Add(this.yearComboBox); - this.dateSelectorPanel.Controls.Add(this.dayComboBox); - this.dateSelectorPanel.Controls.Add(this.monthComboBox); - this.dateSelectorPanel.Controls.Add(this.dateSelectLabel); - this.dateSelectorPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.dateSelectorPanel.Location = new System.Drawing.Point(829, 231); - this.dateSelectorPanel.Name = "dateSelectorPanel"; - this.dateSelectorPanel.Size = new System.Drawing.Size(892, 52); - this.dateSelectorPanel.TabIndex = 4; + this.thursdayWeeklySalesLabel.AutoSize = true; + this.thursdayWeeklySalesLabel.Location = new System.Drawing.Point(7, 157); + this.thursdayWeeklySalesLabel.Name = "thursdayWeeklySalesLabel"; + this.thursdayWeeklySalesLabel.Size = new System.Drawing.Size(101, 25); + this.thursdayWeeklySalesLabel.TabIndex = 5; + this.thursdayWeeklySalesLabel.Text = "Thursday:"; // - // printPreviewButton + // fridayWeeklySalesLabel // - this.printPreviewButton.Location = new System.Drawing.Point(744, 0); - this.printPreviewButton.Name = "printPreviewButton"; - this.printPreviewButton.Size = new System.Drawing.Size(138, 49); - this.printPreviewButton.TabIndex = 4; - this.printPreviewButton.Text = "Print Preview"; - this.printPreviewButton.UseVisualStyleBackColor = true; - this.printPreviewButton.Visible = false; - this.printPreviewButton.Click += new System.EventHandler(this.DisplayPrintPreview); + this.fridayWeeklySalesLabel.AutoSize = true; + this.fridayWeeklySalesLabel.Location = new System.Drawing.Point(7, 189); + this.fridayWeeklySalesLabel.Name = "fridayWeeklySalesLabel"; + this.fridayWeeklySalesLabel.Size = new System.Drawing.Size(72, 25); + this.fridayWeeklySalesLabel.TabIndex = 4; + this.fridayWeeklySalesLabel.Text = "Friday:"; // - // yearComboBox + // mondayWeeklySalesLabel // - this.yearComboBox.FormattingEnabled = true; - this.yearComboBox.Location = new System.Drawing.Point(446, 13); - this.yearComboBox.Name = "yearComboBox"; - this.yearComboBox.Size = new System.Drawing.Size(111, 32); - this.yearComboBox.Sorted = true; - this.yearComboBox.TabIndex = 3; + this.mondayWeeklySalesLabel.AutoSize = true; + this.mondayWeeklySalesLabel.Location = new System.Drawing.Point(7, 61); + this.mondayWeeklySalesLabel.Name = "mondayWeeklySalesLabel"; + this.mondayWeeklySalesLabel.Size = new System.Drawing.Size(89, 25); + this.mondayWeeklySalesLabel.TabIndex = 3; + this.mondayWeeklySalesLabel.Text = "Monday:"; // - // dayComboBox + // tuesadayWeeklySalesLabel // - this.dayComboBox.FormattingEnabled = true; - this.dayComboBox.Location = new System.Drawing.Point(327, 13); - this.dayComboBox.Name = "dayComboBox"; - this.dayComboBox.Size = new System.Drawing.Size(111, 32); - this.dayComboBox.Sorted = true; - this.dayComboBox.TabIndex = 2; + this.tuesadayWeeklySalesLabel.AutoSize = true; + this.tuesadayWeeklySalesLabel.Location = new System.Drawing.Point(7, 93); + this.tuesadayWeeklySalesLabel.Name = "tuesadayWeeklySalesLabel"; + this.tuesadayWeeklySalesLabel.Size = new System.Drawing.Size(95, 25); + this.tuesadayWeeklySalesLabel.TabIndex = 2; + this.tuesadayWeeklySalesLabel.Text = "Tuesday:"; // - // monthComboBox + // wednesdayWeeklySalesLabel // - this.monthComboBox.FormattingEnabled = true; - this.monthComboBox.Location = new System.Drawing.Point(208, 13); - this.monthComboBox.Name = "monthComboBox"; - this.monthComboBox.Size = new System.Drawing.Size(111, 32); - this.monthComboBox.Sorted = true; - this.monthComboBox.TabIndex = 1; + this.wednesdayWeeklySalesLabel.AutoSize = true; + this.wednesdayWeeklySalesLabel.Location = new System.Drawing.Point(7, 125); + this.wednesdayWeeklySalesLabel.Name = "wednesdayWeeklySalesLabel"; + this.wednesdayWeeklySalesLabel.Size = new System.Drawing.Size(124, 25); + this.wednesdayWeeklySalesLabel.TabIndex = 1; + this.wednesdayWeeklySalesLabel.Text = "Wednesday:"; // - // dateSelectLabel + // sundayWeeklySalesLabel // - this.dateSelectLabel.AutoSize = true; - this.dateSelectLabel.Location = new System.Drawing.Point(7, 14); - this.dateSelectLabel.Name = "dateSelectLabel"; - this.dateSelectLabel.Size = new System.Drawing.Size(204, 25); - this.dateSelectLabel.TabIndex = 0; - this.dateSelectLabel.Text = "Select a Date to View:"; + this.sundayWeeklySalesLabel.AutoSize = true; + this.sundayWeeklySalesLabel.Location = new System.Drawing.Point(7, 29); + this.sundayWeeklySalesLabel.Name = "sundayWeeklySalesLabel"; + this.sundayWeeklySalesLabel.Size = new System.Drawing.Size(86, 25); + this.sundayWeeklySalesLabel.TabIndex = 0; + this.sundayWeeklySalesLabel.Text = "Sunday:"; + // + // taxableGroupBox + // + this.taxableGroupBox.Controls.Add(this.mondayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.tuesdayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.saturdayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.totalTaxableLabel); + this.taxableGroupBox.Controls.Add(this.fridayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.thursdayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.wednesdayTaxableLabel); + this.taxableGroupBox.Controls.Add(this.sundayTaxableLabel); + this.taxableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.taxableGroupBox.Location = new System.Drawing.Point(638, 3); + this.taxableGroupBox.Name = "taxableGroupBox"; + this.taxableGroupBox.Size = new System.Drawing.Size(274, 323); + this.taxableGroupBox.TabIndex = 4; + this.taxableGroupBox.TabStop = false; + this.taxableGroupBox.Text = "Taxable"; + // + // mondayTaxableLabel + // + this.mondayTaxableLabel.AutoSize = true; + this.mondayTaxableLabel.Location = new System.Drawing.Point(6, 61); + this.mondayTaxableLabel.Name = "mondayTaxableLabel"; + this.mondayTaxableLabel.Size = new System.Drawing.Size(89, 25); + this.mondayTaxableLabel.TabIndex = 7; + this.mondayTaxableLabel.Text = "Monday:"; + // + // tuesdayTaxableLabel + // + this.tuesdayTaxableLabel.AutoSize = true; + this.tuesdayTaxableLabel.Location = new System.Drawing.Point(6, 93); + this.tuesdayTaxableLabel.Name = "tuesdayTaxableLabel"; + this.tuesdayTaxableLabel.Size = new System.Drawing.Size(95, 25); + this.tuesdayTaxableLabel.TabIndex = 6; + this.tuesdayTaxableLabel.Text = "Tuesday:"; + // + // saturdayTaxableLabel + // + this.saturdayTaxableLabel.AutoSize = true; + this.saturdayTaxableLabel.Location = new System.Drawing.Point(6, 221); + this.saturdayTaxableLabel.Name = "saturdayTaxableLabel"; + this.saturdayTaxableLabel.Size = new System.Drawing.Size(97, 25); + this.saturdayTaxableLabel.TabIndex = 5; + this.saturdayTaxableLabel.Text = "Saturday:"; + // + // totalTaxableLabel + // + this.totalTaxableLabel.AutoSize = true; + this.totalTaxableLabel.Location = new System.Drawing.Point(6, 253); + this.totalTaxableLabel.Name = "totalTaxableLabel"; + this.totalTaxableLabel.Size = new System.Drawing.Size(62, 25); + this.totalTaxableLabel.TabIndex = 4; + this.totalTaxableLabel.Text = "Total:"; + // + // fridayTaxableLabel + // + this.fridayTaxableLabel.AutoSize = true; + this.fridayTaxableLabel.Location = new System.Drawing.Point(6, 189); + this.fridayTaxableLabel.Name = "fridayTaxableLabel"; + this.fridayTaxableLabel.Size = new System.Drawing.Size(72, 25); + this.fridayTaxableLabel.TabIndex = 3; + this.fridayTaxableLabel.Text = "Friday:"; + // + // thursdayTaxableLabel + // + this.thursdayTaxableLabel.AutoSize = true; + this.thursdayTaxableLabel.Location = new System.Drawing.Point(6, 157); + this.thursdayTaxableLabel.Name = "thursdayTaxableLabel"; + this.thursdayTaxableLabel.Size = new System.Drawing.Size(101, 25); + this.thursdayTaxableLabel.TabIndex = 2; + this.thursdayTaxableLabel.Text = "Thursday:"; + // + // wednesdayTaxableLabel + // + this.wednesdayTaxableLabel.AutoSize = true; + this.wednesdayTaxableLabel.Location = new System.Drawing.Point(6, 125); + this.wednesdayTaxableLabel.Name = "wednesdayTaxableLabel"; + this.wednesdayTaxableLabel.Size = new System.Drawing.Size(124, 25); + this.wednesdayTaxableLabel.TabIndex = 1; + this.wednesdayTaxableLabel.Text = "Wednesday:"; + // + // sundayTaxableLabel + // + this.sundayTaxableLabel.AutoSize = true; + this.sundayTaxableLabel.Location = new System.Drawing.Point(6, 29); + this.sundayTaxableLabel.Name = "sundayTaxableLabel"; + this.sundayTaxableLabel.Size = new System.Drawing.Size(86, 25); + this.sundayTaxableLabel.TabIndex = 0; + this.sundayTaxableLabel.Text = "Sunday:"; + // + // dateTimeGroupBox + // + this.dateTimeGroupBox.Controls.Add(this.monthCalendar); + this.dateTimeGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.dateTimeGroupBox.Location = new System.Drawing.Point(3, 3); + this.dateTimeGroupBox.Name = "dateTimeGroupBox"; + this.dateTimeGroupBox.Size = new System.Drawing.Size(349, 323); + this.dateTimeGroupBox.TabIndex = 5; + this.dateTimeGroupBox.TabStop = false; + this.dateTimeGroupBox.Text = "Select a date to view"; + // + // monthCalendar + // + this.monthCalendar.Location = new System.Drawing.Point(0, 23); + this.monthCalendar.MaxSelectionCount = 1; + this.monthCalendar.Name = "monthCalendar"; + this.monthCalendar.ShowTodayCircle = false; + this.monthCalendar.TabIndex = 0; // // mainViewTabControl // @@ -547,48 +592,45 @@ this.mainViewTabControl.Controls.Add(this.inventoryTabPage); this.mainViewTabControl.Controls.Add(this.actualSalesTab); this.mainViewTabControl.Controls.Add(this.suppliersTabPage); - this.mainViewTabControl.Controls.Add(this.WeeklySalesTabPage); - this.mainViewTabControl.Controls.Add(this.taxableTabPage); - this.mainViewTabControl.Controls.Add(this.debugTabPage); this.mainViewTabControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.mainViewTabControl.Location = new System.Drawing.Point(5, 47); + this.mainViewTabControl.Location = new System.Drawing.Point(5, 46); this.mainViewTabControl.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.mainViewTabControl.Name = "mainViewTabControl"; this.mainViewTabControl.SelectedIndex = 0; - this.mainViewTabControl.Size = new System.Drawing.Size(1724, 541); + this.mainViewTabControl.Size = new System.Drawing.Size(1375, 499); this.mainViewTabControl.TabIndex = 3; // // projectionTab // - this.projectionTab.Controls.Add(this.projectedSalesMainDataGrid); + this.projectionTab.Controls.Add(this.projectionsDataGridView); this.projectionTab.Location = new System.Drawing.Point(4, 33); this.projectionTab.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.projectionTab.Name = "projectionTab"; this.projectionTab.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.projectionTab.Size = new System.Drawing.Size(1716, 504); + this.projectionTab.Size = new System.Drawing.Size(1367, 462); this.projectionTab.TabIndex = 0; this.projectionTab.Text = "Projections"; this.projectionTab.UseVisualStyleBackColor = true; // - // projectedSalesMainDataGrid + // projectionsDataGridView // - this.projectedSalesMainDataGrid.AllowUserToAddRows = false; - this.projectedSalesMainDataGrid.AllowUserToDeleteRows = false; - this.projectedSalesMainDataGrid.AllowUserToResizeRows = false; - this.projectedSalesMainDataGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.projectedSalesMainDataGrid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - this.projectedSalesMainDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.projectedSalesMainDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; - this.projectedSalesMainDataGrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; - this.projectedSalesMainDataGrid.Location = new System.Drawing.Point(5, 6); - this.projectedSalesMainDataGrid.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.projectedSalesMainDataGrid.Name = "projectedSalesMainDataGrid"; - this.projectedSalesMainDataGrid.ReadOnly = true; - this.projectedSalesMainDataGrid.RowHeadersVisible = false; - this.projectedSalesMainDataGrid.ShowCellErrors = false; - this.projectedSalesMainDataGrid.ShowRowErrors = false; - this.projectedSalesMainDataGrid.Size = new System.Drawing.Size(1706, 492); - this.projectedSalesMainDataGrid.TabIndex = 0; + this.projectionsDataGridView.AllowUserToAddRows = false; + this.projectionsDataGridView.AllowUserToDeleteRows = false; + this.projectionsDataGridView.AllowUserToResizeRows = false; + this.projectionsDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.projectionsDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + this.projectionsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.projectionsDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.projectionsDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; + this.projectionsDataGridView.Location = new System.Drawing.Point(5, 6); + this.projectionsDataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.projectionsDataGridView.Name = "projectionsDataGridView"; + this.projectionsDataGridView.ReadOnly = true; + this.projectionsDataGridView.RowHeadersVisible = false; + this.projectionsDataGridView.ShowCellErrors = false; + this.projectionsDataGridView.ShowRowErrors = false; + this.projectionsDataGridView.Size = new System.Drawing.Size(1357, 450); + this.projectionsDataGridView.TabIndex = 0; // // inventoryTabPage // @@ -596,7 +638,7 @@ this.inventoryTabPage.Location = new System.Drawing.Point(4, 33); this.inventoryTabPage.Name = "inventoryTabPage"; this.inventoryTabPage.Padding = new System.Windows.Forms.Padding(3); - this.inventoryTabPage.Size = new System.Drawing.Size(1716, 504); + this.inventoryTabPage.Size = new System.Drawing.Size(1367, 462); this.inventoryTabPage.TabIndex = 4; this.inventoryTabPage.Text = "Inventory"; this.inventoryTabPage.UseVisualStyleBackColor = true; @@ -615,7 +657,7 @@ this.inventoryDataGridView.RowHeadersVisible = false; this.inventoryDataGridView.RowTemplate.Height = 28; this.inventoryDataGridView.ShowRowErrors = false; - this.inventoryDataGridView.Size = new System.Drawing.Size(1710, 498); + this.inventoryDataGridView.Size = new System.Drawing.Size(1361, 456); this.inventoryDataGridView.TabIndex = 0; // // actualSalesTab @@ -624,7 +666,7 @@ this.actualSalesTab.Location = new System.Drawing.Point(4, 33); this.actualSalesTab.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.actualSalesTab.Name = "actualSalesTab"; - this.actualSalesTab.Size = new System.Drawing.Size(1716, 504); + this.actualSalesTab.Size = new System.Drawing.Size(1367, 462); this.actualSalesTab.TabIndex = 2; this.actualSalesTab.Text = "Actual Sales"; this.actualSalesTab.UseVisualStyleBackColor = true; @@ -633,149 +675,257 @@ // this.actualSalesMainLayoutPanel.ColumnCount = 1; this.actualSalesMainLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.actualSalesMainLayoutPanel.Controls.Add(this.actualSalesMainDataGidView, 0, 0); + this.actualSalesMainLayoutPanel.Controls.Add(this.actualSalesDataGridView, 0, 0); this.actualSalesMainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.actualSalesMainLayoutPanel.Location = new System.Drawing.Point(0, 0); this.actualSalesMainLayoutPanel.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.actualSalesMainLayoutPanel.Name = "actualSalesMainLayoutPanel"; this.actualSalesMainLayoutPanel.RowCount = 1; this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 504F)); - this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1716, 504); + this.actualSalesMainLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 462F)); + this.actualSalesMainLayoutPanel.Size = new System.Drawing.Size(1367, 462); this.actualSalesMainLayoutPanel.TabIndex = 0; // - // actualSalesMainDataGidView + // actualSalesDataGridView // - this.actualSalesMainDataGidView.AllowUserToAddRows = false; - this.actualSalesMainDataGidView.AllowUserToDeleteRows = false; - this.actualSalesMainDataGidView.AllowUserToResizeRows = false; - this.actualSalesMainDataGidView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.actualSalesMainDataGidView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - this.actualSalesMainDataGidView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.actualSalesMainDataGidView.Dock = System.Windows.Forms.DockStyle.Fill; - this.actualSalesMainDataGidView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; - this.actualSalesMainDataGidView.Location = new System.Drawing.Point(5, 6); - this.actualSalesMainDataGidView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.actualSalesMainDataGidView.Name = "actualSalesMainDataGidView"; - this.actualSalesMainDataGidView.ReadOnly = true; - this.actualSalesMainDataGidView.RowHeadersVisible = false; - this.actualSalesMainDataGidView.ShowCellErrors = false; - this.actualSalesMainDataGidView.ShowRowErrors = false; - this.actualSalesMainDataGidView.Size = new System.Drawing.Size(1706, 492); - this.actualSalesMainDataGidView.TabIndex = 1; + this.actualSalesDataGridView.AllowUserToAddRows = false; + this.actualSalesDataGridView.AllowUserToDeleteRows = false; + this.actualSalesDataGridView.AllowUserToResizeRows = false; + this.actualSalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.actualSalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + this.actualSalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.actualSalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.actualSalesDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; + this.actualSalesDataGridView.Location = new System.Drawing.Point(5, 6); + this.actualSalesDataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.actualSalesDataGridView.Name = "actualSalesDataGridView"; + this.actualSalesDataGridView.ReadOnly = true; + this.actualSalesDataGridView.RowHeadersVisible = false; + this.actualSalesDataGridView.ShowCellErrors = false; + this.actualSalesDataGridView.ShowRowErrors = false; + this.actualSalesDataGridView.Size = new System.Drawing.Size(1357, 450); + this.actualSalesDataGridView.TabIndex = 1; // // suppliersTabPage // - this.suppliersTabPage.Controls.Add(this.suppliersDataGridView); + this.suppliersTabPage.Controls.Add(this.invoicesDataGridView); this.suppliersTabPage.Location = new System.Drawing.Point(4, 33); this.suppliersTabPage.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); this.suppliersTabPage.Name = "suppliersTabPage"; this.suppliersTabPage.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.suppliersTabPage.Size = new System.Drawing.Size(1716, 504); + this.suppliersTabPage.Size = new System.Drawing.Size(1367, 462); this.suppliersTabPage.TabIndex = 1; - this.suppliersTabPage.Text = "Suppliers"; + this.suppliersTabPage.Text = "Invoices"; this.suppliersTabPage.UseVisualStyleBackColor = true; // - // suppliersDataGridView + // invoicesDataGridView // - this.suppliersDataGridView.AllowUserToAddRows = false; - this.suppliersDataGridView.AllowUserToDeleteRows = false; - this.suppliersDataGridView.AllowUserToResizeRows = false; - this.suppliersDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.suppliersDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - this.suppliersDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.suppliersDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.suppliersDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; - this.suppliersDataGridView.Location = new System.Drawing.Point(5, 6); - this.suppliersDataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.suppliersDataGridView.Name = "suppliersDataGridView"; - this.suppliersDataGridView.ReadOnly = true; - this.suppliersDataGridView.RowHeadersVisible = false; - this.suppliersDataGridView.Size = new System.Drawing.Size(1706, 492); - this.suppliersDataGridView.TabIndex = 0; + this.invoicesDataGridView.AllowUserToAddRows = false; + this.invoicesDataGridView.AllowUserToDeleteRows = false; + this.invoicesDataGridView.AllowUserToResizeRows = false; + this.invoicesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; + this.invoicesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; + this.invoicesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.invoicesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; + this.invoicesDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; + this.invoicesDataGridView.Location = new System.Drawing.Point(5, 6); + this.invoicesDataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.invoicesDataGridView.Name = "invoicesDataGridView"; + this.invoicesDataGridView.ReadOnly = true; + this.invoicesDataGridView.RowHeadersVisible = false; + this.invoicesDataGridView.Size = new System.Drawing.Size(1357, 450); + this.invoicesDataGridView.TabIndex = 0; // - // WeeklySalesTabPage + // commentsAndAnalysisLayoutPanel // - this.WeeklySalesTabPage.Controls.Add(this.weeklySalesDataGridView); - this.WeeklySalesTabPage.Location = new System.Drawing.Point(4, 33); - this.WeeklySalesTabPage.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.WeeklySalesTabPage.Name = "WeeklySalesTabPage"; - this.WeeklySalesTabPage.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.WeeklySalesTabPage.Size = new System.Drawing.Size(1716, 504); - this.WeeklySalesTabPage.TabIndex = 3; - this.WeeklySalesTabPage.Text = "Weekly Sales"; - this.WeeklySalesTabPage.UseVisualStyleBackColor = true; + this.commentsAndAnalysisLayoutPanel.ColumnCount = 1; + this.commentsAndAnalysisLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.commentsAndAnalysisLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.commentsAndAnalysisLayoutPanel.Controls.Add(this.costAnalysisGroupBox, 0, 1); + this.commentsAndAnalysisLayoutPanel.Controls.Add(this.commentMainGroupBox, 0, 0); + this.commentsAndAnalysisLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.commentsAndAnalysisLayoutPanel.Location = new System.Drawing.Point(1388, 43); + this.commentsAndAnalysisLayoutPanel.Name = "commentsAndAnalysisLayoutPanel"; + this.commentsAndAnalysisLayoutPanel.RowCount = 2; + this.commentsAndAnalysisLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.commentsAndAnalysisLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.commentsAndAnalysisLayoutPanel.Size = new System.Drawing.Size(456, 505); + this.commentsAndAnalysisLayoutPanel.TabIndex = 6; // - // weeklySalesDataGridView + // costAnalysisGroupBox // - this.weeklySalesDataGridView.AllowUserToAddRows = false; - this.weeklySalesDataGridView.AllowUserToDeleteRows = false; - this.weeklySalesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; - this.weeklySalesDataGridView.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells; - this.weeklySalesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.weeklySalesDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.weeklySalesDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnKeystroke; - this.weeklySalesDataGridView.Location = new System.Drawing.Point(5, 6); - this.weeklySalesDataGridView.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); - this.weeklySalesDataGridView.Name = "weeklySalesDataGridView"; - this.weeklySalesDataGridView.ReadOnly = true; - this.weeklySalesDataGridView.RowHeadersVisible = false; - this.weeklySalesDataGridView.Size = new System.Drawing.Size(1706, 492); - this.weeklySalesDataGridView.TabIndex = 0; + this.costAnalysisGroupBox.Controls.Add(this.informationLabel); + this.costAnalysisGroupBox.Controls.Add(this.suppliesLabel); + this.costAnalysisGroupBox.Controls.Add(this.salaryDollarsLabel); + this.costAnalysisGroupBox.Controls.Add(this.salaryPercentageLabel); + this.costAnalysisGroupBox.Controls.Add(this.salesPerManHourLabel); + this.costAnalysisGroupBox.Controls.Add(this.button1); + this.costAnalysisGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.costAnalysisGroupBox.Location = new System.Drawing.Point(3, 255); + this.costAnalysisGroupBox.Name = "costAnalysisGroupBox"; + this.costAnalysisGroupBox.Size = new System.Drawing.Size(450, 247); + this.costAnalysisGroupBox.TabIndex = 4; + this.costAnalysisGroupBox.TabStop = false; + this.costAnalysisGroupBox.Text = "Cost Analysis"; // - // taxableTabPage + // informationLabel // - this.taxableTabPage.Controls.Add(this.taxableDataGridView); - this.taxableTabPage.Location = new System.Drawing.Point(4, 33); - this.taxableTabPage.Name = "taxableTabPage"; - this.taxableTabPage.Padding = new System.Windows.Forms.Padding(3); - this.taxableTabPage.Size = new System.Drawing.Size(1716, 504); - this.taxableTabPage.TabIndex = 5; - this.taxableTabPage.Text = "Taxable"; - this.taxableTabPage.UseVisualStyleBackColor = true; + this.informationLabel.AutoSize = true; + this.informationLabel.Location = new System.Drawing.Point(13, 178); + this.informationLabel.Name = "informationLabel"; + this.informationLabel.Size = new System.Drawing.Size(43, 25); + this.informationLabel.TabIndex = 9; + this.informationLabel.Text = "info"; // - // taxableDataGridView + // suppliesLabel // - this.taxableDataGridView.AllowUserToAddRows = false; - this.taxableDataGridView.AllowUserToDeleteRows = false; - this.taxableDataGridView.AllowUserToResizeRows = false; - this.taxableDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.taxableDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.taxableDataGridView.Location = new System.Drawing.Point(3, 3); - this.taxableDataGridView.Name = "taxableDataGridView"; - this.taxableDataGridView.ReadOnly = true; - this.taxableDataGridView.RowTemplate.Height = 31; - this.taxableDataGridView.Size = new System.Drawing.Size(1710, 498); - this.taxableDataGridView.TabIndex = 0; + this.suppliesLabel.AutoSize = true; + this.suppliesLabel.Location = new System.Drawing.Point(8, 149); + this.suppliesLabel.Name = "suppliesLabel"; + this.suppliesLabel.Size = new System.Drawing.Size(94, 25); + this.suppliesLabel.TabIndex = 8; + this.suppliesLabel.Text = "Supplies:"; // - // debugTabPage + // salaryDollarsLabel // - this.debugTabPage.Controls.Add(this.monthCalendar); - this.debugTabPage.Location = new System.Drawing.Point(4, 33); - this.debugTabPage.Name = "debugTabPage"; - this.debugTabPage.Padding = new System.Windows.Forms.Padding(3); - this.debugTabPage.Size = new System.Drawing.Size(1716, 504); - this.debugTabPage.TabIndex = 6; - this.debugTabPage.Text = "Debug"; - this.debugTabPage.UseVisualStyleBackColor = true; + this.salaryDollarsLabel.AutoSize = true; + this.salaryDollarsLabel.Location = new System.Drawing.Point(8, 109); + this.salaryDollarsLabel.Name = "salaryDollarsLabel"; + this.salaryDollarsLabel.Size = new System.Drawing.Size(139, 25); + this.salaryDollarsLabel.TabIndex = 7; + this.salaryDollarsLabel.Text = "Salary Dollars:"; // - // monthCalendar + // salaryPercentageLabel // - this.monthCalendar.Location = new System.Drawing.Point(12, 12); - this.monthCalendar.MaxSelectionCount = 1; - this.monthCalendar.MonthlyBoldedDates = new System.DateTime[] { - new System.DateTime(2017, 1, 1, 0, 0, 0, 0)}; - this.monthCalendar.Name = "monthCalendar"; - this.monthCalendar.ShowTodayCircle = false; - this.monthCalendar.ShowWeekNumbers = true; - this.monthCalendar.TabIndex = 0; - this.monthCalendar.TabStop = false; + this.salaryPercentageLabel.AutoSize = true; + this.salaryPercentageLabel.Location = new System.Drawing.Point(8, 69); + this.salaryPercentageLabel.Name = "salaryPercentageLabel"; + this.salaryPercentageLabel.Size = new System.Drawing.Size(179, 25); + this.salaryPercentageLabel.TabIndex = 6; + this.salaryPercentageLabel.Text = "Salary Percentage:"; + // + // salesPerManHourLabel + // + this.salesPerManHourLabel.AutoSize = true; + this.salesPerManHourLabel.Location = new System.Drawing.Point(8, 29); + this.salesPerManHourLabel.Name = "salesPerManHourLabel"; + this.salesPerManHourLabel.Size = new System.Drawing.Size(194, 25); + this.salesPerManHourLabel.TabIndex = 5; + this.salesPerManHourLabel.Text = "Sales Per Man Hour:"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(37, 303); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(138, 49); + this.button1.TabIndex = 4; + this.button1.Text = "Print Preview"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Visible = false; + // + // commentMainGroupBox + // + this.commentMainGroupBox.Controls.Add(this.commentsTextBox); + this.commentMainGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.commentMainGroupBox.Location = new System.Drawing.Point(5, 6); + this.commentMainGroupBox.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.commentMainGroupBox.Name = "commentMainGroupBox"; + this.commentMainGroupBox.Padding = new System.Windows.Forms.Padding(5, 6, 5, 6); + this.commentMainGroupBox.Size = new System.Drawing.Size(446, 240); + this.commentMainGroupBox.TabIndex = 1; + this.commentMainGroupBox.TabStop = false; + this.commentMainGroupBox.Text = "Comments"; + // + // commentsTextBox + // + this.commentsTextBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.commentsTextBox.Enabled = false; + this.commentsTextBox.Location = new System.Drawing.Point(5, 28); + this.commentsTextBox.Multiline = true; + this.commentsTextBox.Name = "commentsTextBox"; + this.commentsTextBox.ReadOnly = true; + this.commentsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.commentsTextBox.Size = new System.Drawing.Size(436, 206); + this.commentsTextBox.TabIndex = 0; + // + // grossProfitGroupBox + // + this.grossProfitGroupBox.Controls.Add(this.usePreRenderedFilesCheckbox); + this.grossProfitGroupBox.Controls.Add(this.grossProfitLessCostOfSales); + this.grossProfitGroupBox.Controls.Add(this.printPreviewButton); + this.grossProfitGroupBox.Controls.Add(this.grossProfitTotalSales); + this.grossProfitGroupBox.Controls.Add(this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel); + this.grossProfitGroupBox.Controls.Add(this.perfectGrossProfitLabel); + this.grossProfitGroupBox.Controls.Add(this.grossProfitDollarGrossProfitLabel); + this.grossProfitGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.grossProfitGroupBox.Location = new System.Drawing.Point(1388, 554); + this.grossProfitGroupBox.Name = "grossProfitGroupBox"; + this.grossProfitGroupBox.Size = new System.Drawing.Size(456, 335); + this.grossProfitGroupBox.TabIndex = 7; + this.grossProfitGroupBox.TabStop = false; + this.grossProfitGroupBox.Text = "Gross Profit"; + // + // usePreRenderedFilesCheckbox + // + this.usePreRenderedFilesCheckbox.AutoSize = true; + this.usePreRenderedFilesCheckbox.Location = new System.Drawing.Point(40, 288); + this.usePreRenderedFilesCheckbox.Name = "usePreRenderedFilesCheckbox"; + this.usePreRenderedFilesCheckbox.Size = new System.Drawing.Size(239, 29); + this.usePreRenderedFilesCheckbox.TabIndex = 5; + this.usePreRenderedFilesCheckbox.Text = "Use Pre-rendered Files"; + this.usePreRenderedFilesCheckbox.UseVisualStyleBackColor = true; + this.usePreRenderedFilesCheckbox.Visible = false; + // + // grossProfitLessCostOfSales + // + this.grossProfitLessCostOfSales.AutoSize = true; + this.grossProfitLessCostOfSales.Location = new System.Drawing.Point(6, 67); + this.grossProfitLessCostOfSales.Name = "grossProfitLessCostOfSales"; + this.grossProfitLessCostOfSales.Size = new System.Drawing.Size(187, 25); + this.grossProfitLessCostOfSales.TabIndex = 1; + this.grossProfitLessCostOfSales.Text = "Less Cost of Sales: "; + // + // grossProfitTotalSales + // + this.grossProfitTotalSales.AutoSize = true; + this.grossProfitTotalSales.Location = new System.Drawing.Point(6, 35); + this.grossProfitTotalSales.Name = "grossProfitTotalSales"; + this.grossProfitTotalSales.Size = new System.Drawing.Size(122, 25); + this.grossProfitTotalSales.TabIndex = 0; + this.grossProfitTotalSales.Text = "Total Sales: "; + // + // grossProfitEstimatedWeeklyDeptmartmentExpenseLabel + // + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.AutoSize = true; + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Location = new System.Drawing.Point(6, 163); + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Name = "grossProfitEstimatedWeeklyDeptmartmentExpenseLabel"; + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Size = new System.Drawing.Size(368, 25); + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.TabIndex = 4; + this.grossProfitEstimatedWeeklyDeptmartmentExpenseLabel.Text = "Estimated Weekly Department Expense: "; + // + // perfectGrossProfitLabel + // + this.perfectGrossProfitLabel.AutoSize = true; + this.perfectGrossProfitLabel.Location = new System.Drawing.Point(6, 131); + this.perfectGrossProfitLabel.Name = "perfectGrossProfitLabel"; + this.perfectGrossProfitLabel.Size = new System.Drawing.Size(196, 25); + this.perfectGrossProfitLabel.TabIndex = 3; + this.perfectGrossProfitLabel.Text = "Percent Gross Profit: "; + // + // grossProfitDollarGrossProfitLabel + // + this.grossProfitDollarGrossProfitLabel.AutoSize = true; + this.grossProfitDollarGrossProfitLabel.Location = new System.Drawing.Point(6, 99); + this.grossProfitDollarGrossProfitLabel.Name = "grossProfitDollarGrossProfitLabel"; + this.grossProfitDollarGrossProfitLabel.Size = new System.Drawing.Size(179, 25); + this.grossProfitDollarGrossProfitLabel.TabIndex = 2; + this.grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: "; // // FrmMain // this.AutoScaleDimensions = new System.Drawing.SizeF(168F, 168F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.ClientSize = new System.Drawing.Size(1734, 892); + this.ClientSize = new System.Drawing.Size(1847, 892); this.Controls.Add(this.mainTableLayoutPanel); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Margin = new System.Windows.Forms.Padding(5, 6, 5, 6); @@ -784,99 +934,113 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Advertising Profit Control"; this.Load += new System.EventHandler(this.frmMain_Load); - this.mainTableLayoutPanel.ResumeLayout(false); - this.mainTableLayoutPanel.PerformLayout(); this.mainMenu.ResumeLayout(false); this.mainMenu.PerformLayout(); + this.mainTableLayoutPanel.ResumeLayout(false); + this.mainTableLayoutPanel.PerformLayout(); this.commentMainTableLayoutPanel.ResumeLayout(false); - this.commentMainGroupBox.ResumeLayout(false); - this.commentMainGroupBox.PerformLayout(); this.profitAnalysisMainGroupBox.ResumeLayout(false); this.profitAnalysisMainGroupBox.PerformLayout(); - this.grossProfitGroupBox.ResumeLayout(false); - this.grossProfitGroupBox.PerformLayout(); - this.costAnalysisGroupBox.ResumeLayout(false); - this.costAnalysisGroupBox.PerformLayout(); - this.dateSelectorPanel.ResumeLayout(false); - this.dateSelectorPanel.PerformLayout(); + this.weeklySalesGroupBox.ResumeLayout(false); + this.weeklySalesGroupBox.PerformLayout(); + this.taxableGroupBox.ResumeLayout(false); + this.taxableGroupBox.PerformLayout(); + this.dateTimeGroupBox.ResumeLayout(false); this.mainViewTabControl.ResumeLayout(false); this.projectionTab.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.projectedSalesMainDataGrid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.projectionsDataGridView)).EndInit(); this.inventoryTabPage.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.inventoryDataGridView)).EndInit(); this.actualSalesTab.ResumeLayout(false); this.actualSalesMainLayoutPanel.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.actualSalesMainDataGidView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.actualSalesDataGridView)).EndInit(); this.suppliersTabPage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.suppliersDataGridView)).EndInit(); - this.WeeklySalesTabPage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.weeklySalesDataGridView)).EndInit(); - this.taxableTabPage.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.taxableDataGridView)).EndInit(); - this.debugTabPage.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.invoicesDataGridView)).EndInit(); + this.commentsAndAnalysisLayoutPanel.ResumeLayout(false); + this.costAnalysisGroupBox.ResumeLayout(false); + this.costAnalysisGroupBox.PerformLayout(); + this.commentMainGroupBox.ResumeLayout(false); + this.commentMainGroupBox.PerformLayout(); + this.grossProfitGroupBox.ResumeLayout(false); + this.grossProfitGroupBox.PerformLayout(); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.TableLayoutPanel mainTableLayoutPanel; + private System.Windows.Forms.Button printPreviewButton; private System.Windows.Forms.MenuStrip mainMenu; - private System.Windows.Forms.ToolStripMenuItem fileMainMenu; + private System.Windows.Forms.TableLayoutPanel mainTableLayoutPanel; private System.Windows.Forms.TableLayoutPanel commentMainTableLayoutPanel; - private System.Windows.Forms.GroupBox commentMainGroupBox; - private System.Windows.Forms.GroupBox profitAnalysisMainGroupBox; - private System.Windows.Forms.GroupBox grossProfitGroupBox; - private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu; - private System.Windows.Forms.TabControl mainViewTabControl; - private System.Windows.Forms.TabPage projectionTab; - private System.Windows.Forms.TabPage suppliersTabPage; - private System.Windows.Forms.DataGridView suppliersDataGridView; - private System.Windows.Forms.TabPage actualSalesTab; - private System.Windows.Forms.TableLayoutPanel actualSalesMainLayoutPanel; - private System.Windows.Forms.DataGridView actualSalesMainDataGidView; - private System.Windows.Forms.DataGridView projectedSalesMainDataGrid; - private System.Windows.Forms.ToolStripMenuItem recordsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem addRecordsToolStripMenuItem; + private System.Windows.Forms.LinkLabel shrinkLinkLabel; private System.Windows.Forms.Label totalProfitReturnLabel; private System.Windows.Forms.Label totalProfitReturnFromRemaingLabel; private System.Windows.Forms.Label totalProfitFromAdItemsLabel; private System.Windows.Forms.Label remainingSalesLabel; private System.Windows.Forms.Label salesProducedLabel; private System.Windows.Forms.Label departmentSalesLabel; - private System.Windows.Forms.TabPage WeeklySalesTabPage; - private System.Windows.Forms.DataGridView weeklySalesDataGridView; - private System.Windows.Forms.ToolStripMenuItem helpMainMenu; - private System.Windows.Forms.ToolStripMenuItem showHideConsoleHelpMainMenu; - private System.Windows.Forms.GroupBox costAnalysisGroupBox; private System.Windows.Forms.Label grossProfitEstimatedWeeklyDeptmartmentExpenseLabel; - private System.Windows.Forms.Label perfectGrossProfitLabel; private System.Windows.Forms.Label grossProfitDollarGrossProfitLabel; - private System.Windows.Forms.Label grossProfitLessCostOfSales; + private System.Windows.Forms.Label perfectGrossProfitLabel; private System.Windows.Forms.Label grossProfitTotalSales; - private System.Windows.Forms.Panel dateSelectorPanel; - private System.Windows.Forms.ComboBox yearComboBox; - private System.Windows.Forms.ComboBox dayComboBox; - private System.Windows.Forms.ComboBox monthComboBox; - private System.Windows.Forms.Label dateSelectLabel; - private System.Windows.Forms.TabPage inventoryTabPage; - private System.Windows.Forms.DataGridView inventoryDataGridView; + private System.Windows.Forms.Label grossProfitLessCostOfSales; + private System.Windows.Forms.CheckBox usePreRenderedFilesCheckbox; + private System.Windows.Forms.TableLayoutPanel commentsAndAnalysisLayoutPanel; + private System.Windows.Forms.GroupBox commentMainGroupBox; + private System.Windows.Forms.TextBox commentsTextBox; + private System.Windows.Forms.ToolStripMenuItem fileMainMenu; + private System.Windows.Forms.ToolStripMenuItem exitFileMainMenu; + private System.Windows.Forms.ToolStripMenuItem recordsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addRecordsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem modifyRecordMainMenu; + private System.Windows.Forms.ToolStripMenuItem deleteRecordsMainMenu; private System.Windows.Forms.ToolStripMenuItem toolsMainMenu; private System.Windows.Forms.ToolStripMenuItem adSpecialKeyWordsToolsMainMenu; - private System.Windows.Forms.ToolStripMenuItem deleteRecordsMainMenu; - private System.Windows.Forms.TextBox commentsTextBox; - private System.Windows.Forms.ToolStripMenuItem modifyRecordMainMenu; private System.Windows.Forms.ToolStripMenuItem manageItemsToolsMainMenu; + private System.Windows.Forms.ToolStripMenuItem helpMainMenu; + private System.Windows.Forms.ToolStripMenuItem showHideConsoleHelpMainMenu; private System.Windows.Forms.ToolStripMenuItem dbVersionHelpMainMenu; - private System.Windows.Forms.Button printPreviewButton; - private System.Windows.Forms.CheckBox usePreRenderedFilesCheckbox; - private System.Windows.Forms.ToolStripMenuItem newFormTestToolStripMenuItem; - private System.Windows.Forms.LinkLabel shrinkLinkLabel; - private System.Windows.Forms.TabPage taxableTabPage; - private System.Windows.Forms.DataGridView taxableDataGridView; - private System.Windows.Forms.TabPage debugTabPage; + private System.Windows.Forms.GroupBox profitAnalysisMainGroupBox; + private System.Windows.Forms.GroupBox weeklySalesGroupBox; + private System.Windows.Forms.Label saturdayWeeklySalesLabel; + private System.Windows.Forms.Label totalWeeklySalesLabel; + private System.Windows.Forms.Label thursdayWeeklySalesLabel; + private System.Windows.Forms.Label fridayWeeklySalesLabel; + private System.Windows.Forms.Label mondayWeeklySalesLabel; + private System.Windows.Forms.Label tuesadayWeeklySalesLabel; + private System.Windows.Forms.Label wednesdayWeeklySalesLabel; + private System.Windows.Forms.Label sundayWeeklySalesLabel; + private System.Windows.Forms.GroupBox taxableGroupBox; + private System.Windows.Forms.Label mondayTaxableLabel; + private System.Windows.Forms.Label tuesdayTaxableLabel; + private System.Windows.Forms.Label saturdayTaxableLabel; + private System.Windows.Forms.Label totalTaxableLabel; + private System.Windows.Forms.Label fridayTaxableLabel; + private System.Windows.Forms.Label thursdayTaxableLabel; + private System.Windows.Forms.Label wednesdayTaxableLabel; + private System.Windows.Forms.Label sundayTaxableLabel; + private System.Windows.Forms.GroupBox dateTimeGroupBox; private System.Windows.Forms.MonthCalendar monthCalendar; - private System.Windows.Forms.ToolStripMenuItem newModifyRecordToolStripMenuItem; + private System.Windows.Forms.GroupBox costAnalysisGroupBox; + private System.Windows.Forms.Label suppliesLabel; + private System.Windows.Forms.Label salaryDollarsLabel; + private System.Windows.Forms.Label salaryPercentageLabel; + private System.Windows.Forms.Label salesPerManHourLabel; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.GroupBox grossProfitGroupBox; + private System.Windows.Forms.Label errorLabel; + private System.Windows.Forms.Label informationLabel; + private System.Windows.Forms.TabControl mainViewTabControl; + private System.Windows.Forms.TabPage projectionTab; + private System.Windows.Forms.DataGridView projectionsDataGridView; + private System.Windows.Forms.TabPage inventoryTabPage; + private System.Windows.Forms.DataGridView inventoryDataGridView; + private System.Windows.Forms.TabPage actualSalesTab; + private System.Windows.Forms.TableLayoutPanel actualSalesMainLayoutPanel; + private System.Windows.Forms.DataGridView actualSalesDataGridView; + private System.Windows.Forms.TabPage suppliersTabPage; + private System.Windows.Forms.DataGridView invoicesDataGridView; } } diff --git a/AdvertsingProfitControl/FrmMain.cs b/AdvertsingProfitControl/FrmMain.cs index 442075b..1a20445 100644 --- a/AdvertsingProfitControl/FrmMain.cs +++ b/AdvertsingProfitControl/FrmMain.cs @@ -13,11 +13,10 @@ namespace AdvertsingProfitControl { public partial class FrmMain : Form { - private double _SalesProducedByAdItems = 0; - private double _TotalProfitReturnFromAdItems = 0; - private double _gCostOfSalesCalculatedTotal = 0; - private double _departmentSales = 0; - private List _gDateStringCollection = new List(); + private double _salesProducedByAdItems; + private double _totalProfitReturnFromAdItems; + private double _totalInvoicePurchases; //Total Purchases + private double _departmentSales; //weekly sales total readonly FrmLogConsole _console = FrmLogConsole.GetStaticInstance; private int _LazyPageCounter = 0; @@ -31,396 +30,93 @@ namespace AdvertsingProfitControl var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); RowParsing.AdSpecialGroups.AddRange(databaseReader.ReturnGroupNameList(databaseTracker.DatabaseConnectionString)); - FillDateSuggestionComboBoxes(); - BuildAndFillDataGridTables(); + ConstructApcDataGridViews(); + ConstructInvoicesDataGridView(); + var date = databaseReader.RetrieveMostRecentDate(databaseTracker.DatabaseConnectionString); + monthCalendar.SelectionStart = date; + LoadDate(date); CalculateProfitAnalysis(); CalculateGrossProfit(); - projectedSalesMainDataGrid.KeyDown += FrmMain_KeyDown; + //projectionsDataGridView.KeyDown += FrmMain_KeyDown; //var margin = new Margins(50, 50, 0, 0); //_printDoc.DefaultPageSettings.Margins = margin; } - private void FrmMain_KeyDown(object sender, KeyEventArgs e) - { - if (e.Modifiers == Keys.Shift && e.KeyCode == Keys.Up) - { - MessageBox.Show("My message"); - } - } - - private void UpdateDataGridViewInformation(object sender, EventArgs e) - { - var dateString = monthComboBox.Text + "/" + dayComboBox.Text + "/" + yearComboBox.Text; - BuildAndFillDataGridTables(dateString); - CalculateProfitAnalysis(); - CalculateGrossProfit(); - } - - /// - /// Builds and fills the DataGridView tables on the main form - /// from the either the most recent date or the date specified in the parameter. - /// - /// The date of records to display to the user, if no date is specified then the most recent date is used. - private void BuildAndFillDataGridTables(string dateString = "") - { - // - var databaseTracker = new DatabaseTracker(); - var dataBaseReader = new DatabaseReader(); - // - var dateId = ""; - - //Check to see if a parameter has been passed. - if (dateString == "") - { - //IF non were, then grab the most recent date ID from the database and use that. - dateId = dataBaseReader.RetrieveMostRecentDateId(databaseTracker.DatabaseConnectionString); - _console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Most recent date ID is " + dateId : "Most recent date ID is unavailable."); - } - else - { - //ELSE IF one was passed, then use it's ID to build the tables. - dateId = dataBaseReader.RetrieveDateIdByDateString(dateString, databaseTracker.DatabaseConnectionString).ToString(); - _console.WriteToLog(FrmLogConsole.Level.Info, dateId != "0" ? "Date ID for " + dateString + " is resolved to have the ID of " + dateId + "." : "The date " + dateString + " could not be found in the database."); - if (dateId == "0") - { - _gDateStringCollection.Remove(dateString); - } - } - //Now check to make sure there were no errors grabbing the ID, IF there were return. - if (dateId == "0") return; - //Clear the class global variables to prevents calculation mishaps. - _SalesProducedByAdItems = 0; - _TotalProfitReturnFromAdItems = 0; - _gCostOfSalesCalculatedTotal = 0; - //Clear all DataGridViews since the date supplied is valid and in the database. - projectedSalesMainDataGrid.DataSource = null; - projectedSalesMainDataGrid.Columns.Clear(); - inventoryDataGridView.DataSource = null; - inventoryDataGridView.Columns.Clear(); - actualSalesMainDataGidView.DataSource = null; - actualSalesMainDataGidView.Columns.Clear(); - suppliersDataGridView.DataSource = null; - weeklySalesDataGridView.DataSource = null; - //Begin by grabbing the Projections table - var tempTable = dataBaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString); - if (tempTable.Rows.Count > 0) - { - BuildSalesDataGridViews(projectedSalesMainDataGrid, tempTable); - } - - //Grabbing the Inventory table - tempTable = dataBaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString); - if (tempTable.Rows.Count > 0) - { - BuildInventoryDataGridView(inventoryDataGridView, tempTable); - } - - //And the Actual Sales table - tempTable = dataBaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString); - if (tempTable.Rows.Count > 0) - { - BuildSalesDataGridViews(actualSalesMainDataGidView, tempTable); - } - - //Next the Invoices table - tempTable = dataBaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString); - if (tempTable.Rows.Count > 0) - { - suppliersDataGridView.DataSource = SumCostOfSales(tempTable); - } - - //And finally the weekly sales - tempTable = dataBaseReader.ReturnWeeklySalesFromDateId(dateId, databaseTracker.DatabaseConnectionString); - if (tempTable.Rows.Count > 0) - { - weeklySalesDataGridView.DataSource = tempTable; - } - - commentsTextBox.Text = dataBaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString); - } - private void CalculateProfitAnalysis(double shrink = 0.30) { - if (Math.Abs(_SalesProducedByAdItems) < 1 || Math.Abs(_TotalProfitReturnFromAdItems) < 1) + var incompleteData = false; + //First grab the total sales and the total profit return generated by the actual sales of product. + if ( + double.TryParse( + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[3].EditedFormattedValue + .ToString(), out _salesProducedByAdItems)) { - //Clear the labels... - if (weeklySalesDataGridView.Rows.Count == 0 || weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString() == "0.0000") + //The sales parsed properly so there is data in the cell. Next try to grab the total profit return. + if (double.TryParse( + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[6].EditedFormattedValue + .ToString(), out _totalProfitReturnFromAdItems)) { - departmentSalesLabel.Text = "Department Sales: No Weekly Sales Found."; - departmentSalesLabel.ForeColor = Color.Red; + } - - if (_SalesProducedByAdItems == 0) - { - salesProducedLabel.Text = "Sales Produced By Ad Items (A): No Values to Total."; - salesProducedLabel.ForeColor = Color.Red; - } - - remainingSalesLabel.Text = "Remaining Sales: "; - if (_TotalProfitReturnFromAdItems == 0) - { - totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): No Values to Total."; - totalProfitFromAdItemsLabel.ForeColor = Color.Red; - } - - totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: "; - totalProfitReturnLabel.Text = "Total Profit Return: "; + } + if (Math.Abs(_salesProducedByAdItems) < 1) + { + salesProducedLabel.Text = @"Sales Produced By Ad Items (A): No Data"; + incompleteData = true; + } + if (Math.Abs(_totalProfitReturnFromAdItems) < 1) + { + totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): No Data"; + incompleteData = true; + } + if (Math.Abs(_departmentSales) < 1) + { + departmentSalesLabel.Text = @"Department Sales: No Data"; + incompleteData = true; + } + if (incompleteData) + { return; } - double.TryParse(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString(), out _departmentSales); - //Since there are department sales, change the label's color to make sure it doesn't appear as an error. - departmentSalesLabel.ForeColor = Color.Black; - departmentSalesLabel.Text = "Department Sales: " + _departmentSales.ToString("C"); - //Assume that the sales produced is larger then zero (0). - salesProducedLabel.ForeColor = Color.Black; - salesProducedLabel.Text = "Sales Produced By Ad Items (A): " + _SalesProducedByAdItems.ToString("C"); - - double remainingSales = _departmentSales - _SalesProducedByAdItems; - remainingSalesLabel.Text = "Remaining Sales: " + remainingSales.ToString("C"); + departmentSalesLabel.Text = @"Department Sales: " + _departmentSales.ToString("C"); + salesProducedLabel.Text = @"Sales Produced By Ad Items (A): " + _salesProducedByAdItems.ToString("C"); + //Calculate the remaining sales. + var remainingSales = _departmentSales - _salesProducedByAdItems; + remainingSalesLabel.Text = @"Remaining Sales: " + remainingSales.ToString("C"); //Again assume the total profit return is larger then zero (0). - totalProfitFromAdItemsLabel.ForeColor = Color.Black; - totalProfitFromAdItemsLabel.Text = "Total Profit Return From Ad Items (B): " + _TotalProfitReturnFromAdItems.ToString("C"); - //Shrink is being used as a place holder for Cross Profit % which is obtained by dividing gActualTotalProfitReturnCalculatedTotal by the department weekly retail sales. - double totalProfitReturnFromRemainingSales = shrink * remainingSales; + totalProfitFromAdItemsLabel.Text = @"Total Profit Return From Ad Items (B): " + _totalProfitReturnFromAdItems.ToString("C"); + //Shrink is being used as a place holder for Cross Profit % which is obtained by dividing the total profit return from the department weekly retail sales. + var totalProfitReturnFromRemainingSales = shrink*remainingSales; // - totalProfitReturnFromRemaingLabel.Text = "Total Profit Return From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C"); - double totalProfitReturn = _TotalProfitReturnFromAdItems + totalProfitReturnFromRemainingSales; - totalProfitReturnLabel.Text = "Total Profit Return: " + totalProfitReturn.ToString("C"); - } - - private void BuildSalesDataGridViews(DataGridView dataGridView, DataTable table) - { - var adSpecialIndex = -1; - double totalSales = 0; - double totalProfitReturn = 0; - - foreach (DataColumn column in table.Columns) - { - var dataGridViewColumn = new DataGridViewColumn() - { - HeaderText = column.ColumnName, - CellTemplate = new DataGridViewTextBoxCell() - }; - if (dataGridViewColumn.HeaderText.Contains("Projection")) - { - dataGridViewColumn.HeaderText = dataGridViewColumn.HeaderText.Replace("Projection", ""); - } - else if (dataGridViewColumn.HeaderText.Contains("Actual")) - { - dataGridViewColumn.HeaderText = dataGridViewColumn.HeaderText.Replace("Actual", ""); - } - if (dataGridViewColumn.HeaderText == "FK_GroupID" || dataGridViewColumn.HeaderText == "RowAttribute") - { - dataGridViewColumn.Visible = false; - } - dataGridViewColumn.HeaderText = TextFormat.AddSpacesToSentence(dataGridViewColumn.HeaderText, false); - dataGridView.Columns.Add(dataGridViewColumn); - } - - for (var i = 0; i < table.Rows.Count; i++) - { - var row = new DataGridViewRow(); - //Checks for the group, if any, the row or rows is/are part of. - if (table.Rows[i][8].ToString() != "" && - int.Parse(table.Rows[i][8].ToString()) != 0 && adSpecialIndex == -1) - { - adSpecialIndex = i; - var adSpecialRow = new DataGridViewRow(); - var databaseTracker = new DatabaseTracker(); - var databaseReader = new DatabaseReader(); - var groupName = databaseReader.ReturnGroupNameFromGroupId(table.Rows[i][8].ToString(), databaseTracker.DatabaseConnectionString); - - adSpecialRow.DefaultCellStyle.BackColor = Color.DarkGray; - - dataGridView.Rows.Add(adSpecialRow); - dataGridView.Rows[i].Cells[0].Value = groupName; - } - //Checks for row attribute - if (table.Rows[i][7].ToString() != "") - { - //The seventh column contains the row's attribute if any. - var rowAttribute = int.Parse(table.Rows[i][7].ToString()); - if (rowAttribute == 1) - { - row.DefaultCellStyle.BackColor = Color.LightGray; - } - else if (rowAttribute == 2) - { - row.DefaultCellStyle.BackColor = Color.LightBlue; - } - - foreach (var dataCell in table.Rows[i].ItemArray.Select(cell => new DataGridViewTextBoxCell { Value = cell })) - { - row.Cells.Add(dataCell); - } - dataGridView.Rows.Add(row); - } - else - { - dataGridView.Rows.Add(table.Rows[i].ItemArray); - } - //Check for values in the Total Sales and Total Profit Return columns - double tempOut = 0; - if (double.TryParse(table.Rows[i][3].ToString(), out tempOut)) - { - if (tempOut >= 0) - { - totalSales += tempOut; - } - } - if (double.TryParse(table.Rows[i][6].ToString(), out tempOut)) - { - if (tempOut >= 0) - { - totalProfitReturn += tempOut; - } - } - } - var totalsRow = new object[9]; - totalsRow[0] = "Totals"; - totalsRow[3] = totalSales; - totalsRow[6] = totalProfitReturn; - dataGridView.Rows.Add(totalsRow); - - if (dataGridView.Name == "actualSalesMainDataGidView") - { - _SalesProducedByAdItems = totalSales; - _TotalProfitReturnFromAdItems = totalProfitReturn; - } - } - - private void BuildInventoryDataGridView(DataGridView dataGridView, DataTable table) - { - var lastAdSpecialIndex = -1; - for (var columnIndex = 0; columnIndex < table.Columns.Count; columnIndex++) - { - var dataGridViewColumn = new DataGridViewColumn - { - Name = table.Columns[columnIndex].ColumnName, - CellTemplate = new DataGridViewTextBoxCell() - }; - var columnHeaderText = table.Columns[columnIndex].ColumnName; - columnHeaderText = TextFormat.AddSpacesToSentence(columnHeaderText, false); - //Make the row attribute column invisible. - if (table.Columns[columnIndex].ColumnName == "RowAttribute") - { - dataGridViewColumn.Visible = false; - } - //Make any columns with a foreign key invisible. - if (table.Columns[columnIndex].ColumnName.Contains("FK")) - { - dataGridViewColumn.Visible = false; - } - dataGridViewColumn.HeaderText = columnHeaderText; - dataGridView.Columns.Add(dataGridViewColumn); - } - - for (var rowIndex = 0; rowIndex < table.Rows.Count; rowIndex++) - { - var row = new DataGridViewRow(); - - if (table.Rows[rowIndex][6].ToString() != "" && int.Parse(table.Rows[rowIndex][6].ToString()) != 0 && lastAdSpecialIndex == -1) - { - lastAdSpecialIndex = rowIndex; - var adSpecialRow = new DataGridViewRow(); - var databaseTracker = new DatabaseTracker(); - var databaseReader = new DatabaseReader(); - var groupName = databaseReader.ReturnGroupNameFromGroupId(table.Rows[rowIndex][6].ToString(), databaseTracker.DatabaseConnectionString); - - adSpecialRow.DefaultCellStyle.BackColor = Color.DarkGray; - - dataGridView.Rows.Add(adSpecialRow); - dataGridView.Rows[rowIndex].Cells[0].Value = groupName; - } - - if (table.Rows[rowIndex][5].ToString() != "") - { - //The fifth column contains the row's attribute if any. - var rowAttribute = int.Parse(table.Rows[rowIndex][5].ToString()); - if (rowAttribute == 1) - { - row.DefaultCellStyle.BackColor = Color.LightGray; - } - else if (rowAttribute == 2) - { - row.DefaultCellStyle.BackColor = Color.LightBlue; - } - - foreach (var dataCell in table.Rows[rowIndex].ItemArray.Select(cell => new DataGridViewTextBoxCell { Value = cell })) - { - row.Cells.Add(dataCell); - } - dataGridView.Rows.Add(row); - } - else - { - dataGridView.Rows.Add(table.Rows[rowIndex].ItemArray); - } - } + totalProfitReturnFromRemaingLabel.Text = @"Total Profit Return From Remaining Sales: " + totalProfitReturnFromRemainingSales.ToString("C"); + var totalProfitReturn = _totalProfitReturnFromAdItems + totalProfitReturnFromRemainingSales; + totalProfitReturnLabel.Text = @"Total Profit Return: " + totalProfitReturn.ToString("C"); } private void CalculateGrossProfit() { - if (Math.Abs(_gCostOfSalesCalculatedTotal) < 1) + if (Math.Abs(_totalInvoicePurchases) < 1) { //IF Cost of Sales hasn't been calculated, then clear labels and return. - if (weeklySalesDataGridView.Rows.Count == 0 || weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString() == "0.0000") + if (Math.Abs(_departmentSales) < 1) { - grossProfitTotalSales.Text = "Total Sales: No Weekly Sales Found."; - grossProfitTotalSales.ForeColor = Color.Red; + grossProfitTotalSales.Text = @"Total Sales: No Data"; } - grossProfitLessCostOfSales.Text = "Less Cost of Sales: "; - grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: "; - perfectGrossProfitLabel.Text = "Percent Gross Profit: "; + grossProfitLessCostOfSales.Text = @"Less Cost of Sales: No Data"; return; } - if (weeklySalesDataGridView.RowCount == 0) return; - double totalSales = Convert.ToDouble(weeklySalesDataGridView.Rows[0].Cells[7].EditedFormattedValue.ToString()); - grossProfitTotalSales.ForeColor = Color.Black; - grossProfitTotalSales.Text = "Total Sales: " + totalSales.ToString("C"); - grossProfitLessCostOfSales.Text = "Less Cost of Sales: " + _gCostOfSalesCalculatedTotal.ToString("C"); - double dollarGrossProfit = totalSales - _gCostOfSalesCalculatedTotal; - grossProfitDollarGrossProfitLabel.Text = "Dollar Gross Profit: " + dollarGrossProfit.ToString("C"); - double grossProfitPercent = dollarGrossProfit / totalSales; - perfectGrossProfitLabel.Text = "Percent Gross Profit: " + grossProfitPercent.ToString("P"); + grossProfitTotalSales.Text = @"Total Sales: " + _departmentSales.ToString("C"); + grossProfitLessCostOfSales.Text = @"Less Cost of Sales: " + _totalInvoicePurchases.ToString("C"); + var dollarGrossProfit = _departmentSales - _totalInvoicePurchases; + grossProfitDollarGrossProfitLabel.Text = @"Dollar Gross Profit: " + dollarGrossProfit.ToString("C"); + var grossProfitPercent = dollarGrossProfit/_departmentSales; + perfectGrossProfitLabel.Text = @"Percent Gross Profit: " + grossProfitPercent.ToString("P"); } private void addRecordToolStripMenuItem_Click(object sender, EventArgs e) { - var recordForm = new FrmAddRecord(); - recordForm.ShowDialog(); - FillDateSuggestionComboBoxes(); - BuildAndFillDataGridTables(); - CalculateProfitAnalysis(); - CalculateGrossProfit(); - } - - /// - /// Appends a new "Totals" row to the end of the Invoice table that is passed in - /// and sums up the Net Cost of Invoices column as well as storing the total Costs of Sales - /// into the class wide variable for use with other functions. - /// - /// The Invoice table to summed. - /// - private DataTable SumCostOfSales(DataTable invoiceTable) - { - //Check for a null parameter OR if the column count is less then six (6) as any less means the database isn't returning correctly. - if(invoiceTable == null || invoiceTable.Columns.Count < 6) return invoiceTable; - double costOfSalesSum = 0; - - for (var i = 0; i < invoiceTable.Rows.Count; i++) - { - costOfSalesSum += Convert.ToDouble(invoiceTable.Rows[i][4]); - } - - _gCostOfSalesCalculatedTotal = costOfSalesSum; - - object[] invoiceTotalRow = new object[invoiceTable.Columns.Count]; - invoiceTotalRow[2] = "Total Purchases"; - invoiceTotalRow[5] = costOfSalesSum; - invoiceTable.Rows.Add(invoiceTotalRow); - - return invoiceTable; + var form = new NewAddRecord(); + form.ShowDialog(); } private void showHideConsoleHelpMainMenu_Click(object sender, EventArgs e) @@ -433,225 +129,20 @@ namespace AdvertsingProfitControl { _console.Show(); } - - } - - /// - /// Grabs all dates from the database and splits the returned strings - /// into months, days, and years and stores them in their respective - /// combo boxes to display to the user. Also stores the list of dates - /// inside a class wide variable. - /// - private void FillDateSuggestionComboBoxes() - { - //Create a connection to the database retrieval class. - var databaseTracker = new DatabaseTracker(); - var databaseReader = new DatabaseReader(); - //Grab the most recent date in the database. - var mostRecentDateTime = databaseReader.RetrieveMostRecentDateString(databaseTracker.DatabaseConnectionString); - var mostRecentDateString = mostRecentDateTime.ToString("MM/dd/yyyy"); - //Check to see if the return value is null and IF so log the error and return. - if(mostRecentDateString == ""){ _console.WriteToLog(FrmLogConsole.Level.Error, "No dates could be found in the database."); return;} - //Otherwise, if there was a return date, split it into a array. - var mostRecentDateParts = mostRecentDateString.Split('/'); - //Grab only the most recent years in the database (only say 2015) and fill a table with the dates. Indexes are as follows: [0] is Month, [1] is Day and [2] is Year. - var datesList = databaseReader.RetrieveDateListByYear(mostRecentDateParts[2], databaseTracker.DatabaseConnectionString); - //Suspend the control's drawing so the user doesn't see any ugly enumeration and index changing. - DrawingControl.SuspendDrawing(dateSelectorPanel); - //Considering there was a return value for the most recent date, its safe to assume there is at least one date in the database, so clear the class's date collection. - _gDateStringCollection.Clear(); - monthComboBox.Items.Clear(); - dayComboBox.Items.Clear(); - yearComboBox.Items.Clear(); - monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation; - yearComboBox.SelectedIndexChanged -= UpdateDaysOfMonthByYear; - //Now spin through the oneYearDatesTable and fill the class wide object with all the dates for the most recent year. - for (var i = 0; i < datesList.Count; i ++) - { - var fullDateString = datesList[i].ToString("MM/dd/yyyy"); - //Check for nulls just to be paranoid. - if (fullDateString == "") - { - return; - } - //IF the date string collection already contains the date, then continue to the next iteration. - if (_gDateStringCollection.Contains(fullDateString)) - { - continue; - } - _gDateStringCollection.Add(fullDateString); - } - - var dayBasedOnMonthAndYeaRegex = new Regex("^0?" + mostRecentDateParts[0] + @"/\d{2}/" + mostRecentDateParts[2]); - var monthBasedOnYearRegex = new Regex(@"^\d{2}/\d{2}/" + mostRecentDateParts[2]); - for (var i = 0; i < _gDateStringCollection.Count; i++) - { - string[] dateArray = _gDateStringCollection[i].Split('/'); - var month = dateArray[0]; - var day =dateArray[1]; - - if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i])) - { - dayComboBox.Items.Add(day); - } - if (monthBasedOnYearRegex.IsMatch(_gDateStringCollection[i])) - { - if (!monthComboBox.Items.Contains(month)) - { - monthComboBox.Items.Add(month); - } - } - } - - var yearsInDatabase = databaseReader.RetrieveUniqueYearsList(databaseTracker.DatabaseConnectionString); - - foreach (var year in yearsInDatabase) - { - yearComboBox.Items.Add(year); - } - - if (dayComboBox.Items.Count >= 1 && yearComboBox.Items.Count >= 1 && monthComboBox.Items.Count >= 1) - { - monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1; - dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1; - yearComboBox.SelectedIndex = yearComboBox.Items.Count - 1; - monthComboBox.Enabled = true; - dayComboBox.Enabled = true; - yearComboBox.Enabled = true; - } - else - { - monthComboBox.Enabled = false; - dayComboBox.Enabled = false; - yearComboBox.Enabled = false; - } - monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation; - yearComboBox.SelectedIndexChanged += UpdateDaysOfMonthByYear; - DrawingControl.ResumeDrawing(dateSelectorPanel); - } - - private void UpdateDaysOfMonth(object sender, EventArgs e) - { - if (yearComboBox.SelectedIndex == -1) return; - var year = yearComboBox.SelectedItem.ToString(); - var month = monthComboBox.SelectedItem.ToString(); - var dateParserPattern = new Regex("^" + month + @"\/\d{2}\/" + year); - - dayComboBox.Items.Clear(); - - for (var i = 0; i < _gDateStringCollection.Count; i++) - { - if (dateParserPattern.IsMatch(_gDateStringCollection[i])) - { - var dateArray = _gDateStringCollection[i].Split('/'); - var day = dateArray[1]; - dayComboBox.Items.Add(day); - } - } - - if (dayComboBox.Items.Count > 0) - { - dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1; - } - - CalculateProfitAnalysis(); - CalculateGrossProfit(); - } - /// - /// Fires when the Year combo box's index changes. - /// - /// - /// - private void UpdateDaysOfMonthByYear(object sender, EventArgs e) - { - //Obligatory database retrieval call... - var databaseTracker = new DatabaseTracker(); - var databaseReader = new DatabaseReader(); - //First, grab the year and the month from their respective combo boxes. - var year = yearComboBox.SelectedItem.ToString(); - var month = monthComboBox.SelectedItem.ToString(); - //Since we can more or less be certain that nothing is null, clear the current date collection. - _gDateStringCollection.Clear(); - var months = databaseReader.RetrieveUniqueMonthsList(year, databaseTracker.DatabaseConnectionString); - var mostRecentMonth = months.Max(); - if (mostRecentMonth.Length == 1) - { - mostRecentMonth = "0" + mostRecentMonth; - } - var datesList = databaseReader.RetrieveDateListByYear(year, databaseTracker.DatabaseConnectionString); - - for (var i = 0; i < datesList.Count; i++) - { - _gDateStringCollection.Add(datesList[i].ToString("MM/dd/yyyy")); - } - - //Clear the month and day combo boxes and unregister their event handlers. - dayComboBox.Items.Clear(); - monthComboBox.Items.Clear(); - monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation; - for (var i = 0; i < _gDateStringCollection.Count; i ++) - { - var dateArray = _gDateStringCollection[i].Split('/'); - month = dateArray[0]; - //Declare the patterns to look for when enumerating the combo boxes. - var dayBasedOnMonthAndYeaRegex = new Regex(@"^(" + mostRecentMonth + @"\/\d{2}\/" + year + ")"); //Only allows days that are actually part of the month and year. - var day = dateArray[1]; - - if (dayBasedOnMonthAndYeaRegex.IsMatch(_gDateStringCollection[i])) - { - dayComboBox.Items.Add(day); - } - - if (!monthComboBox.Items.Contains(month)) - { - monthComboBox.Items.Add(month); - } - } - - if (dayComboBox.Items.Count > 0) - { - dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1; - } - if (monthComboBox.Items.Count > 0) - { - monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1; - } - - //Now re-register the event handlers - monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation; - - BuildAndFillDataGridTables(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + year); - CalculateProfitAnalysis(); - CalculateGrossProfit(); - } - - private void adSpecialKeyWordsToolsMainMenu_Click(object sender, EventArgs e) - { - var keyWordRegister = new FrmAdSpecialRegister(); - keyWordRegister.ShowDialog(); } private void deleteRecordsMainMenu_Click(object sender, EventArgs e) { var frmDeleteRecord = new FrmDeleteRecord(); frmDeleteRecord.ShowDialog(); - FillDateSuggestionComboBoxes(); - BuildAndFillDataGridTables(); CalculateProfitAnalysis(); CalculateGrossProfit(); } private void modifyRecordMainMenu_Click(object sender, EventArgs e) { - var modifyForm = new FrmModifyRecord(); - modifyForm.ShowDialog(); - //BuildAndFillDataGridTables(); - //CalculateProfitAnalysis(); - //CalculateGrossProfit(); + var form = new NewModifyRecord(monthCalendar.SelectionStart); + form.ShowDialog(); } private void manageItemsToolsMainMenu_Click(object sender, EventArgs e) @@ -686,13 +177,14 @@ namespace AdvertsingProfitControl var rect = e.MarginBounds; - if ((double)bitMap.Width / (double)bitMap.Height > (double)rect.Width / (double)rect.Height) // image is wider + if ((double) bitMap.Width/(double) bitMap.Height > (double) rect.Width/(double) rect.Height) + // image is wider { - rect.Height = (int)((double)bitMap.Height / (double)bitMap.Width * (double)rect.Width); + rect.Height = (int) ((double) bitMap.Height/(double) bitMap.Width*(double) rect.Width); } else { - rect.Width = (int)((double)bitMap.Width / (double)bitMap.Height * (double)rect.Height); + rect.Width = (int) ((double) bitMap.Width/(double) bitMap.Height*(double) rect.Height); } if (_LazyPageCounter == 0) @@ -721,17 +213,16 @@ namespace AdvertsingProfitControl var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); var dateId = - databaseReader.RetrieveDateIdByDateString( - monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + yearComboBox.SelectedItem, + databaseReader.RetrieveDateIdByDateString(monthCalendar.SelectionStart.ToShortDateString(), databaseTracker.DatabaseConnectionString); - double remaingingSales = _departmentSales - _SalesProducedByAdItems; + double remaingingSales = _departmentSales - _salesProducedByAdItems; double totalProfitReturnFromReminaingSales = remaingingSales*.3; - double totalProfitReturn = _TotalProfitReturnFromAdItems + totalProfitReturnFromReminaingSales; - test.BuildFormFrontCompressedLayout(dateId.ToString(), _departmentSales, _SalesProducedByAdItems, remaingingSales, - _TotalProfitReturnFromAdItems, totalProfitReturnFromReminaingSales, totalProfitReturn, + double totalProfitReturn = _totalProfitReturnFromAdItems + totalProfitReturnFromReminaingSales; + test.BuildFormFrontCompressedLayout(dateId, _departmentSales, _salesProducedByAdItems, remaingingSales, + _totalProfitReturnFromAdItems, totalProfitReturnFromReminaingSales, totalProfitReturn, commentsTextBox.Text); test.RenderHtmlToImage(); - backPageTest.GenerateWeeklyInventoryControlPage(dateId.ToString()); + backPageTest.GenerateWeeklyInventoryControlPage(dateId); backPageTest.RenderHtmlToImage(); } else @@ -761,7 +252,7 @@ namespace AdvertsingProfitControl private void newModifyRecordToolStripMenuItem_Click(object sender, EventArgs e) { - var date = DateTime.Parse(monthComboBox.SelectedItem + @"/" + dayComboBox.SelectedItem + @"/" + yearComboBox.SelectedItem); + var date = monthCalendar.SelectionStart; var form = new NewModifyRecord(date); form.ShowDialog(); } @@ -772,8 +263,893 @@ namespace AdvertsingProfitControl ModifyRecords = 1, DeleteRecords = 2 } - } + /// + /// Fills the APC DataGridViews with the appropriate columns and starting row for the user to start + /// entering data. + /// + private void ConstructApcDataGridViews() + { + //Construct a list of column names for the inventory/actual sales DataGridViews and the inventory DataGirdView. + string[] saleColumnNames = + { + "AdItem", "Sold", "SalePrice", "TotalSales", "Cost", "ProfitReturn", + "TotalProfitReturn" + }; + string[] inventoryColumnNames = + { + "AdItem", "BeginningInventory", "Received", "Total", "EndingInventory" + }; + + foreach (var name in saleColumnNames) + { + var column = new DataGridViewTextBoxColumn + { + Name = name, + HeaderText = TextFormat.AddSpacesToSentence(name, false), + ValueType = typeof(string), + SortMode = DataGridViewColumnSortMode.NotSortable, + MaxInputLength = 20 + }; + projectionsDataGridView.Columns.Add(column); + } + //Add the columns into the inventory DataGridView after setting their types. + foreach (var name in inventoryColumnNames) + { + var column = new DataGridViewTextBoxColumn + { + Name = name, + HeaderText = TextFormat.AddSpacesToSentence(name, false), + ValueType = typeof(string), + SortMode = DataGridViewColumnSortMode.NotSortable, + MaxInputLength = 20 + }; + inventoryDataGridView.Columns.Add(column); + } + // + foreach (var name in saleColumnNames) + { + var column = new DataGridViewTextBoxColumn + { + Name = name, + HeaderText = TextFormat.AddSpacesToSentence(name, false), + ValueType = typeof(string), + SortMode = DataGridViewColumnSortMode.NotSortable, + MaxInputLength = 20 + }; + actualSalesDataGridView.Columns.Add(column); + } + } + + /// + /// Constructs the invoices DataGridView. + /// + private void ConstructInvoicesDataGridView() + { + string[] invoicesColumnNames = + { + "InvoiceDate", "Supplier", "InvoiceNumber", "InvoiceNetAmountAtCost", + "InvoiceNetAmount", "InvoiceNote" + }; + + foreach (var name in invoicesColumnNames) + { + var column = new DataGridViewTextBoxColumn + { + Name = name, + HeaderText = TextFormat.AddSpacesToSentence(name, false), + ValueType = typeof(string), + SortMode = DataGridViewColumnSortMode.NotSortable, + MaxInputLength = 20 + }; + invoicesDataGridView.Columns.Add(column); + } + } + + private void LoadDate(DateTime date) + { + var databaseTracker = new DatabaseTracker(); + var databaseReader = new DatabaseReader(); + var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"), + databaseTracker.DatabaseConnectionString); + if (dateId == 0) + { + errorLabel.Text = @"Failed to get the date ID number, aborting load operation." + Environment.NewLine; + return; + } + informationLabel.Text = @"Loading data for " + date.ToString("d") + "." + Environment.NewLine; + var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString); + var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString); + var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString); + LoadProjectionsTable(projections); + LoadInventoryTable(inventory); + LoadActualSalesTable(actualSales); + var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString); + LoadInvoices(invoices); + var comments = databaseReader.RetrieveComments(int.Parse(dateId.ToString()), + databaseTracker.DatabaseConnectionString); + if (comments.Count == 2) + { + commentsTextBox.Text = comments[1]; + } + else + { + informationLabel.Text += @"No comments to display." + Environment.NewLine; + } + var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId, + databaseTracker.DatabaseConnectionString); + if (weeklySales.Rows.Count == 1) + { + LoadWeeklySales(weeklySales); + } + else + { + informationLabel.Text += @"No sales to display." + Environment.NewLine; + } + + var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString); + if (taxable.Rows.Count == 1) + { + LoadTaxable(taxable); + } + else + { + informationLabel.Text += @"No taxable data to display." + Environment.NewLine; + } + var costAnalysis = databaseReader.ReturnCostAnalysis(dateId, + databaseTracker.DatabaseConnectionString); + if (costAnalysis.Rows.Count == 1) + { + LoadCostAnalysis(costAnalysis); + } + else + { + informationLabel.Text += @"No cost analysis data to display." + Environment.NewLine; + } + } + + private void LoadProjectionsTable(DataTable projections) + { + if (projections.Rows.Count == 0) return; + var adSpecialIndex = -1; + double totalSales = 0; + double totalProfitReturn = 0; + for (var rowIndex = 0; rowIndex < projections.Rows.Count; rowIndex++) + { + var newRow = new DataGridViewRow(); + for (var cellIndex = 0; cellIndex < projections.Rows[rowIndex].ItemArray.Length; cellIndex++) + { + //ID and Ad Item. + if (cellIndex == 1) + { + var cell = new DataGridViewTextBoxCell + { + Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString() + }; + newRow.Cells.Add(cell); + continue; + } + //String allowed columns + if (cellIndex > 1 && cellIndex <= 3) + { + if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty) + { + var cell = new DataGridViewTextBoxCell + { + Value = projections.Rows[rowIndex].ItemArray[cellIndex].ToString() + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //If the cell is meant to be summed into a totals roll add its contents to the total. + //If the cell is the total sales cell.. + if (cellIndex == 4) + { + if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty && + Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + totalSales += double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()); + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //or the total profit return cell. + if (cellIndex == 7) + { + if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty && + Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + totalProfitReturn += double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()); + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //Everything in between the ad item cell and the row attribute cells. + if (cellIndex > 3 && cellIndex < 8) + { + if (Math.Abs(double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //Check the attribute cell. + if (cellIndex == 8) + { + var rowAttribute = int.Parse(projections.Rows[rowIndex].ItemArray[cellIndex].ToString()); + switch (rowAttribute) + { + case 1: + //Header row + newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow; + break; + case 2: + //Member Row + newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow; + break; + } + continue; + } + //Check the group it is part of if any. + if (cellIndex != 9) continue; + //Check to see if this row belongs to an ad special group. + if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue; + //If the ad special index is not set, then create the ad special row with the human friendly group name. + if (adSpecialIndex != -1) continue; + var databaseTracker = new DatabaseTracker(); + var databaseReader = new DatabaseReader(); + var groupName = + databaseReader.ReturnGroupNameFromGroupId( + projections.Rows[rowIndex].ItemArray[cellIndex].ToString(), + databaseTracker.DatabaseConnectionString); + var adSpecialRow = new DataGridViewRow(); + projectionsDataGridView.Rows.Add(adSpecialRow); + projectionsDataGridView.Rows[rowIndex].Cells[3].Value = groupName; + projectionsDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = + ApplicationColors.AdSpecial; + adSpecialIndex = rowIndex; + } + projectionsDataGridView.Rows.Add(newRow); + } + //Now add the totals row. + var totalsRow = new DataGridViewRow(); + projectionsDataGridView.Rows.Add(totalsRow); + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[0].Value = "Total"; + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[2].Style.Alignment = + DataGridViewContentAlignment.MiddleRight; + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[2].Value = @"(A)"; + if (Math.Abs(totalSales) > 0) + { + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[3].Value = + totalSales.ToString("N2"); + } + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[5].Style.Alignment = + DataGridViewContentAlignment.MiddleRight; + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[5].Value = @"(B)"; + if (Math.Abs(totalProfitReturn) > 0) + { + projectionsDataGridView.Rows[projectionsDataGridView.Rows.Count - 1].Cells[6].Value = + totalProfitReturn.ToString("N2"); + } + } + + private void LoadInventoryTable(DataTable inventory) + { + if (inventory.Rows.Count == 0) return; + var adSpecialIndex = -1; + for (var rowIndex = 0; rowIndex < inventory.Rows.Count; rowIndex++) + { + var newRow = new DataGridViewRow(); + for (var cellIndex = 1; cellIndex < inventory.Rows[rowIndex].ItemArray.Length; cellIndex++) + { + //String allowed columns + if (cellIndex < 6) + { + if (inventory.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty) + { + var cell = new DataGridViewTextBoxCell + { + Value = inventory.Rows[rowIndex].ItemArray[cellIndex].ToString() + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //Check the attribute cell. + if (cellIndex == 6) + { + var rowAttribute = int.Parse(inventory.Rows[rowIndex].ItemArray[cellIndex].ToString()); + switch (rowAttribute) + { + case 1: + //Header row + newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow; + break; + case 2: + //Member Row + newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow; + break; + } + continue; + } + //Check the group it is part of if any. + if (cellIndex != 7) continue; + //Check to see if this row belongs to an ad special group. + if (inventory.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue; + //If the ad special index is not set, then create the ad special row with the human friendly group name. + if (adSpecialIndex != -1) continue; + var databaseTracker = new DatabaseTracker(); + var databaseReader = new DatabaseReader(); + var groupName = + databaseReader.ReturnGroupNameFromGroupId( + inventory.Rows[rowIndex].ItemArray[cellIndex].ToString(), + databaseTracker.DatabaseConnectionString); + var adSpecialRow = new DataGridViewRow(); + inventoryDataGridView.Rows.Add(adSpecialRow); + inventoryDataGridView.Rows[rowIndex].Cells[2].Value = groupName; + inventoryDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = + ApplicationColors.AdSpecial; + adSpecialIndex = rowIndex; + } + inventoryDataGridView.Rows.Add(newRow); + } + } + + private void LoadActualSalesTable(DataTable actualSales) + { + if (actualSales.Rows.Count == 0) return; + var adSpecialIndex = -1; + double totalSales = 0; + double totalProfitReturn = 0; + for (var rowIndex = 0; rowIndex < actualSales.Rows.Count; rowIndex++) + { + var newRow = new DataGridViewRow(); + for (var cellIndex = 0; cellIndex < actualSales.Rows[rowIndex].ItemArray.Length; cellIndex++) + { + //ID and Ad Item. + if (cellIndex == 1) + { + var cell = new DataGridViewTextBoxCell + { + Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() + }; + newRow.Cells.Add(cell); + continue; + } + //String allowed columns + if (cellIndex > 1 && cellIndex <= 3) + { + if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty) + { + var cell = new DataGridViewTextBoxCell + { + Value = actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //If the cell is meant to be summed into a totals roll add its contents to the total. + //If the cell is the total sales cell.. + if (cellIndex == 4) + { + if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty && + Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + totalSales += double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()); + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //or the total profit return cell. + if (cellIndex == 7) + { + if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() != string.Empty && + Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + totalProfitReturn += double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()); + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //Everything in between the ad item cell and the row attribute cells. + if (cellIndex > 3 && cellIndex < 8) + { + if (Math.Abs(double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString())) > 0) + { + var cell = new DataGridViewTextBoxCell + { + Value = + double.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()) + .ToString("N2") + }; + newRow.Cells.Add(cell); + } + else + { + var cell = new DataGridViewTextBoxCell {Value = string.Empty}; + newRow.Cells.Add(cell); + } + continue; + } + //Check the attribute cell. + if (cellIndex == 8) + { + var rowAttribute = int.Parse(actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString()); + switch (rowAttribute) + { + case 1: + //Header row + newRow.DefaultCellStyle.BackColor = ApplicationColors.HeaderRow; + break; + case 2: + //Member Row + newRow.DefaultCellStyle.BackColor = ApplicationColors.MemberRow; + break; + } + continue; + } + //Check the group it is part of if any. + if (cellIndex != 9) continue; + //Check to see if this row belongs to an ad special group. + if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") continue; + //If the ad special index is not set, then create the ad special row with the human friendly group name. + if (adSpecialIndex != -1) continue; + var databaseTracker = new DatabaseTracker(); + var databaseReader = new DatabaseReader(); + var groupName = + databaseReader.ReturnGroupNameFromGroupId( + actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString(), + databaseTracker.DatabaseConnectionString); + var adSpecialRow = new DataGridViewRow(); + actualSalesDataGridView.Rows.Add(adSpecialRow); + actualSalesDataGridView.Rows[rowIndex].Cells[3].Value = groupName; + actualSalesDataGridView.Rows[rowIndex].DefaultCellStyle.BackColor = + ApplicationColors.AdSpecial; + adSpecialIndex = rowIndex; + } + actualSalesDataGridView.Rows.Add(newRow); + } + //Now add the totals row. + var totalsRow = new DataGridViewRow(); + actualSalesDataGridView.Rows.Add(totalsRow); + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[0].Value = "Total"; + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[2].Style.Alignment = + DataGridViewContentAlignment.MiddleRight; + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[2].Value = @"(A)"; + if (Math.Abs(totalSales) > 0) + { + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[3].Value = + totalSales.ToString("N2"); + } + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[5].Style.Alignment = + DataGridViewContentAlignment.MiddleRight; + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[5].Value = @"(B)"; + if (Math.Abs(totalProfitReturn) > 0) + { + actualSalesDataGridView.Rows[actualSalesDataGridView.Rows.Count - 1].Cells[6].Value = + totalProfitReturn.ToString("N2"); + } + } + + private void LoadInvoices(DataTable invoices) + { + if (invoices.Rows.Count == 0) return; + _totalInvoicePurchases = 0; + for (var rowIndex = 0; rowIndex < invoices.Rows.Count; rowIndex++) + { + var row = new DataGridViewRow(); + for (var cellIndex = 1; cellIndex < invoices.Rows[rowIndex].ItemArray.Length; cellIndex++) + { + var cell = new DataGridViewTextBoxCell(); + switch (cellIndex) + { + //Apply formatting to the invoice date to trim the 12:00:00 time stamp. + case 1: + var date = DateTime.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()); + cell.Value = date.ToString("d"); + row.Cells.Add(cell); + continue; + //Apply formatting to the only cells that will have currency values in them. + case 4: + var netAmountAtCost = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()).ToString("N2"); + if (netAmountAtCost != "0.00") + { + cell.Value = netAmountAtCost; + } + row.Cells.Add(cell); + break; + case 5: + var netAmoundExtendedRetail = double.Parse(invoices.Rows[rowIndex].ItemArray[cellIndex].ToString()); + if (netAmoundExtendedRetail.ToString("N2") != "0.00") + { + _totalInvoicePurchases += netAmoundExtendedRetail; + cell.Value = netAmoundExtendedRetail.ToString("N2"); + } + row.Cells.Add(cell); + break; + default: + //No special formatting rules here so just put the value in and move on. + cell.Value = invoices.Rows[rowIndex].ItemArray[cellIndex].ToString(); + row.Cells.Add(cell); + break; + } + } + invoicesDataGridView.Rows.Add(row); + } + //Add the total purchases row to the invoice table. + var totalPurchaesRow = new DataGridViewRow(); + invoicesDataGridView.Rows.Add(totalPurchaesRow); + invoicesDataGridView.Rows[invoicesDataGridView.Rows.Count - 1].Cells[0].Value = @"Total Purchases"; + if (Math.Abs(_totalInvoicePurchases) > 0) + { + invoicesDataGridView.Rows[invoicesDataGridView.Rows.Count - 1].Cells[4].Value = _totalInvoicePurchases.ToString("N2"); + } + } + + private void LoadWeeklySales(DataTable weeklySales) + { + //Clear the department sales and prepare to add up a total. + _departmentSales = 0; + //Spin through the only row in the weekly sales table. Item in item + //array index zero (0) is the ID number of the weekly sales. + for (var cellIndex = 1; cellIndex < weeklySales.Rows[0].ItemArray.Length; cellIndex++) + { + double dollarAmount; + switch (cellIndex) + { + case 1: //Sunday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + sundayWeeklySalesLabel.Text = @"Sunday: $" + dollarAmount; + } + else + { + sundayWeeklySalesLabel.Text = @"Sunday: " + CheckForHoliday(DayOfWeek.Sunday); + } + break; + case 2: //Monday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + mondayWeeklySalesLabel.Text = @"Monday: $" + dollarAmount; + } + else + { + mondayWeeklySalesLabel.Text = @"Monday: " + CheckForHoliday(DayOfWeek.Monday); + } + break; + case 3: //Tuesday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + tuesadayWeeklySalesLabel.Text = @"Tuesday: $" + dollarAmount; + } + else + { + tuesadayWeeklySalesLabel.Text = @"Tuesday: " + CheckForHoliday(DayOfWeek.Tuesday); + } + break; + case 4: //Wednesday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + wednesdayWeeklySalesLabel.Text = @"Wednesday: $" + dollarAmount; + } + else + { + wednesdayWeeklySalesLabel.Text = @"Wednesday: " + CheckForHoliday(DayOfWeek.Wednesday); + } + break; + case 5: //Thursday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + thursdayWeeklySalesLabel.Text = @"Thursday: $" + dollarAmount; + } + else + { + thursdayWeeklySalesLabel.Text = @"Thursday: " + CheckForHoliday(DayOfWeek.Thursday); + } + break; + case 6: //Friday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + fridayWeeklySalesLabel.Text = @"Friday: $" + dollarAmount; + } + else + { + fridayWeeklySalesLabel.Text = @"Friday: " + CheckForHoliday(DayOfWeek.Friday); + } + break; + case 7: //Saturday + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + _departmentSales += dollarAmount; + saturdayWeeklySalesLabel.Text = @"Saturday: $" + dollarAmount; + } + else + { + saturdayWeeklySalesLabel.Text = @"Saturday: " + CheckForHoliday(DayOfWeek.Saturday); + } + break; + case 8: //Total Sales + dollarAmount = double.Parse(weeklySales.Rows[0].ItemArray[cellIndex].ToString()); + if (dollarAmount.ToString("N2") != "0.00") + { + totalWeeklySalesLabel.Text = @"Total Sales: $" + dollarAmount; + } + else + { + totalWeeklySalesLabel.Text = @"Total Sales: "; + } + break; + } + } + } + + private void LoadTaxable(DataTable taxable) + { + //Spin through the only row in the taxable table. Item in item + //array index zero (0) is the ID number of the weekly sales. + for (var cellIndex = 1; cellIndex < taxable.Rows[0].ItemArray.Length; cellIndex++) + { + string formattedNumber; + switch (cellIndex) + { + case 1: //Sunday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + sundayTaxableLabel.Text = @"Sunday: $" + formattedNumber; + } + else + { + sundayTaxableLabel.Text = @"Sunday: " + CheckForHoliday(DayOfWeek.Sunday); + } + break; + case 2: //Monday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + mondayTaxableLabel.Text = @"Monday: $" + formattedNumber; + } + else + { + mondayTaxableLabel.Text = @"Monday: " + CheckForHoliday(DayOfWeek.Monday); + } + break; + case 3: //Tuesday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + tuesdayTaxableLabel.Text = @"Tuesday: $" + formattedNumber; + } + else + { + tuesdayTaxableLabel.Text = @"Tuesday: " + CheckForHoliday(DayOfWeek.Tuesday); + } + break; + case 4: //Wednesday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + wednesdayTaxableLabel.Text = @"Wednesday: $" + formattedNumber; + } + else + { + wednesdayTaxableLabel.Text = @"Wednesday: " + CheckForHoliday(DayOfWeek.Wednesday); + } + break; + case 5: //Thursday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + thursdayTaxableLabel.Text = @"Thursday: $" + formattedNumber; + } + else + { + thursdayTaxableLabel.Text = @"Thursday: " + CheckForHoliday(DayOfWeek.Thursday); + } + break; + case 6: //Friday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + fridayTaxableLabel.Text = @"Friday: $" + formattedNumber; + } + else + { + fridayTaxableLabel.Text = @"Friday: " + CheckForHoliday(DayOfWeek.Friday); + } + break; + case 7: //Saturday + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + saturdayTaxableLabel.Text = @"Saturday: $" + formattedNumber; + } + else + { + saturdayTaxableLabel.Text = @"Saturday: " + CheckForHoliday(DayOfWeek.Saturday); + } + break; + case 8: //Total Taxable + formattedNumber = double.Parse(taxable.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + totalTaxableLabel.Text = @"Total Taxable: $" + formattedNumber; + } + break; + } + } + } + + private void LoadCostAnalysis(DataTable costAnalysis) + { + //Spin through the only row in the taxable table. Item in item + //array index zero (0) is the ID number of the weekly sales. + for (var cellIndex = 1; cellIndex < costAnalysis.Rows[0].ItemArray.Length; cellIndex++) + { + string formattedNumber; + switch (cellIndex) + { + case 1: //Sales per man hour + formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + salesPerManHourLabel.Text = @"Sales Per Man Hour: $" + formattedNumber; + } + break; + case 2: //Salary Percentage + formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("P2"); + if (formattedNumber != "0.00") + { + salaryPercentageLabel.Text = @"Salary Percentage: " + formattedNumber; + } + break; + case 3: //Salary Dollars + formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + salaryDollarsLabel.Text = @"Salary Dollars: $" + formattedNumber; + } + break; + case 4: //Supplies + formattedNumber = double.Parse(costAnalysis.Rows[0].ItemArray[cellIndex].ToString()).ToString("N2"); + if (formattedNumber != "0.00") + { + suppliesLabel.Text = @"Supplies: $" + formattedNumber; + } + break; + } + } + } + + private string CheckForHoliday(DayOfWeek day) + { + var holidayText = string.Empty; + //Get the currently selected date. + var date = monthCalendar.SelectionStart; + //Now make sure the selected day on the calendar (the date that came from the database) is not the same + //as the day provided, unless the day is Saturday. If the end of week date is not on a Saturday and the + //supplied day is Monday, than subtracting 5 would yield an incorrect date. + if (date.DayOfWeek == DayOfWeek.Saturday) + { + switch (day) + { + case DayOfWeek.Sunday: + date = date.AddDays(-6); + break; + case DayOfWeek.Monday: + date = date.AddDays(-5); + break; + case DayOfWeek.Tuesday: + date = date.AddDays(-4); + break; + case DayOfWeek.Wednesday: + date = date.AddDays(-3); + break; + case DayOfWeek.Thursday: + date = date.AddDays(-2); + break; + case DayOfWeek.Friday: + date = date.AddDays(-1); + break; + } + } + var holiday = Holiday.IsHoliday(date); + switch (holiday) + { + case Holidays.Thanksgiving: + case Holidays.Christmas: + holidayText = @"Closed for " + TextFormat.AddSpacesToSentence(holiday.ToString(), false); + break; + } + return holidayText; + } + } +} //http://stackoverflow.com/questions/487661/how-do-i-suspend-painting-for-a-control-and-its-children internal class DrawingControl { @@ -793,4 +1169,3 @@ namespace AdvertsingProfitControl parent.Refresh(); } } -} diff --git a/AdvertsingProfitControl/FrmModifyRecord.cs b/AdvertsingProfitControl/FrmModifyRecord.cs index 9819de3..02232d0 100644 --- a/AdvertsingProfitControl/FrmModifyRecord.cs +++ b/AdvertsingProfitControl/FrmModifyRecord.cs @@ -347,16 +347,16 @@ namespace AdvertsingProfitControl //Re factor later.... #region DataGridView Filling Methods - private void FillDataGridViews(string dateId = "") + private void FillDataGridViews(int dateId = 0) { var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); BuildDataGridViewEvents(false); - if (dateId == "") + if (dateId == 0) { - dateId = databaseReader.RetrieveMostRecentDateId(databaseTracker.DatabaseConnectionString); + //dateId = databaseReader.RetrieveMostRecentDateId(databaseTracker.DatabaseConnectionString); } //Clear the DataGridViews and the last used ad item. projectionsDataGridView.DataSource = null; @@ -423,7 +423,7 @@ namespace AdvertsingProfitControl weeklySalesDataGridView.Rows.Add(row.ItemArray); } - commentsTextBox.Text = databaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString); + commentsTextBox.Text = databaseReader.RetrieveComments(dateId, databaseTracker.DatabaseConnectionString)[1]; BuildDataGridViewEvents(); } @@ -640,7 +640,7 @@ namespace AdvertsingProfitControl { var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); - FillDataGridViews(databaseReader.RetrieveDateIdByDateString(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + yearComboBox.Text, databaseTracker.DatabaseConnectionString).ToString()); + FillDataGridViews(databaseReader.RetrieveDateIdByDateString(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + yearComboBox.Text, databaseTracker.DatabaseConnectionString)); } private void FillDateSuggestionComboBoxes() @@ -666,7 +666,6 @@ namespace AdvertsingProfitControl yearComboBox.Items.Clear(); monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth; dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation; - yearComboBox.SelectedIndexChanged -= UpdateDaysOfMonthByYear; //Now spin through the oneYearDatesTable and fill the class wide object with all the dates for the most recent year. for (var i = 0; i < datesList.Count; i++) { @@ -727,7 +726,6 @@ namespace AdvertsingProfitControl } monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth; dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation; - yearComboBox.SelectedIndexChanged += UpdateDaysOfMonthByYear; DrawingControl.ResumeDrawing(dateSelectorGroupBox); } @@ -754,71 +752,6 @@ namespace AdvertsingProfitControl } } - /// - /// Fires when the Year combo box's index changes. - /// - /// - /// - private void UpdateDaysOfMonthByYear(object sender, EventArgs e) - { - //Obligatory database retrieval call... - var databaseTracker = new DatabaseTracker(); - var databaseReader = new DatabaseReader(); - //First, grab the year and the month from their respective combo boxes. - var year = yearComboBox.SelectedItem.ToString(); - //Since we can more or less be certain that nothing is null, clear the current date collection. - _dateStringCollection.Clear(); - var months = databaseReader.RetrieveUniqueMonthsList(year, databaseTracker.DatabaseConnectionString); - var mostRecentMonth = months.Max(); - if (mostRecentMonth.Length == 1) - { - mostRecentMonth = "0" + mostRecentMonth; - } - var datesList = databaseReader.RetrieveDateListByYear(year, databaseTracker.DatabaseConnectionString); - - for (var i = 0; i < datesList.Count; i++) - { - _dateStringCollection.Add(datesList[i].ToString("MM/dd/yyyy")); - } - - //Clear the month and day combo boxes and unregister their event handlers. - dayComboBox.Items.Clear(); - monthComboBox.Items.Clear(); - monthComboBox.SelectedIndexChanged -= UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged -= UpdateDataGridViewInformation; - for (var i = 0; i < _dateStringCollection.Count; i++) - { - var dateArray = _dateStringCollection[i].Split('/'); - var month = dateArray[0]; - //Declare the patterns to look for when enumerating the combo boxes. - var dayBasedOnMonthAndYeaRegex = new Regex(@"^(" + mostRecentMonth + @"\/\d{2}\/" + year + ")"); //Only allows days that are actually part of the month and year. - var day = dateArray[1]; - - if (dayBasedOnMonthAndYeaRegex.IsMatch( _dateStringCollection[i])) - { - dayComboBox.Items.Add(day); - } - - if (!monthComboBox.Items.Contains(month)) - { - monthComboBox.Items.Add(month); - } - } - - if (dayComboBox.Items.Count > 0) - { - dayComboBox.SelectedIndex = dayComboBox.Items.Count - 1; - } - if (monthComboBox.Items.Count > 0) - { - monthComboBox.SelectedIndex = monthComboBox.Items.Count - 1; - } - - //Now re-register the event handlers - monthComboBox.SelectedIndexChanged += UpdateDaysOfMonth; - dayComboBox.SelectedIndexChanged += UpdateDataGridViewInformation; - FillDataGridViews(databaseReader.RetrieveDateIdByDateString(monthComboBox.SelectedItem + "/" + dayComboBox.SelectedItem + "/" + year, databaseTracker.DatabaseConnectionString).ToString()); - } #endregion #region Third Party Code diff --git a/AdvertsingProfitControl/FrontPageGenerator.cs b/AdvertsingProfitControl/FrontPageGenerator.cs index 1b7b010..b278cf8 100644 --- a/AdvertsingProfitControl/FrontPageGenerator.cs +++ b/AdvertsingProfitControl/FrontPageGenerator.cs @@ -38,7 +38,7 @@ namespace AdvertsingProfitControl } } - public void BuildFormFrontCompressedLayout(string dateId, double departmentSales, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn, string comments) + public void BuildFormFrontCompressedLayout(int dateId, double departmentSales, double salesProducedByAdItems, double remainingSales, double totalProfitReturnFromAdItems, double totalProfitReturnFromRemainingSales, double totalProfitReturn, string comments) { var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); diff --git a/AdvertsingProfitControl/Holiday.cs b/AdvertsingProfitControl/Holiday.cs new file mode 100644 index 0000000..182e580 --- /dev/null +++ b/AdvertsingProfitControl/Holiday.cs @@ -0,0 +1,89 @@ +using System; +using System.Linq; + +namespace AdvertsingProfitControl +{ + internal class Holiday + { + public static Holidays IsHoliday(DateTime date) + { + if(IsNewYearsDay(date) == Holidays.NewYearsDay) return Holidays.NewYearsDay; + if(IsFourthOfJuly(date) == Holidays.FourthOfJuly) return Holidays.FourthOfJuly; + if(IsThanksgivingDay(date) == Holidays.Thanksgiving) return Holidays.Thanksgiving; + return IsChristmasDay(date) == Holidays.Christmas ? Holidays.Christmas : Holidays.NoHoliday; + } + public static Holidays IsNewYearsEve(DateTime date) + { + return date.DayOfYear == AdjustForWeekendHoliday(new DateTime(date.Year, 12, 31)).DayOfYear ? Holidays.NewYearsEve : Holidays.NoHoliday; + } + public static Holidays IsNewYearsDay(DateTime date) + { + return date.DayOfYear == AdjustForWeekendHoliday(new DateTime(date.Year, 1, 1)).DayOfYear ? Holidays.NewYearsDay : Holidays.NoHoliday; + } + public static Holidays IsMemorialDay(DateTime date) + { //Last Monday in May + var memorialDay = new DateTime(date.Year, 5, 31); + var dayOfWeek = memorialDay.DayOfWeek; + while (dayOfWeek != DayOfWeek.Monday) + { + memorialDay = memorialDay.AddDays(-1); + dayOfWeek = memorialDay.DayOfWeek; + } + return date.DayOfYear == memorialDay.DayOfYear ? Holidays.MemorialDay : Holidays.NoHoliday; + } + public static Holidays IsFourthOfJuly(DateTime date) + { + return date.DayOfYear == AdjustForWeekendHoliday(new DateTime(date.Year, 7, 4)).DayOfYear ? Holidays.FourthOfJuly : Holidays.NoHoliday; + } + public static Holidays IsLaborDay(DateTime date) + { // First Monday in September + var laborDay = new DateTime(date.Year, 9, 1); + var dayOfWeek = laborDay.DayOfWeek; + while (dayOfWeek != DayOfWeek.Monday) + { + laborDay = laborDay.AddDays(1); + dayOfWeek = laborDay.DayOfWeek; + } + return date.DayOfYear == laborDay.DayOfYear ? Holidays.LaborDay : Holidays.NoHoliday; + } + public static Holidays IsThanksgivingDay(DateTime date) + {//4th Thursday in November + var thanksgiving = (from day in Enumerable.Range(1, 30) + where new DateTime(date.Year, 11, day).DayOfWeek == DayOfWeek.Thursday + select day).ElementAt(3); + var thanksgivingDay = new DateTime(date.Year, 11, thanksgiving); + return date.DayOfYear == thanksgivingDay.DayOfYear ? Holidays.Thanksgiving : Holidays.NoHoliday; + } + public static Holidays IsChristmasEve(DateTime date) + { + return date.DayOfYear == AdjustForWeekendHoliday(new DateTime(date.Year, 12, 24)).DayOfYear ? Holidays.ChristmasEve : Holidays.NoHoliday; + } + public static Holidays IsChristmasDay(DateTime date) + { + return date.DayOfYear == new DateTime(date.Year, 12, 25).DayOfYear ? Holidays.Christmas : Holidays.NoHoliday; + } + private static DateTime AdjustForWeekendHoliday(DateTime holiday) + { + switch (holiday.DayOfWeek) + { + case DayOfWeek.Saturday: + return holiday.AddDays(-1); + case DayOfWeek.Sunday: + return holiday.AddDays(1); + } + return holiday; + } + } + public enum Holidays + { + NoHoliday = 0, + NewYearsEve = 1, + NewYearsDay = 2, + MemorialDay = 3, + FourthOfJuly = 4, + LaborDay = 5, + Thanksgiving = 6, + ChristmasEve = 7, + Christmas = 8 + } +} diff --git a/AdvertsingProfitControl/NewModifyRecord.cs b/AdvertsingProfitControl/NewModifyRecord.cs index 00a880d..30e914b 100644 --- a/AdvertsingProfitControl/NewModifyRecord.cs +++ b/AdvertsingProfitControl/NewModifyRecord.cs @@ -2171,6 +2171,14 @@ namespace AdvertsingProfitControl if (result == DialogResult.Yes) { //Save the changes made to the database then clear and load the date picked by the user. + if (SaveRecords(false)) + { + informationLabel.Text = @"Saved all changes successfully." + Environment.NewLine; + } + else + { + errorLabel.Text = @"Failed to save all changes." + Environment.NewLine; + } } else if (result == DialogResult.Cancel) { @@ -2253,9 +2261,6 @@ namespace AdvertsingProfitControl salaryDollarsTextBox.Validating -= ValidateCostAnalysisValues; suppliesTextBox.Enter -= StoreBeginningTextBoxValue; suppliesTextBox.Validating -= ValidateCostAnalysisValues; - //Clear errors and information. - informationLabel.Text = string.Empty; - errorLabel.Text = string.Empty; //Clear projections projectionsDataGridView.Rows.Clear(); //Clear inventory @@ -2387,13 +2392,19 @@ namespace AdvertsingProfitControl var databaseTracker = new DatabaseTracker(); var databaseReader = new DatabaseReader(); var dateId = databaseReader.RetrieveDateIdByDateString(date.ToString("d"), databaseTracker.DatabaseConnectionString); - var projections = databaseReader.ReturnProjectionsTable(dateId.ToString(), databaseTracker.DatabaseConnectionString); - var inventory = databaseReader.ReturnInventoryTable(dateId.ToString(), databaseTracker.DatabaseConnectionString); - var actualSales = databaseReader.ReturnActualSales(dateId.ToString(), databaseTracker.DatabaseConnectionString); + if (dateId == 0) + { + errorLabel.Text = @"Failed to get the date ID number, aborting load operation." + Environment.NewLine; + return; + } + informationLabel.Text = @"Loading data for " + _currentActiveDate.ToString("d") + "." + Environment.NewLine; + var projections = databaseReader.ReturnProjectionsTable(dateId, databaseTracker.DatabaseConnectionString); + var inventory = databaseReader.ReturnInventoryTable(dateId, databaseTracker.DatabaseConnectionString); + var actualSales = databaseReader.ReturnActualSales(dateId, databaseTracker.DatabaseConnectionString); LoadProjectionsTable(projections); LoadInventory(inventory); LoadActualSales(actualSales); - var invoices = databaseReader.ReturnInvoiceTable(dateId.ToString(), databaseTracker.DatabaseConnectionString); + var invoices = databaseReader.ReturnInvoiceTable(dateId, databaseTracker.DatabaseConnectionString); var comments = databaseReader.RetrieveComments(int.Parse(dateId.ToString()), databaseTracker.DatabaseConnectionString); if (comments.Count == 2) { @@ -2403,7 +2414,7 @@ namespace AdvertsingProfitControl { informationLabel.Text += @"No comments to display." + Environment.NewLine; } - var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId.ToString(), + var weeklySales = databaseReader.ReturnWeeklySalesFromDateId(dateId, databaseTracker.DatabaseConnectionString); if (weeklySales.Rows.Count == 1) { @@ -2414,7 +2425,7 @@ namespace AdvertsingProfitControl informationLabel.Text += @"No sales to display." + Environment.NewLine; } - var taxable = databaseReader.ReturnTaxableFromDateId(dateId.ToString(), databaseTracker.DatabaseConnectionString); + var taxable = databaseReader.ReturnTaxableFromDateId(dateId, databaseTracker.DatabaseConnectionString); if (taxable.Rows.Count == 1) { LoadTaxable(taxable); @@ -2463,7 +2474,7 @@ namespace AdvertsingProfitControl //Everything in between the ad item cell and the row attribute cells. if (cellIndex > 1 && cellIndex <= 7) { - if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") + if (projections.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0.0000") { var cell = new DataGridViewTextBoxCell {Value = string.Empty}; newRow.Cells.Add(cell); @@ -2656,7 +2667,7 @@ namespace AdvertsingProfitControl inventoryDataGridView.RowValidating += ValidateInventoryRow; } - public void LoadActualSales(DataTable actualSales) + private void LoadActualSales(DataTable actualSales) { //Assuming all the tables are correctly aligned. //Disable the relevant events in the DataGridViews @@ -2685,7 +2696,7 @@ namespace AdvertsingProfitControl //Everything in between the ad item cell and the row attribute cells. if (cellIndex > 1 && cellIndex <= 7) { - if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0") + if (actualSales.Rows[rowIndex].ItemArray[cellIndex].ToString() == "0.0000") { var cell = new DataGridViewTextBoxCell { Value = string.Empty }; newRow.Cells.Add(cell); @@ -3295,11 +3306,11 @@ namespace AdvertsingProfitControl { errorLabel.Text += @"Failed to process actual sales." + Environment.NewLine; } - if (!SaveInvoices(dateId)) return false; - if (!SaveComments(dateId)) return false; - if (!SaveWeeklySales(dateId)) return false; - if (!SaveTaxable(dateId)) return false; - return SaveCostAnalysis(dateId) && success; + if (!SaveInvoices(dateId, displayInformation)) return false; + if (!SaveComments(dateId, displayInformation)) return false; + if (!SaveWeeklySales(dateId, displayInformation)) return false; + if (!SaveTaxable(dateId, displayInformation)) return false; + return SaveCostAnalysis(dateId, displayInformation) && success; } /// @@ -3329,7 +3340,7 @@ namespace AdvertsingProfitControl return dateId; } - private bool SaveInvoices(int dateId) + private bool SaveInvoices(int dateId, bool displayInformation = true) { var dbT = new DatabaseTracker(); var dbW = new DatabaseWriter(dbT.DatabaseConnectionString); @@ -3340,11 +3351,11 @@ namespace AdvertsingProfitControl errorLabel.Text = writerStatus.GetErrorMessage(); return false; } - informationLabel.Text += writerStatus.GetErrorMessage() + Environment.NewLine; + if(displayInformation) informationLabel.Text += writerStatus.GetErrorMessage() + Environment.NewLine; return true; } - private bool SaveComments(int dateId) + private bool SaveComments(int dateId, bool displayInformation = true) { var dbT = new DatabaseTracker(); var dbW = new DatabaseWriter(dbT.DatabaseConnectionString); @@ -3356,11 +3367,10 @@ namespace AdvertsingProfitControl var status = dbW.ProcessComments(commentsTextBox.Text, dateId, dbT.DatabaseConnectionString); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Comments to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } - informationLabel.Text += @"Comment(s) processed successfully." + Environment.NewLine; + if(displayInformation) informationLabel.Text += @"Comment(s) processed successfully." + Environment.NewLine; var id = status.Id; isCommentDirtyCheckBox.Tag = id; isCommentDirtyCheckBox.Text = @"IsCommentDirty (" + id + @")"; @@ -3375,20 +3385,19 @@ namespace AdvertsingProfitControl int.Parse(isCommentDirtyCheckBox.Tag.ToString())); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Comments to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } isCommentDirtyCheckBox.Checked = false; - informationLabel.Text += @"Comment(s) processed successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Comment(s) processed successfully." + Environment.NewLine; return true; } } - informationLabel.Text += @"No changes detected for the comment(s)" + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"No changes detected for the comment(s)" + Environment.NewLine; return true; } - private bool SaveWeeklySales(int dateId) + private bool SaveWeeklySales(int dateId, bool displayInformation = true) { var dbT = new DatabaseTracker(); var dbW = new DatabaseWriter(dbT.DatabaseConnectionString); @@ -3416,11 +3425,10 @@ namespace AdvertsingProfitControl var status = dbW.ProcessWeeklySales(weeklySales, dateId, dbT.DatabaseConnectionString); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Weekly Sales to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } - informationLabel.Text += @"Weekly Sales processed successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Weekly Sales processed successfully." + Environment.NewLine; isWeeklySalesDirtyCheckBox.Tag = status.Id; isWeeklySalesDirtyCheckBox.Text = @"IsWeeklySalesDirty (" + status.Id + @")"; isWeeklySalesDirtyCheckBox.Checked = false; @@ -3432,20 +3440,19 @@ namespace AdvertsingProfitControl int.Parse(isWeeklySalesDirtyCheckBox.Tag.ToString())); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Weekly Sales to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } isWeeklySalesDirtyCheckBox.Checked = false; - informationLabel.Text += @"Weekly Sales updated successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Weekly Sales updated successfully." + Environment.NewLine; return true; } } - informationLabel.Text += @"No changes detected for Weekly Sales." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"No changes detected for Weekly Sales." + Environment.NewLine; return true; } - private bool SaveTaxable(int dateId) + private bool SaveTaxable(int dateId, bool displayInformation = true) { var dbT = new DatabaseTracker(); var dbW = new DatabaseWriter(dbT.DatabaseConnectionString); @@ -3469,11 +3476,10 @@ namespace AdvertsingProfitControl var status = dbW.ProcessTaxable(taxable, dateId, dbT.DatabaseConnectionString); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Taxable to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } - informationLabel.Text += @"Taxable processed successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Taxable processed successfully." + Environment.NewLine; isTaxableDirtyCheckBox.Tag = status.Id; isTaxableDirtyCheckBox.Text = @"IsTaxableDirty (" + status.Id + @")"; return true; @@ -3484,20 +3490,19 @@ namespace AdvertsingProfitControl int.Parse(isTaxableDirtyCheckBox.Tag.ToString())); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Taxable to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } isTaxableDirtyCheckBox.Checked = false; - informationLabel.Text += @"Taxable updated successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Taxable updated successfully." + Environment.NewLine; return true; } } - informationLabel.Text += @"No changes detected for Taxable." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"No changes detected for Taxable." + Environment.NewLine; return true; } - private bool SaveCostAnalysis(int dateId) + private bool SaveCostAnalysis(int dateId, bool displayInformation = true) { var dbT = new DatabaseTracker(); var dbW = new DatabaseWriter(dbT.DatabaseConnectionString); @@ -3517,11 +3522,10 @@ namespace AdvertsingProfitControl var status = dbW.ProcessCostAnalysis(costAnalysis, dateId, dbT.DatabaseConnectionString); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Cost Analysis to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } - informationLabel.Text += @"Costs Analysis processed successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Costs Analysis processed successfully." + Environment.NewLine; isCostAnalysisDirtyCheckBox.Tag = status.Id; isCostAnalysisDirtyCheckBox.Text = @"IsCostAnalysisDirty (" + status.Id + @")"; isCostAnalysisDirtyCheckBox.Checked = false; @@ -3533,16 +3537,15 @@ namespace AdvertsingProfitControl int.Parse(isCostAnalysisDirtyCheckBox.Tag.ToString())); if (status.Status == WritingOperationStatus.Failed) { - informationLabel.Text += @"Failed to add Cost Analysis to the database." + Environment.NewLine; errorLabel.Text = status.ErrorMessage; return false; } isCostAnalysisDirtyCheckBox.Checked = false; - informationLabel.Text += @"Cost Analysis updated successfully." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"Cost Analysis updated successfully." + Environment.NewLine; return true; } } - informationLabel.Text += @"No changes made to Cost Analysis." + Environment.NewLine; + if (displayInformation) informationLabel.Text += @"No changes made to Cost Analysis." + Environment.NewLine; return true; } #endregion diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application index b0428ef..0367083 100644 --- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application +++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.application @@ -14,7 +14,7 @@ - 1Hy88d0pyLqSm+LXJWOGDCgRmXG4f4D5il87bOZtle0= + YwflYtfjVV9x9+eYf7fKZfD6BpJXoaFqTjumSTnk4Aw= diff --git a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest index 80afe5f..ee6ea0d 100644 --- a/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest +++ b/AdvertsingProfitControl/bin/Debug/AdvertsingProfitControl.vshost.exe.manifest @@ -43,14 +43,14 @@ - + - 9J9ugoTiC4+wY6MW3l8lpcH7ZE4DSPiDNUUMrWgEDvE= + msc2oqq6RpSLr/3P5XGCDPYZql/YogX5J9EV62lCzlM= @@ -93,7 +93,7 @@ - h0U0mLzUnhEKHaiuXsTC+7xvKixcE9+lG0nu0vBTYdI= + BhxzzAVktfxM46PKaURg6/dVO+AoTuOm4bm2CLmjz1A=