StatisticsDataAnalysisVC.m 175 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985
  1. //
  2. // StatisticsDataAnalysisVC.m
  3. // IBOSS-HJ
  4. //
  5. // Created by 关宏厚 on 2020/12/7.
  6. // Copyright © 2020 elongtian. All rights reserved.
  7. //
  8. #import "StatisticsDataAnalysisVC.h"
  9. #import "DateFormat.h"
  10. #import "Util.h"
  11. #import "MyView.h"
  12. #import "StatisticsDataAnalysisDetailVC.h"
  13. @interface StatisticsDataAnalysisVC ()
  14. {
  15. NSMutableArray *salesIncomeYValues;
  16. NSMutableArray *salesProfitTitleArray;
  17. UIScrollView *scroll;
  18. UIView *content;
  19. UIView *salesProfitContent;
  20. UIView *currencyCapitalContent;
  21. UIView *currentSituationContent;
  22. UIView *payableContent;
  23. UIView *inventoryStatusContent;
  24. UIView *paymentFeesStatusContent;
  25. MyView *procurementStatusV;
  26. UIView *procurementSituationContent;
  27. UIView *titleView;
  28. UIView *debtSumView;
  29. UIView *depositAmountView;
  30. UIView *netMoneyInflowView;
  31. NSMutableArray *assetDebtyValues;
  32. NSMutableArray *netMoneyValues;
  33. NSMutableArray *receivableTitleArray;
  34. NSMutableArray *receivableXTitleArray;
  35. NSMutableArray *procurementStatusXTitleArray;
  36. NSMutableArray *procurementStatusTitleArray;
  37. NSMutableArray *inventoryAmountArray;
  38. NSMutableArray *inventoryQuantityArray;
  39. NSMutableArray *procurementStatusYArray;
  40. NSMutableArray *salesIncomeTitleArray;
  41. NSMutableArray *advancePaymentTitleArray;
  42. NSMutableArray *payableXTitleArray;
  43. NSMutableArray *inventoryTitleArray;
  44. NSMutableArray *paymentFeesXArray;
  45. NSMutableArray *paymentFeesYArray;
  46. NSMutableArray *paymentFeesYIdArray;
  47. NSMutableArray *accountArray;
  48. NSArray *fncArray;
  49. NSMutableArray *receivablesValuesArray;
  50. NSMutableArray *advancePaymentValuesArray;
  51. NSInteger height;
  52. NSInteger innerheight;
  53. NSString *accountId;
  54. NSString *accountCode;
  55. NSInteger topMargin;
  56. UILabel *lblNetProfitRate;
  57. UILabel *lblSalesIncome;
  58. UILabel *lblSalesCost;
  59. UILabel *lblFeeAmount;
  60. UILabel *lblNetProfit;
  61. UILabel *lblSalesMargin;
  62. UILabel *lblGrossProfitMargin;
  63. UILabel *lblMonetoryCapitalAmount;
  64. UILabel *lblCashInHand;
  65. UILabel *lblBankDeposit;
  66. UILabel *lblNetMoneyInflow;
  67. UILabel *lblReceivablesAmount;
  68. UILabel *lblDepositAmount;
  69. UILabel *lblAdvancePayment;
  70. UILabel *lblAccountsPayable;
  71. UILabel *lblAdvancePaymentAmount;
  72. UILabel *lblOtherMonetoryCaiptal;
  73. UILabel *lblReceivablesAdvanceDeposit;
  74. UILabel *lblInventoryAmount;
  75. UILabel *lblInventoryQuantity;
  76. UILabel *lblTitleInventoryAmount;
  77. UILabel *lblInventoryQuantityTitle;
  78. UILabel *lblPlanAmount;
  79. UILabel *lblProcuremmentPercent;
  80. UILabel *lblProcurementAmount;
  81. NSString *typeId;
  82. NSString *moneytoryAssetsDate;
  83. NSString *procurementStatusDate;
  84. NSString *paymentFeesDate;
  85. UIButton *btnFncAccount;
  86. UIView *advancePayment;
  87. UIView *netProfitRateView;
  88. CAShapeLayer *btnCustomMaskLayer;
  89. CAShapeLayer *btnRecentlyThirtyDaysMaskLayer;
  90. CAShapeLayer *btnChannelMaskLayer;
  91. CAShapeLayer *btnDepartmentMaskLayer;
  92. CAShapeLayer *moneytoryCapitalMaskLayer;
  93. CAShapeLayer *moneytoryCapitalCurrentMonthMaskLayer;
  94. CAShapeLayer *currentSituationChannelMaskLayer;
  95. CAShapeLayer *currentSituationDepartmentMaskLayer;
  96. CAShapeLayer *procurementCustomMonthMaskLayer;
  97. CAShapeLayer *procurementCurrentMonthMaskLayer;
  98. CAShapeLayer *paymentFeesCustomMonthMaskLayer;
  99. CAShapeLayer *paymentFeesCurrentMonthMaskLayer;
  100. UIView *netProfitContent;
  101. UILabel *lblFeesTotalAmount;
  102. int count;
  103. UIView *vDate;
  104. CustomBorderView *salesProfitBorderV;
  105. CustomBorderView *currencyCapitalBorderV;
  106. CustomBorderView *currentSituationBorderV;
  107. CustomBorderView *payableBorderV;
  108. CustomBorderView *procurementStatusPieBorderV;
  109. CustomBorderView *procurementStatusChartBorderV;
  110. CustomBorderView *inventoryStatusBorderV;
  111. CustomBorderView *paymentBorderV;
  112. int borderLineWidth;
  113. }
  114. @end
  115. @implementation StatisticsDataAnalysisVC
  116. - (void)viewDidLoad {
  117. [super viewDidLoad];
  118. [self loadNavStyle];
  119. typeId=@"0";
  120. count=0;
  121. topMargin=15;
  122. borderLineWidth=1;
  123. salesIncomeYValues=[[NSMutableArray alloc]init];
  124. accountArray=[[NSMutableArray alloc]init];
  125. salesProfitTitleArray=[[NSMutableArray alloc]init];
  126. receivablesValuesArray=[[NSMutableArray alloc]init];
  127. receivableXTitleArray=[[NSMutableArray alloc]init];
  128. procurementStatusTitleArray=[[NSMutableArray alloc]init];
  129. [procurementStatusTitleArray addObject:@"计划额"];
  130. [procurementStatusTitleArray addObject:@"完成额"];
  131. advancePaymentValuesArray=[[NSMutableArray alloc]init];
  132. procurementStatusYArray=[[NSMutableArray alloc]init];
  133. payableXTitleArray=[[NSMutableArray alloc]init];
  134. assetDebtyValues=[[NSMutableArray alloc]init];
  135. [assetDebtyValues addObject:[NSNumber numberWithDouble:5760392.95]];
  136. [assetDebtyValues addObject:[NSNumber numberWithDouble:1922981.77]];
  137. netMoneyValues=[[NSMutableArray alloc]init];
  138. procurementStatusXTitleArray=[[NSMutableArray alloc]init];
  139. receivableTitleArray=[[NSMutableArray alloc]init];
  140. [receivableTitleArray addObject:@"应收款"];
  141. [receivableTitleArray addObject:@"预收款"];
  142. salesIncomeTitleArray=[[NSMutableArray alloc]init];
  143. [salesIncomeTitleArray addObject:@"销售收入金额"];
  144. [salesIncomeTitleArray addObject:@"销售成本"];
  145. [salesIncomeTitleArray addObject:@"费用金额"];
  146. advancePaymentTitleArray=[[NSMutableArray alloc]init];
  147. [advancePaymentTitleArray addObject:@"应付款"];
  148. [advancePaymentTitleArray addObject:@"预付款"];
  149. inventoryTitleArray=[[NSMutableArray alloc]init];
  150. inventoryAmountArray=[[NSMutableArray alloc]init];
  151. inventoryQuantityArray=[[NSMutableArray alloc]init];
  152. paymentFeesXArray=[[NSMutableArray alloc]init];
  153. paymentFeesYArray=[[NSMutableArray alloc]init];
  154. paymentFeesYIdArray=[[NSMutableArray alloc]init];
  155. _salesProfitStartDate =[DateFormat getCurrentDate];
  156. _salesProfitEndDate=[DateFormat getCurrentDate];
  157. moneytoryAssetsDate=[DateFormat getCurrentNoSeparateMonth];
  158. procurementStatusDate=[DateFormat getCurrentNoSeparateMonth];
  159. paymentFeesDate=[DateFormat getCurrentNoSeparateMonth];
  160. [self initUI];
  161. [self startLoading];
  162. [self asyncConcurrent];
  163. }
  164. #pragma mark - 私有函数
  165. /**
  166. 初始化UI
  167. */
  168. -(void)initUI
  169. {
  170. // titleView = [[UIView alloc]init];
  171. // titleView.backgroundColor = NavigationBarTintColor;
  172. // titleView.frame = CGRectMake(0, 0, Screen_Width, 40);
  173. // UILabel *titleCustom = [[UILabel alloc]init];
  174. // titleCustom.frame = CGRectMake(Screen_Width/4-35, 10, 70, 25);
  175. // titleCustom.text = @"自定义";
  176. // titleCustom.textColor = [UIColor whiteColor];
  177. // titleCustom.font = [UIFont systemFontOfSize:16];
  178. // [titleView addSubview:titleCustom];
  179. // [self.view addSubview:titleView];
  180. // UIImageView *customImgView=[UIImageView new];
  181. // customImgView.frame=CGRectMake(CGRectGetMaxX(titleCustom.frame), 10, 25, 25);
  182. // [customImgView setImage:[UIImage imageNamed:@"drop_down"]];
  183. // [titleView addSubview:customImgView];
  184. // UIView *separatorView=[UIView new];
  185. // separatorView.frame=CGRectMake(Screen_Width/2, 10,2,20);
  186. // [separatorView setBackgroundColor:[UIColor lightGrayColor]];
  187. // [titleView addSubview:separatorView];
  188. //
  189. // UILabel *titleAll = [[UILabel alloc]init];
  190. // titleAll.frame = CGRectMake(Screen_Width/4*3, 10, 50, 25);
  191. // titleAll.text = @"全部";
  192. // titleAll.textColor = [UIColor whiteColor];
  193. // titleAll.font = [UIFont systemFontOfSize:16];
  194. // [titleView addSubview:titleAll];
  195. //
  196. // UIImageView *customImgView1=[UIImageView new];
  197. // customImgView1.frame=CGRectMake(CGRectGetMaxX(titleAll.frame), 10, 25, 25);
  198. // [customImgView1 setImage:[UIImage imageNamed:@"drop_down"]];
  199. // [titleView addSubview:customImgView1];
  200. int rowHeight=50;
  201. height=0;
  202. content=[UIView new];
  203. content.frame=CGRectMake(0, 0,Screen_Width,0);
  204. scroll=[[UIScrollView alloc]init];
  205. scroll.frame=CGRectMake(0,0, Screen_Width, Screen_Height);
  206. [self.view addSubview:scroll];
  207. [scroll addSubview:content];
  208. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_SALES_PROFIT_IPHONE].location!=NSNotFound){
  209. salesProfitContent=[UIView new];
  210. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width,0);
  211. salesProfitContent.backgroundColor=[UIColor whiteColor];
  212. [content addSubview:salesProfitContent];
  213. UIView *profitTitleView = [[UIView alloc]init];
  214. profitTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45);
  215. UIView *profitView=[UIImageView new];
  216. profitView.frame=CGRectMake(10, 10,10 , 25);
  217. [profitView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  218. [profitTitleView addSubview:profitView];
  219. UILabel *titleProfit = [[UILabel alloc]init];
  220. titleProfit.frame = CGRectMake(CGRectGetMaxX(profitView.frame)+10, 10, 100, 25);
  221. titleProfit.text = @"销售利润";
  222. titleProfit.textColor = [UIColor blackColor];
  223. titleProfit.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  224. [profitTitleView addSubview:titleProfit];
  225. [salesProfitContent addSubview:profitTitleView];
  226. UIView *separator=[UIView new];
  227. separator.frame=CGRectMake(0,profitTitleView.frame.size.height-1, profitTitleView.frame.size.width-20, 0.5);
  228. [separator setBackgroundColor:[UIColor lightGrayColor]];
  229. [profitTitleView addSubview:separator ];
  230. _btnCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-175-10,CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)];
  231. [_btnCustom setTitle:@"自定义" forState:UIControlStateNormal];
  232. [_btnCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  233. _btnCustom.titleLabel.font = [UIFont systemFontOfSize: 10.0];
  234. [_btnCustom addTarget:self action:@selector(selectCustomDateData) forControlEvents:UIControlEventTouchUpInside];
  235. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_btnCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  236. CAShapeLayer *maskLayer = [CAShapeLayer layer];
  237. maskLayer.frame = _btnCustom.bounds;
  238. maskLayer.path = maskPath.CGPath;
  239. _btnCustom.layer.mask = maskLayer;
  240. [salesProfitContent addSubview:_btnCustom];
  241. btnCustomMaskLayer = [CAShapeLayer layer];
  242. btnCustomMaskLayer.frame = _btnCustom.bounds;
  243. btnCustomMaskLayer.path = maskPath.CGPath;
  244. btnCustomMaskLayer.fillColor=[UIColor clearColor].CGColor;
  245. btnCustomMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  246. btnCustomMaskLayer.lineWidth=1;
  247. [_btnCustom.layer addSublayer:btnCustomMaskLayer];
  248. _btnYesterday = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnCustom.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)];
  249. [_btnYesterday setTitle:[DateFormat getDateBefore:1] forState:UIControlStateNormal];
  250. _btnYesterday.layer.cornerRadius=0;
  251. _btnYesterday.layer.borderWidth=1;
  252. [_btnYesterday addTarget:self action:@selector(selectYesterdayDateData) forControlEvents:UIControlEventTouchUpInside];
  253. [_btnYesterday setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  254. [_btnYesterday.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡
  255. _btnYesterday.layer.borderColor=[UIColor lightGrayColor].CGColor;
  256. _btnYesterday.titleLabel.font = [UIFont systemFontOfSize: 10.0];
  257. [salesProfitContent addSubview:_btnYesterday];
  258. _btnToday = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnYesterday.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)];
  259. [_btnToday setTitle: [DateFormat getCurrentDate]forState:UIControlStateNormal];
  260. _btnToday.layer.cornerRadius=0;
  261. _btnToday.layer.borderWidth=1;
  262. _btnToday.titleLabel.font = [UIFont systemFontOfSize: 10.0];
  263. [_btnToday addTarget:self action:@selector(selectTodayDateData) forControlEvents:UIControlEventTouchUpInside];
  264. [_btnToday setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  265. [_btnToday.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡
  266. _btnToday.layer.borderColor=[UIColor redColor].CGColor;
  267. [salesProfitContent addSubview:_btnToday];
  268. _btnRecentlySevenDays = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnToday.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)];
  269. [_btnRecentlySevenDays setTitle:@"近7天" forState:UIControlStateNormal];
  270. _btnRecentlySevenDays.titleLabel.font = [UIFont systemFontOfSize: 10.0];
  271. _btnRecentlySevenDays.layer.cornerRadius=0;
  272. _btnRecentlySevenDays.layer.borderWidth=1;
  273. [_btnRecentlySevenDays addTarget:self action:@selector(selectSevenDaysData) forControlEvents:UIControlEventTouchUpInside];
  274. [_btnRecentlySevenDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  275. [_btnRecentlySevenDays.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡
  276. _btnRecentlySevenDays.layer.borderColor=[UIColor lightGrayColor].CGColor;
  277. [salesProfitContent addSubview:_btnRecentlySevenDays];
  278. _btnRecentlyThirtyDays = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnRecentlySevenDays.frame),CGRectGetMaxY(profitTitleView.frame)+topMargin, 70, 35)];
  279. [_btnRecentlyThirtyDays setTitle:@"近30天" forState:UIControlStateNormal];
  280. _btnRecentlyThirtyDays.titleLabel.font = [UIFont systemFontOfSize: 10.0];
  281. [_btnRecentlyThirtyDays addTarget:self action:@selector(selectThirtyDaysData) forControlEvents:UIControlEventTouchUpInside];
  282. [_btnRecentlyThirtyDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  283. UIBezierPath *maskPath2 = [UIBezierPath bezierPathWithRoundedRect:_btnRecentlyThirtyDays.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  284. CAShapeLayer *maskLayer2 = [CAShapeLayer layer];
  285. maskLayer2.frame = _btnRecentlyThirtyDays.bounds;
  286. maskLayer2.path = maskPath2.CGPath;
  287. _btnRecentlyThirtyDays.layer.mask = maskLayer2;
  288. [salesProfitContent addSubview:_btnRecentlyThirtyDays];
  289. btnRecentlyThirtyDaysMaskLayer = [CAShapeLayer layer];
  290. btnRecentlyThirtyDaysMaskLayer.frame = _btnRecentlyThirtyDays.bounds;
  291. btnRecentlyThirtyDaysMaskLayer.path = maskPath2.CGPath;
  292. btnRecentlyThirtyDaysMaskLayer.fillColor=[UIColor clearColor].CGColor;
  293. btnRecentlyThirtyDaysMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  294. btnRecentlyThirtyDaysMaskLayer.lineWidth=1;
  295. [_btnRecentlyThirtyDays.layer addSublayer:btnRecentlyThirtyDaysMaskLayer];
  296. vDate =[UIView new];
  297. vDate.frame=CGRectMake(0, CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, 0);
  298. [salesProfitContent addSubview:vDate];
  299. vDate.hidden=YES;
  300. _btnSalesProfitStartDate = [UIButton buttonWithType:UIButtonTypeCustom];
  301. [_btnSalesProfitStartDate setTitle:_salesProfitStartDate forState:UIControlStateNormal];
  302. [_btnSalesProfitStartDate setBackgroundColor:[UIColor whiteColor]];
  303. [_btnSalesProfitStartDate setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  304. _btnSalesProfitStartDate.titleLabel.font= [UIFont systemFontOfSize:14];
  305. [_btnSalesProfitStartDate addTarget:self action:@selector(btnSelectStartDate) forControlEvents:UIControlEventTouchUpInside];
  306. _btnSalesProfitStartDate.frame = CGRectMake(Screen_Width/2-110 ,0 , 100, 25);
  307. [vDate addSubview:_btnSalesProfitStartDate];
  308. UILabel *separatorLbl=[UILabel new];
  309. separatorLbl.frame=CGRectMake(CGRectGetMaxX(_btnSalesProfitStartDate.frame), 0, 20, 25);
  310. separatorLbl.text=@"--";
  311. separatorLbl.textColor = [UIColor blackColor];
  312. separatorLbl.font = [UIFont systemFontOfSize: 14];
  313. [vDate addSubview:separatorLbl];
  314. _btnSalesProfitEndDate = [UIButton buttonWithType:UIButtonTypeCustom];
  315. [_btnSalesProfitEndDate setTitle:_salesProfitEndDate forState:UIControlStateNormal];
  316. [_btnSalesProfitEndDate setBackgroundColor:[UIColor whiteColor]];
  317. [_btnSalesProfitEndDate setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  318. _btnSalesProfitEndDate.titleLabel.font= [UIFont systemFontOfSize:14];
  319. [_btnSalesProfitEndDate addTarget:self action:@selector(btnSelectEndDate) forControlEvents:UIControlEventTouchUpInside];
  320. _btnSalesProfitEndDate.frame = CGRectMake(CGRectGetMaxX(separatorLbl.frame) ,0 , 100, 25);
  321. [vDate addSubview:_btnSalesProfitEndDate];
  322. netProfitContent =[[UIView alloc]init];
  323. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, 0);
  324. [salesProfitContent addSubview:netProfitContent];
  325. netProfitRateView= [[UIView alloc]init];
  326. netProfitRateView.frame = CGRectMake(0,0, Screen_Width, 25);
  327. UILabel *lblTitleNetProfitRate = [[UILabel alloc]init];
  328. lblTitleNetProfitRate.frame = CGRectMake(Screen_Width/2-90, 0, 90, 25);
  329. lblTitleNetProfitRate.text = @"净利率:";
  330. lblTitleNetProfitRate.textColor = [UIColor redColor];
  331. lblTitleNetProfitRate.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  332. [netProfitRateView addSubview:lblTitleNetProfitRate];
  333. lblNetProfitRate = [[UILabel alloc]init];
  334. lblNetProfitRate.frame = CGRectMake(CGRectGetMaxX(lblTitleNetProfitRate.frame), 0, 150, 25);
  335. lblNetProfitRate.textColor = [UIColor redColor];
  336. lblNetProfitRate.text=@"0.00%";
  337. lblNetProfitRate.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  338. [netProfitRateView addSubview:lblNetProfitRate];
  339. [netProfitContent addSubview:netProfitRateView];
  340. UIView *salesIncomeView = [[UIView alloc]init];
  341. salesIncomeView.frame = CGRectMake(0,CGRectGetMaxY(netProfitRateView.frame),Screen_Width/2, rowHeight);
  342. lblSalesIncome= [[UILabel alloc]init];
  343. lblSalesIncome.frame = CGRectMake(0, 0,salesIncomeView.frame.size.width, 25);
  344. lblSalesIncome.textAlignment=UITextAlignmentCenter;
  345. lblSalesIncome.textColor = [UIColor blackColor];
  346. lblSalesIncome.text=@"0.00";
  347. lblSalesIncome.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  348. [salesIncomeView addSubview:lblSalesIncome];
  349. UILabel *lblTitleSalesIncome = [[UILabel alloc]init];
  350. lblTitleSalesIncome.frame = CGRectMake(0,CGRectGetMaxY(lblSalesIncome.frame),salesIncomeView.frame.size.width, 25);
  351. lblTitleSalesIncome.text = @"销售收入";
  352. lblTitleSalesIncome.textColor = [UIColor blackColor];
  353. lblTitleSalesIncome.textAlignment=UITextAlignmentCenter;
  354. lblTitleSalesIncome.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  355. [salesIncomeView addSubview:lblTitleSalesIncome];
  356. [netProfitContent addSubview:salesIncomeView];
  357. UIView *salesCostView = [[UIView alloc]init];
  358. salesCostView.frame = CGRectMake(0,CGRectGetMaxY(salesIncomeView.frame)+10, Screen_Width/2, rowHeight);
  359. lblSalesCost = [[UILabel alloc]init];
  360. lblSalesCost.frame = CGRectMake(0, 0,salesCostView.frame.size.width, 25);
  361. lblSalesCost.textAlignment=UITextAlignmentCenter;
  362. lblSalesCost.textColor = [UIColor blackColor];
  363. lblSalesCost.text=@"0.00";
  364. lblSalesCost.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  365. [salesCostView addSubview:lblSalesCost];
  366. UILabel *lblTitleSalesCost = [[UILabel alloc]init];
  367. lblTitleSalesCost.frame = CGRectMake(0, CGRectGetMaxY(lblSalesCost.frame),salesCostView.frame.size.width , 25);
  368. lblTitleSalesCost.text = @"销售成本";
  369. lblTitleSalesCost.textAlignment=UITextAlignmentCenter;
  370. lblTitleSalesCost.textColor = [UIColor blackColor];
  371. lblTitleSalesCost.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  372. [salesCostView addSubview:lblTitleSalesCost];
  373. [netProfitContent addSubview:salesCostView];
  374. UIView *feeAmountView = [[UIView alloc]init];
  375. feeAmountView.frame = CGRectMake(0,CGRectGetMaxY(salesCostView.frame)+10, Screen_Width/2, rowHeight);
  376. lblFeeAmount = [[UILabel alloc]init];
  377. lblFeeAmount.frame = CGRectMake(0, 0,feeAmountView.frame.size.width , 25);
  378. lblFeeAmount.textAlignment=UITextAlignmentCenter;
  379. lblFeeAmount.textColor = [UIColor blackColor];
  380. lblFeeAmount.text=@"0.00 ";
  381. lblFeeAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  382. [feeAmountView addSubview:lblFeeAmount];
  383. UILabel *lblTitleFeeAmount = [[UILabel alloc]init];
  384. lblTitleFeeAmount.frame = CGRectMake(0, CGRectGetMaxY(lblFeeAmount.frame), feeAmountView.frame.size.width, 25);
  385. lblTitleFeeAmount.text = @"费用金额";
  386. lblTitleFeeAmount.textAlignment=UITextAlignmentCenter;
  387. lblTitleFeeAmount.textColor = [UIColor blackColor];
  388. lblTitleFeeAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  389. [feeAmountView addSubview:lblTitleFeeAmount];
  390. [netProfitContent addSubview:feeAmountView];
  391. UIView *middleSeparator=[UIView new];
  392. middleSeparator.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(netProfitRateView.frame)+topMargin, 0.5, 150);
  393. middleSeparator.backgroundColor=[UIColor lightGrayColor];
  394. [netProfitContent addSubview:middleSeparator];
  395. UIView *netProfitView = [[UIView alloc]init];
  396. netProfitView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(netProfitRateView.frame), Screen_Width/2, rowHeight);
  397. lblNetProfit = [[UILabel alloc]init];
  398. lblNetProfit.frame = CGRectMake(0, 0, netProfitView.frame.size.width, 25);
  399. lblNetProfit.textAlignment=UITextAlignmentCenter;
  400. lblNetProfit.text=@"0.00";
  401. lblNetProfit.textColor = [UIColor blackColor];
  402. lblNetProfit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  403. [netProfitView addSubview:lblNetProfit];
  404. UILabel *lblNetProfitTitle = [[UILabel alloc]init];
  405. lblNetProfitTitle.frame = CGRectMake(0,CGRectGetMaxY(lblNetProfit.frame), netProfitView.frame.size.width, 25);
  406. lblNetProfitTitle.text = @"净利润";
  407. lblNetProfitTitle.textAlignment=UITextAlignmentCenter;
  408. lblNetProfitTitle.textColor = [UIColor blackColor];
  409. lblNetProfitTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  410. [netProfitView addSubview:lblNetProfitTitle];
  411. [netProfitContent addSubview:netProfitView];
  412. UIView *salesMarginView = [[UIView alloc]init];
  413. salesMarginView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(netProfitView.frame)+10,Screen_Width/2, rowHeight);
  414. lblSalesMargin = [[UILabel alloc]init];
  415. lblSalesMargin.frame = CGRectMake(0, 0,salesMarginView.frame.size.width, 25);
  416. lblSalesMargin.textAlignment=UITextAlignmentCenter;
  417. lblSalesMargin.textColor = [UIColor blackColor];
  418. lblSalesMargin.text=@"0.00";
  419. lblSalesMargin.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  420. [salesMarginView addSubview:lblSalesMargin];
  421. UILabel *lblSalesMarginTitle = [[UILabel alloc]init];
  422. lblSalesMarginTitle.frame = CGRectMake(0,CGRectGetMaxY(lblSalesMargin.frame), salesMarginView.frame.size.width, 25);
  423. lblSalesMarginTitle.text = @"销售毛利";
  424. lblSalesMarginTitle.textColor = [UIColor blackColor];
  425. lblSalesMarginTitle.textAlignment=UITextAlignmentCenter;
  426. lblSalesMarginTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  427. [salesMarginView addSubview:lblSalesMarginTitle];
  428. [netProfitContent addSubview:salesMarginView];
  429. UIView *grossProfitMarginView = [[UIView alloc]init];
  430. grossProfitMarginView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(salesMarginView.frame)+10,Screen_Width/2, rowHeight);
  431. lblGrossProfitMargin = [[UILabel alloc]init];
  432. lblGrossProfitMargin.frame = CGRectMake(0, 0,grossProfitMarginView.frame.size.width, 25);
  433. lblGrossProfitMargin.textAlignment=UITextAlignmentCenter;
  434. lblGrossProfitMargin.textColor = [UIColor blackColor];
  435. lblGrossProfitMargin.text=@"0.00";
  436. lblGrossProfitMargin.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  437. [grossProfitMarginView addSubview:lblGrossProfitMargin];
  438. UILabel *lblGrossProfitMarginTitle = [[UILabel alloc]init];
  439. lblGrossProfitMarginTitle.frame = CGRectMake(0,CGRectGetMaxY(lblGrossProfitMargin.frame), grossProfitMarginView.frame.size.width, 25);
  440. lblGrossProfitMarginTitle.text = @"毛利率";
  441. lblGrossProfitMarginTitle.textAlignment=UITextAlignmentCenter;
  442. lblGrossProfitMarginTitle.textColor = [UIColor blackColor];
  443. lblGrossProfitMarginTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  444. [grossProfitMarginView addSubview:lblGrossProfitMarginTitle];
  445. [netProfitContent addSubview:grossProfitMarginView];
  446. _btnChannel = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(feeAmountView.frame)+topMargin, 70, 35)];
  447. [_btnChannel setTitle:@"渠道" forState:UIControlStateNormal];
  448. [_btnChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  449. _btnChannel.tag=1000;
  450. [_btnChannel addTarget:self action:@selector(goSalesProfit:) forControlEvents:UIControlEventTouchUpInside];
  451. _btnChannel.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  452. UIBezierPath *maskPath5 = [UIBezierPath bezierPathWithRoundedRect:_btnChannel.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  453. CAShapeLayer *maskLayer5 = [CAShapeLayer layer];
  454. maskLayer5.frame = _btnChannel.bounds;
  455. maskLayer5.path = maskPath5.CGPath;
  456. _btnChannel.layer.mask = maskLayer5;
  457. [netProfitContent addSubview:_btnChannel];
  458. btnChannelMaskLayer = [CAShapeLayer layer];
  459. btnChannelMaskLayer.frame = _btnChannel.bounds;
  460. btnChannelMaskLayer.path = maskPath5.CGPath;
  461. btnChannelMaskLayer.fillColor=[UIColor clearColor].CGColor;
  462. btnChannelMaskLayer.strokeColor=[UIColor redColor].CGColor;
  463. btnChannelMaskLayer.lineWidth=1;
  464. [_btnChannel.layer addSublayer:btnChannelMaskLayer];
  465. _btnDepartment = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnChannel.frame),CGRectGetMaxY(feeAmountView.frame)+topMargin, 70, 35)];
  466. [_btnDepartment setTitle:@"部门" forState:UIControlStateNormal];
  467. [_btnDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  468. _btnDepartment.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  469. [_btnDepartment addTarget:self action:@selector(goSalesProfit:) forControlEvents:UIControlEventTouchUpInside];
  470. _btnDepartment.tag=1001;
  471. UIBezierPath *maskPath7 = [UIBezierPath bezierPathWithRoundedRect:_btnDepartment.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  472. CAShapeLayer *maskLayer8 = [CAShapeLayer layer];
  473. maskLayer8.frame = _btnDepartment.bounds;
  474. maskLayer8.path = maskPath7.CGPath;
  475. _btnDepartment.layer.mask = maskLayer8;
  476. [netProfitContent addSubview:_btnDepartment];
  477. btnDepartmentMaskLayer = [CAShapeLayer layer];
  478. btnDepartmentMaskLayer.frame = _btnDepartment.bounds;
  479. btnDepartmentMaskLayer.path = maskPath7.CGPath;
  480. btnDepartmentMaskLayer.fillColor=[UIColor clearColor].CGColor;
  481. btnDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  482. btnDepartmentMaskLayer.lineWidth=1;
  483. [_btnDepartment.layer addSublayer:btnDepartmentMaskLayer];
  484. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+10, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  485. salesProfitBorderV=[CustomBorderView new];
  486. salesProfitBorderV.frame=CGRectMake(5, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-30, 350);
  487. [salesProfitBorderV setBackgroundColor:[UIColor whiteColor]];
  488. [salesProfitBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  489. [salesProfitContent addSubview:salesProfitBorderV];
  490. _chartView=[[BarChartView alloc]init];
  491. _chartView.frame=CGRectMake(0,0,salesProfitBorderV.frame.size.width, 350);
  492. [salesProfitBorderV addSubview:_chartView];
  493. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  494. height=CGRectGetMaxY(salesProfitContent.frame);
  495. salesProfitContent.layer.cornerRadius=CornerRadius;
  496. [content addSubview:salesProfitContent];
  497. }
  498. // UIView *assetDebtTitleView = [[UIView alloc]init];
  499. //
  500. // assetDebtTitleView.frame = CGRectMake(0,CGRectGetMaxY(_chartView.frame)+10 ,Screen_Width, 40);
  501. //
  502. // UIView *assetDebtView=[UIImageView new];
  503. // assetDebtView.frame=CGRectMake(10, 10,10 , 25);
  504. // [assetDebtView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  505. // [assetDebtTitleView addSubview:assetDebtView];
  506. //
  507. //
  508. // UILabel *titleAssetsDebt = [[UILabel alloc]init];
  509. // titleAssetsDebt.frame = CGRectMake(CGRectGetMaxX(assetDebtView.frame)+10, 10, 70, 25);
  510. // titleAssetsDebt.text = @"资产负债";
  511. // titleAssetsDebt.textColor = [UIColor blackColor];
  512. // titleAssetsDebt.font = [UIFont systemFontOfSize:16];
  513. // [assetDebtTitleView addSubview:titleAssetsDebt];
  514. // [content addSubview:assetDebtTitleView];
  515. //
  516. //
  517. // _btnAssetsCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-135,CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)];
  518. // [_btnAssetsCustom setTitle:@"自定义" forState:UIControlStateNormal];
  519. // [_btnAssetsCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  520. // UIBezierPath *maskPath10 = [UIBezierPath bezierPathWithRoundedRect:_btnAssetsCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(10.0, 10.0)];
  521. // CAShapeLayer *maskLayer10 = [CAShapeLayer layer];
  522. // maskLayer10.frame = _btnAssetsCustom.bounds;
  523. // maskLayer10.path = maskPath10.CGPath;
  524. // _btnAssetsCustom.layer.mask = maskLayer10;
  525. //
  526. // CAShapeLayer *maskLayer12 = [CAShapeLayer layer];
  527. // maskLayer12.frame = _btnAssetsCustom.bounds;
  528. // maskLayer12.path = maskPath10.CGPath;
  529. // maskLayer12.fillColor=[UIColor clearColor].CGColor;
  530. // maskLayer12.strokeColor=[UIColor lightGrayColor].CGColor;
  531. // maskLayer12.lineWidth=1;
  532. // [_btnAssetsCustom.layer addSublayer:maskLayer12];
  533. //
  534. // [content addSubview:_btnAssetsCustom];
  535. //
  536. // _btnLastYear = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnAssetsCustom.frame),CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)];
  537. //
  538. // [_btnLastYear setTitle:@"2020-12" forState:UIControlStateNormal];
  539. // _btnLastYear.layer.cornerRadius=0;
  540. // _btnLastYear.layer.borderWidth=1;
  541. // [_btnLastYear setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  542. // [_btnLastYear.layer setMasksToBounds:YES];//设置按钮的圆角半径不会被遮挡
  543. // _btnLastYear.layer.borderColor=[UIColor lightGrayColor].CGColor;
  544. // [content addSubview:_btnLastYear];
  545. //
  546. // _btnThisYear = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnLastYear.frame),CGRectGetMaxY(assetDebtTitleView.frame)+10, 90, 35)];
  547. // [_btnThisYear setTitle:@"本年" forState:UIControlStateNormal];
  548. // [_btnThisYear setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  549. // UIBezierPath *maskPath11 = [UIBezierPath bezierPathWithRoundedRect:_btnThisYear.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(10.0, 10.0)];
  550. // CAShapeLayer *maskLayer11 = [CAShapeLayer layer];
  551. // maskLayer11.frame = _btnThisYear.bounds;
  552. // maskLayer11.path = maskPath11.CGPath;
  553. // _btnThisYear.layer.mask = maskLayer11;
  554. //
  555. // CAShapeLayer *maskLayer13 = [CAShapeLayer layer];
  556. // maskLayer13.frame = _btnThisYear.bounds;
  557. // maskLayer13.path = maskPath11.CGPath;
  558. // maskLayer13.fillColor=[UIColor clearColor].CGColor;
  559. // maskLayer13.strokeColor=[UIColor lightGrayColor].CGColor;
  560. // maskLayer13.lineWidth=1;
  561. // [_btnThisYear.layer addSublayer:maskLayer13];
  562. //
  563. // [content addSubview:_btnThisYear];
  564. //
  565. //
  566. // UIView *debtRatioView = [[UIView alloc]init];
  567. //
  568. // debtRatioView.frame = CGRectMake(0,CGRectGetMaxY(_btnAssetsCustom.frame)+5, Screen_Width, 40);
  569. // UILabel *lblTitleDebtRatio = [[UILabel alloc]init];
  570. // lblTitleDebtRatio.frame = CGRectMake(Screen_Width/2-70, 10, 70, 25);
  571. // lblTitleDebtRatio.text = @"负债率:";
  572. // lblTitleDebtRatio.textColor = [UIColor redColor];
  573. // lblTitleDebtRatio.font = [UIFont systemFontOfSize:16];
  574. // [debtRatioView addSubview:lblTitleDebtRatio];
  575. //
  576. // UILabel *lblDebtRatio = [[UILabel alloc]init];
  577. // lblDebtRatio.frame = CGRectMake(CGRectGetMaxX(lblTitleDebtRatio.frame), 10, 70, 25);
  578. // lblDebtRatio.text = @"42.45%";
  579. // lblDebtRatio.textColor = [UIColor redColor];
  580. // lblDebtRatio.font = [UIFont systemFontOfSize:16];
  581. // [debtRatioView addSubview:lblDebtRatio];
  582. // [content addSubview:debtRatioView];
  583. //
  584. //
  585. // UIView *assetsTotalView = [[UIView alloc]init];
  586. //
  587. // assetsTotalView.frame = CGRectMake(0,CGRectGetMaxY(debtRatioView.frame)+5, 100, 60);
  588. // UILabel *lblAssetsTotal = [[UILabel alloc]init];
  589. // lblAssetsTotal.frame = CGRectMake(Screen_Width/4-35, 10, 200, 25);
  590. // lblAssetsTotal.text = @"7683374.82";
  591. // lblAssetsTotal.textColor = [UIColor blackColor];
  592. // lblAssetsTotal.font = [UIFont systemFontOfSize:16];
  593. // [assetsTotalView addSubview:lblAssetsTotal];
  594. //
  595. // UILabel *lblTitleAssetsTotal = [[UILabel alloc]init];
  596. // lblTitleAssetsTotal.frame = CGRectMake(Screen_Width/4-35,CGRectGetMaxY(lblAssetsTotal.frame), 100, 25);
  597. // lblTitleAssetsTotal.text = @"资产总计";
  598. // lblTitleAssetsTotal.textColor = [UIColor blackColor];
  599. // lblTitleAssetsTotal.font = [UIFont systemFontOfSize:16];
  600. // [assetsTotalView addSubview:lblTitleAssetsTotal];
  601. // [content addSubview:assetsTotalView];
  602. //
  603. //
  604. // UIView *middleSeparator1=[UIView new];
  605. //
  606. // middleSeparator1.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(debtRatioView.frame)+15, 3, 60);
  607. // middleSeparator1.backgroundColor=[UIColor lightGrayColor];
  608. // [content addSubview:middleSeparator1];
  609. //
  610. //
  611. // debtSumView = [[UIView alloc]init];
  612. //
  613. // debtSumView.frame = CGRectMake(Screen_Width/4*3,CGRectGetMaxY(debtRatioView.frame)+5, 200, 60);
  614. // UILabel *lblDebtSum = [[UILabel alloc]init];
  615. // lblDebtSum.frame = CGRectMake(0, 10, 150, 25);
  616. // lblDebtSum.text = @"3261302.77";
  617. // lblDebtSum.textColor = [UIColor blackColor];
  618. // lblDebtSum.font = [UIFont systemFontOfSize:16];
  619. // [debtSumView addSubview:lblDebtSum];
  620. //
  621. // UILabel *lblDebtSumTitle = [[UILabel alloc]init];
  622. // lblDebtSumTitle.frame = CGRectMake(0,CGRectGetMaxY(lblDebtSum.frame), 200, 25);
  623. // lblDebtSumTitle.text = @"负债总额";
  624. // lblDebtSumTitle.textColor = [UIColor blackColor];
  625. // lblDebtSumTitle.font = [UIFont systemFontOfSize:16];
  626. // [debtSumView addSubview:lblDebtSumTitle];
  627. // [content addSubview:debtSumView];
  628. // height=CGRectGetMaxY(assetsTotalView.frame)+10;
  629. // AssetDebtAxisValueFormatter *debtAxisValueFormatter=[[AssetDebtAxisValueFormatter alloc]init];
  630. // [self drawSingleBarchart:assetDebtyValues height:height axisValueFormatter:debtAxisValueFormatter xAxisLabelCount:2];
  631. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  632. currencyCapitalContent=[UIView new];
  633. currencyCapitalContent.backgroundColor=[UIColor whiteColor];
  634. currencyCapitalContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0);
  635. [content addSubview:currencyCapitalContent];
  636. UIView *monetoryCaiptalTitleView = [[UIView alloc]init];
  637. monetoryCaiptalTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45);
  638. UIView *monetoryCapitalView=[UIImageView new];
  639. monetoryCapitalView.frame=CGRectMake(10, 10,10 , 25);
  640. [monetoryCapitalView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  641. [monetoryCaiptalTitleView addSubview:monetoryCapitalView];
  642. UILabel *titleMonetoryCapital = [[UILabel alloc]init];
  643. titleMonetoryCapital.frame = CGRectMake(CGRectGetMaxX(monetoryCapitalView.frame)+10, 10, 90, 25);
  644. titleMonetoryCapital.text = @"货币资金";
  645. titleMonetoryCapital.textColor = [UIColor blackColor];
  646. titleMonetoryCapital.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  647. [monetoryCaiptalTitleView addSubview:titleMonetoryCapital];
  648. UIView *separator1=[UIView new];
  649. separator1.frame=CGRectMake(0,monetoryCaiptalTitleView.frame.size.height-1, monetoryCaiptalTitleView.frame.size.width-20, 0.5);
  650. [separator1 setBackgroundColor:[UIColor lightGrayColor]];
  651. [monetoryCaiptalTitleView addSubview:separator1 ];
  652. [currencyCapitalContent addSubview:monetoryCaiptalTitleView];
  653. _btnMonetoryCaitalCustom = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-90,CGRectGetMaxY(monetoryCaiptalTitleView.frame)+topMargin, 70, 35)];
  654. [_btnMonetoryCaitalCustom setTitle:@"自定义" forState:UIControlStateNormal];
  655. [_btnMonetoryCaitalCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  656. _btnMonetoryCaitalCustom.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  657. [_btnMonetoryCaitalCustom addTarget:self action:@selector(selectCustomDate) forControlEvents:UIControlEventTouchUpInside];
  658. UIBezierPath *maskPath13 = [UIBezierPath bezierPathWithRoundedRect:_btnMonetoryCaitalCustom.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  659. CAShapeLayer *maskLayer14 = [CAShapeLayer layer];
  660. maskLayer14.frame = _btnAssetsCustom.bounds;
  661. maskLayer14.path = maskPath13.CGPath;
  662. _btnMonetoryCaitalCustom.layer.mask = maskLayer14;
  663. moneytoryCapitalMaskLayer= [CAShapeLayer layer];
  664. moneytoryCapitalMaskLayer.frame = _btnMonetoryCaitalCustom.bounds;
  665. moneytoryCapitalMaskLayer.path = maskPath13.CGPath;
  666. moneytoryCapitalMaskLayer.fillColor=[UIColor clearColor].CGColor;
  667. moneytoryCapitalMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  668. moneytoryCapitalMaskLayer.lineWidth=1;
  669. [_btnMonetoryCaitalCustom.layer addSublayer:moneytoryCapitalMaskLayer];
  670. [currencyCapitalContent addSubview:_btnMonetoryCaitalCustom];
  671. _btnMonetoryCaitalCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnMonetoryCaitalCustom.frame),CGRectGetMaxY(monetoryCaiptalTitleView.frame)+topMargin, 70, 35)];
  672. _btnMonetoryCaitalCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  673. [_btnMonetoryCaitalCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal];
  674. [_btnMonetoryCaitalCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  675. [_btnMonetoryCaitalCurrentMonth addTarget:self action:@selector(getMoneytoryAssetsCurrentMonth) forControlEvents:UIControlEventTouchUpInside];
  676. UIBezierPath *maskPath14 = [UIBezierPath bezierPathWithRoundedRect:_btnMonetoryCaitalCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  677. CAShapeLayer *maskLayer15 = [CAShapeLayer layer];
  678. maskLayer15.frame = _btnMonetoryCaitalCurrentMonth.bounds;
  679. maskLayer15.path = maskPath14.CGPath;
  680. _btnMonetoryCaitalCurrentMonth.layer.mask = maskLayer15;
  681. moneytoryCapitalCurrentMonthMaskLayer= [CAShapeLayer layer];
  682. moneytoryCapitalCurrentMonthMaskLayer.frame = _btnMonetoryCaitalCurrentMonth.bounds;
  683. moneytoryCapitalCurrentMonthMaskLayer.path = maskPath14.CGPath;
  684. moneytoryCapitalCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor;
  685. moneytoryCapitalCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  686. moneytoryCapitalCurrentMonthMaskLayer.lineWidth=1;
  687. [_btnMonetoryCaitalCurrentMonth.layer addSublayer:moneytoryCapitalCurrentMonthMaskLayer];
  688. [currencyCapitalContent addSubview:_btnMonetoryCaitalCurrentMonth];
  689. UIView *monetoryCapitalAmountView = [[UIView alloc]init];
  690. monetoryCapitalAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnMonetoryCaitalCustom.frame)+topMargin, Screen_Width, 25);
  691. UILabel *lblTitleMonetoryCapitalAmount = [[UILabel alloc]init];
  692. lblTitleMonetoryCapitalAmount.frame = CGRectMake(Screen_Width/2-110, 0, 110, 25);
  693. lblTitleMonetoryCapitalAmount.text = @"货币资金:";
  694. lblTitleMonetoryCapitalAmount.textColor = [UIColor redColor];
  695. lblTitleMonetoryCapitalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  696. [monetoryCapitalAmountView addSubview:lblTitleMonetoryCapitalAmount];
  697. lblMonetoryCapitalAmount= [[UILabel alloc]init];
  698. lblMonetoryCapitalAmount.frame = CGRectMake(CGRectGetMaxX(lblTitleMonetoryCapitalAmount.frame), 0, 150, 25);
  699. lblMonetoryCapitalAmount.text=@"0.00";
  700. lblMonetoryCapitalAmount.textColor = [UIColor redColor];
  701. lblMonetoryCapitalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  702. [monetoryCapitalAmountView addSubview:lblMonetoryCapitalAmount];
  703. [currencyCapitalContent addSubview:monetoryCapitalAmountView];
  704. UIView *cashInHandView = [[UIView alloc]init];
  705. cashInHandView.frame = CGRectMake(0,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3, rowHeight);
  706. lblCashInHand= [[UILabel alloc]init];
  707. lblCashInHand.frame = CGRectMake(0, 0, cashInHandView.frame.size.width, 25);
  708. lblCashInHand.text = @"0.00";
  709. lblCashInHand.textAlignment=UITextAlignmentCenter;
  710. lblCashInHand.textColor = [UIColor blackColor];
  711. lblCashInHand.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  712. [cashInHandView addSubview:lblCashInHand];
  713. UILabel *lblTitleCashInHand = [[UILabel alloc]init];
  714. lblTitleCashInHand.frame = CGRectMake(0,CGRectGetMaxY(lblCashInHand.frame), cashInHandView.frame.size.width, 25);
  715. lblTitleCashInHand.text = @"库存现金";
  716. lblTitleCashInHand.textAlignment=UITextAlignmentCenter;
  717. lblTitleCashInHand.textColor = [UIColor blackColor];
  718. lblTitleCashInHand.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  719. [cashInHandView addSubview:lblTitleCashInHand];
  720. [currencyCapitalContent addSubview:cashInHandView];
  721. UIView *bankDepositView = [[UIView alloc]init];
  722. bankDepositView.frame = CGRectMake(Screen_Width/3,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3, rowHeight);
  723. lblBankDeposit = [[UILabel alloc]init];
  724. lblBankDeposit.frame = CGRectMake(0, 0, bankDepositView.frame.size.width, 25);
  725. lblBankDeposit.text = @"0.00";
  726. lblBankDeposit.textAlignment=UITextAlignmentCenter;
  727. lblBankDeposit.textColor = [UIColor blackColor];
  728. lblBankDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  729. [bankDepositView addSubview:lblBankDeposit];
  730. UILabel *lblTitleBankDeposit = [[UILabel alloc]init];
  731. lblTitleBankDeposit.frame = CGRectMake(0,CGRectGetMaxY(lblBankDeposit.frame), bankDepositView.frame.size.width, 25);
  732. lblTitleBankDeposit.text = @"银行存款";
  733. lblTitleBankDeposit.textColor = [UIColor blackColor];
  734. lblTitleBankDeposit.textAlignment=UITextAlignmentCenter;
  735. lblTitleBankDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  736. [bankDepositView addSubview:lblTitleBankDeposit];
  737. [currencyCapitalContent addSubview:bankDepositView];
  738. UIView *otherMonetoryCaiptalView = [[UIView alloc]init];
  739. otherMonetoryCaiptalView.frame = CGRectMake(Screen_Width/3*2-10,CGRectGetMaxY(monetoryCapitalAmountView.frame)+topMargin, Screen_Width/3+10, rowHeight);
  740. lblOtherMonetoryCaiptal = [[UILabel alloc]init];
  741. lblOtherMonetoryCaiptal.frame = CGRectMake(0, 0, otherMonetoryCaiptalView.frame.size.width, 25);
  742. lblOtherMonetoryCaiptal.textAlignment=UITextAlignmentCenter;
  743. lblOtherMonetoryCaiptal.textColor = [UIColor blackColor];
  744. lblOtherMonetoryCaiptal.text=@"0.00";
  745. lblOtherMonetoryCaiptal.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  746. [otherMonetoryCaiptalView addSubview:lblOtherMonetoryCaiptal];
  747. UILabel *lblTitleOtherMonetoryCaiptal = [[UILabel alloc]init];
  748. lblTitleOtherMonetoryCaiptal.frame = CGRectMake(0,CGRectGetMaxY(lblOtherMonetoryCaiptal.frame), otherMonetoryCaiptalView.frame.size.width, 25);
  749. lblTitleOtherMonetoryCaiptal.text = @"其他货币资金";
  750. lblTitleOtherMonetoryCaiptal.textColor = [UIColor blackColor];
  751. lblTitleOtherMonetoryCaiptal.textAlignment=UITextAlignmentCenter;
  752. lblTitleOtherMonetoryCaiptal.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  753. [otherMonetoryCaiptalView addSubview:lblTitleOtherMonetoryCaiptal];
  754. [currencyCapitalContent addSubview:otherMonetoryCaiptalView];
  755. netMoneyInflowView = [[UIView alloc]init];
  756. netMoneyInflowView.frame = CGRectMake(0,CGRectGetMaxY(cashInHandView.frame)+topMargin, Screen_Width, 25);
  757. UILabel *lblTitleNetMoneyInflow = [[UILabel alloc]init];
  758. lblTitleNetMoneyInflow.frame = CGRectMake(Screen_Width/2-130, 0, 130, 25);
  759. lblTitleNetMoneyInflow.text = @"货币净流入:";
  760. lblTitleNetMoneyInflow.textColor = [UIColor redColor];
  761. lblTitleNetMoneyInflow.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  762. [netMoneyInflowView addSubview:lblTitleNetMoneyInflow];
  763. lblNetMoneyInflow = [[UILabel alloc]init];
  764. lblNetMoneyInflow.frame = CGRectMake(CGRectGetMaxX(lblTitleNetMoneyInflow.frame), 0, 150, 25);
  765. lblNetMoneyInflow.textColor = [UIColor redColor];
  766. lblNetMoneyInflow.text=@"0.00";
  767. lblNetMoneyInflow.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  768. [netMoneyInflowView addSubview:lblNetMoneyInflow];
  769. [currencyCapitalContent addSubview:netMoneyInflowView];
  770. currencyCapitalBorderV=[CustomBorderView new];
  771. currencyCapitalBorderV.frame=CGRectMake(5, CGRectGetMaxY(netMoneyInflowView.frame)+topMargin,Screen_Width-30, 350);
  772. [currencyCapitalBorderV setBackgroundColor:[UIColor whiteColor]];
  773. [currencyCapitalBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  774. [currencyCapitalContent addSubview:currencyCapitalBorderV];
  775. _singleChartView=[[BarChartView alloc]init];
  776. _singleChartView.frame=CGRectMake(0,0,currencyCapitalBorderV.frame.size.width, 350);
  777. [currencyCapitalBorderV addSubview:_singleChartView];
  778. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  779. height=CGRectGetMaxY(currencyCapitalContent.frame);
  780. currencyCapitalContent.layer.cornerRadius=CornerRadius;
  781. }
  782. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  783. //往来情况
  784. currentSituationContent=[UIView new];
  785. currentSituationContent.backgroundColor=[UIColor whiteColor];
  786. currentSituationContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0);
  787. [content addSubview:currentSituationContent];
  788. UIView *currentSituationTitleView = [[UIView alloc]init];
  789. currentSituationTitleView.frame = CGRectMake(0,0 ,Screen_Width, 45);
  790. UIView *currentSituationView=[UIImageView new];
  791. currentSituationView.frame=CGRectMake(10, 10,10 , 25);
  792. [currentSituationView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  793. [currentSituationTitleView addSubview:currentSituationView];
  794. UILabel *titleCurrentSituation = [[UILabel alloc]init];
  795. titleCurrentSituation.frame = CGRectMake(CGRectGetMaxX(currentSituationView.frame)+10, 10, 90, 25);
  796. titleCurrentSituation.text = @"往来情况";
  797. titleCurrentSituation.textColor = [UIColor blackColor];
  798. titleCurrentSituation.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  799. [currentSituationTitleView addSubview:titleCurrentSituation];
  800. UIView *separator3=[UIView new];
  801. separator3.frame=CGRectMake(0,currentSituationTitleView.frame.size.height-1, currentSituationTitleView.frame.size.width-20, 0.5);
  802. [separator3 setBackgroundColor:[UIColor lightGrayColor]];
  803. [currentSituationTitleView addSubview:separator3 ];
  804. [currentSituationContent addSubview:currentSituationTitleView];
  805. _btnCurrentChannel = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(currentSituationTitleView.frame)+topMargin, 70, 35)];
  806. [_btnCurrentChannel setTitle:@"渠道" forState:UIControlStateNormal];
  807. [_btnCurrentChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  808. _btnCurrentChannel.tag=1002;
  809. _btnCurrentChannel.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  810. [_btnCurrentChannel addTarget:self action:@selector(goCurrentSituation:) forControlEvents:UIControlEventTouchUpInside];
  811. UIBezierPath *maskPath19 = [UIBezierPath bezierPathWithRoundedRect:_btnCurrentChannel.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  812. CAShapeLayer *maskLayer19 = [CAShapeLayer layer];
  813. maskLayer19.frame = _btnCurrentChannel.bounds;
  814. maskLayer19.path = maskPath19.CGPath;
  815. _btnCurrentChannel.layer.mask = maskLayer19;
  816. [currentSituationContent addSubview:_btnCurrentChannel];
  817. currentSituationChannelMaskLayer = [CAShapeLayer layer];
  818. currentSituationChannelMaskLayer.frame = _btnCurrentChannel.bounds;
  819. currentSituationChannelMaskLayer.path = maskPath19.CGPath;
  820. currentSituationChannelMaskLayer.fillColor=[UIColor clearColor].CGColor;
  821. currentSituationChannelMaskLayer.strokeColor=[UIColor redColor].CGColor;
  822. currentSituationChannelMaskLayer.lineWidth=1;
  823. [_btnCurrentChannel.layer addSublayer:currentSituationChannelMaskLayer];
  824. _btnCurrentDepartment = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnCurrentChannel.frame),CGRectGetMaxY(currentSituationTitleView.frame)+topMargin, 70, 35)];
  825. [_btnCurrentDepartment setTitle:@"部门" forState:UIControlStateNormal];
  826. _btnCurrentDepartment.tag=1003;
  827. [_btnCurrentDepartment addTarget:self action:@selector(goCurrentSituation:) forControlEvents:UIControlEventTouchUpInside];
  828. [_btnCurrentDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  829. _btnCurrentDepartment.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  830. UIBezierPath *maskPath20 = [UIBezierPath bezierPathWithRoundedRect:_btnCurrentDepartment.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  831. CAShapeLayer *maskLayer21 = [CAShapeLayer layer];
  832. maskLayer21.frame = _btnCurrentDepartment.bounds;
  833. maskLayer21.path = maskPath20.CGPath;
  834. _btnCurrentDepartment.layer.mask = maskLayer21;
  835. [currentSituationContent addSubview:_btnCurrentDepartment];
  836. currentSituationDepartmentMaskLayer = [CAShapeLayer layer];
  837. currentSituationDepartmentMaskLayer.frame = _btnCurrentDepartment.bounds;
  838. currentSituationDepartmentMaskLayer.path = maskPath20.CGPath;
  839. currentSituationDepartmentMaskLayer.fillColor=[UIColor clearColor].CGColor;
  840. currentSituationDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  841. currentSituationDepartmentMaskLayer.lineWidth=1;
  842. [_btnCurrentDepartment.layer addSublayer:currentSituationDepartmentMaskLayer];
  843. UIView *receivablesAmountView = [[UIView alloc]init];
  844. receivablesAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin, Screen_Width/2, rowHeight);
  845. lblReceivablesAmount= [[UILabel alloc]init];
  846. lblReceivablesAmount.frame = CGRectMake(0, 0, receivablesAmountView.frame.size.width, 25);
  847. lblReceivablesAmount.text = @"0.00";
  848. lblReceivablesAmount.textAlignment=UITextAlignmentCenter;
  849. lblReceivablesAmount.textColor = [UIColor blackColor];
  850. lblReceivablesAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  851. [receivablesAmountView addSubview:lblReceivablesAmount];
  852. UILabel *lblTitleReceivablesAmount = [[UILabel alloc]init];
  853. lblTitleReceivablesAmount.frame = CGRectMake(0,CGRectGetMaxY(lblReceivablesAmount.frame), receivablesAmountView.frame.size.width, 25);
  854. lblTitleReceivablesAmount.text = @"应收款金额";
  855. lblTitleReceivablesAmount.textColor = [UIColor blackColor];
  856. lblTitleReceivablesAmount.textAlignment=UITextAlignmentCenter;
  857. lblTitleReceivablesAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  858. [receivablesAmountView addSubview:lblTitleReceivablesAmount];
  859. [currentSituationContent addSubview:receivablesAmountView];
  860. UIView *depositAmountView = [[UIView alloc]init];
  861. depositAmountView.frame = CGRectMake(0,CGRectGetMaxY(receivablesAmountView.frame)+10, Screen_Width/2, rowHeight);
  862. lblDepositAmount = [[UILabel alloc]init];
  863. lblDepositAmount.frame = CGRectMake(0, 0, depositAmountView.frame.size.width, 25);
  864. lblDepositAmount.text = @"0.00";
  865. lblDepositAmount.textAlignment=UITextAlignmentCenter;
  866. lblDepositAmount.textColor = [UIColor blackColor];
  867. lblDepositAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  868. [depositAmountView addSubview:lblDepositAmount];
  869. UILabel *lblTitleDepositAmount = [[UILabel alloc]init];
  870. lblTitleDepositAmount.frame = CGRectMake(0,CGRectGetMaxY(lblDepositAmount.frame), depositAmountView.frame.size.width, 25);
  871. lblTitleDepositAmount.text = @"定金金额";
  872. lblTitleDepositAmount.textAlignment=UITextAlignmentCenter;
  873. lblTitleDepositAmount.textColor = [UIColor blackColor];
  874. lblTitleDepositAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  875. [depositAmountView addSubview:lblTitleDepositAmount];
  876. [currentSituationContent addSubview:depositAmountView];
  877. UIView *middleSeparator2=[UIView new];
  878. middleSeparator2.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin,0.5, 110);
  879. middleSeparator2.backgroundColor=[UIColor lightGrayColor];
  880. [currentSituationContent addSubview:middleSeparator2];
  881. advancePayment= [[UIView alloc]init];
  882. advancePayment.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(_btnCurrentChannel.frame)+topMargin, Screen_Width/2, rowHeight);
  883. lblAdvancePayment= [[UILabel alloc]init];
  884. lblAdvancePayment.frame = CGRectMake(0, 0, advancePayment.frame.size.width, 25);
  885. lblAdvancePayment.textAlignment=UITextAlignmentCenter;
  886. lblAdvancePayment.text=@"0.00";
  887. lblAdvancePayment.textColor = [UIColor blackColor];
  888. lblAdvancePayment.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  889. [advancePayment addSubview:lblAdvancePayment];
  890. UILabel *lblAdvancePaymentTitle = [[UILabel alloc]init];
  891. lblAdvancePaymentTitle.frame = CGRectMake(0,CGRectGetMaxY(lblAdvancePayment.frame), advancePayment.frame.size.width, 25);
  892. lblAdvancePaymentTitle.text = @"预收款金额";
  893. lblAdvancePaymentTitle.textAlignment=UITextAlignmentCenter;
  894. lblAdvancePaymentTitle.textColor = [UIColor blackColor];
  895. lblAdvancePaymentTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  896. [advancePayment addSubview:lblAdvancePaymentTitle];
  897. [currentSituationContent addSubview:advancePayment];
  898. UIView *receivablesAdvanceDepositView = [[UIView alloc]init];
  899. receivablesAdvanceDepositView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(advancePayment.frame)+10, Screen_Width/2, rowHeight);
  900. lblReceivablesAdvanceDeposit = [[UILabel alloc]init];
  901. lblReceivablesAdvanceDeposit.frame = CGRectMake(0, 0, receivablesAdvanceDepositView.frame.size.width, 25);
  902. lblReceivablesAdvanceDeposit.textAlignment=UITextAlignmentCenter;
  903. lblReceivablesAdvanceDeposit.text=@"0.00";
  904. lblReceivablesAdvanceDeposit.textColor = [UIColor blackColor];
  905. lblReceivablesAdvanceDeposit.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  906. [receivablesAdvanceDepositView addSubview:lblReceivablesAdvanceDeposit];
  907. UILabel *lblReceivablesAdvanceDepositTitle = [[UILabel alloc]init];
  908. lblReceivablesAdvanceDepositTitle.frame = CGRectMake(0,CGRectGetMaxY(lblReceivablesAdvanceDeposit.frame),receivablesAdvanceDepositView.frame.size.width, 25);
  909. lblReceivablesAdvanceDepositTitle.text = @"应收-预收-定金";
  910. lblReceivablesAdvanceDepositTitle.textColor = [UIColor blackColor];
  911. lblReceivablesAdvanceDepositTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  912. lblReceivablesAdvanceDepositTitle.textAlignment=UITextAlignmentCenter;
  913. [receivablesAdvanceDepositView addSubview:lblReceivablesAdvanceDepositTitle];
  914. [currentSituationContent addSubview:receivablesAdvanceDepositView];
  915. currentSituationBorderV=[CustomBorderView new];
  916. currentSituationBorderV.frame=CGRectMake(5, CGRectGetMaxY(depositAmountView.frame)+topMargin,Screen_Width-30, 350);
  917. [currentSituationBorderV setBackgroundColor:[UIColor whiteColor]];
  918. [currentSituationBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  919. [currentSituationContent addSubview:currentSituationBorderV];
  920. _currentSituationChartView=[[BarChartView alloc]init];
  921. _currentSituationChartView.frame=CGRectMake(0, 0,currentSituationBorderV.frame.size.width, 350);
  922. [currentSituationBorderV addSubview:_currentSituationChartView];
  923. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  924. height=CGRectGetMaxY(currentSituationContent.frame);
  925. currentSituationContent.layer.cornerRadius=CornerRadius;
  926. }
  927. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  928. //应付
  929. payableContent=[UIView new];
  930. payableContent.backgroundColor=[UIColor whiteColor];
  931. payableContent.frame=CGRectMake(10,height+10, Screen_Width-20, 0);
  932. [content addSubview:payableContent];
  933. UIView *accountPayableTitleView = [[UIView alloc]init];
  934. accountPayableTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45);
  935. UIView *accountPayableView=[UIImageView new];
  936. accountPayableView.frame=CGRectMake(10, 10,10 , 25);
  937. [accountPayableView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  938. [accountPayableTitleView addSubview:accountPayableView];
  939. UILabel *titleAccountPayable = [[UILabel alloc]init];
  940. titleAccountPayable.frame = CGRectMake(CGRectGetMaxX(accountPayableView.frame)+10, 10, 90, 25);
  941. titleAccountPayable.text = @"应付情况";
  942. titleAccountPayable.textColor = [UIColor blackColor];
  943. titleAccountPayable.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  944. [accountPayableTitleView addSubview:titleAccountPayable];
  945. UIView *separator4=[UIView new];
  946. separator4.frame=CGRectMake(0,accountPayableTitleView.frame.size.height-1, accountPayableTitleView.frame.size.width-20, 0.5);
  947. [separator4 setBackgroundColor:[UIColor lightGrayColor]];
  948. [accountPayableTitleView addSubview:separator4 ];
  949. [payableContent addSubview:accountPayableTitleView];
  950. UIView *accountsPayableView = [[UIView alloc]init];
  951. accountsPayableView.frame = CGRectMake(0,CGRectGetMaxY(accountPayableTitleView.frame)+topMargin,Screen_Width/2, rowHeight);
  952. [payableContent addSubview:accountsPayableView];
  953. lblAccountsPayable = [[UILabel alloc]init];
  954. lblAccountsPayable.frame = CGRectMake(0, 0,accountsPayableView.frame.size.width, 25);
  955. lblAccountsPayable.textAlignment=NSTextAlignmentCenter;
  956. lblAccountsPayable.text=@"0.00";
  957. lblAccountsPayable.textColor = [UIColor blackColor];
  958. lblAccountsPayable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  959. [accountsPayableView addSubview:lblAccountsPayable];
  960. UILabel *lblTitleAccountsPayable = [[UILabel alloc]init];
  961. lblTitleAccountsPayable.frame = CGRectMake(0,CGRectGetMaxY(lblAccountsPayable.frame),Screen_Width/2, 25);
  962. lblTitleAccountsPayable.text = @"应付款金额";
  963. lblTitleAccountsPayable.textAlignment=NSTextAlignmentCenter;
  964. lblTitleAccountsPayable.textColor = [UIColor blackColor];
  965. lblTitleAccountsPayable.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  966. [accountsPayableView addSubview:lblTitleAccountsPayable];
  967. UIView *middleSeparator5=[UIView new];
  968. middleSeparator5.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(accountPayableTitleView.frame)+topMargin, 0.5, 50);
  969. middleSeparator5.backgroundColor=[UIColor lightGrayColor];
  970. [payableContent addSubview:middleSeparator5];
  971. UIView *advancePaymentView = [[UIView alloc]init];
  972. advancePaymentView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(accountPayableTitleView.frame)+topMargin, Screen_Width/2,rowHeight);
  973. lblAdvancePaymentAmount = [[UILabel alloc]init];
  974. lblAdvancePaymentAmount.frame = CGRectMake(0, 0, advancePaymentView.frame.size.width, 25);
  975. lblAdvancePaymentAmount.textAlignment=NSTextAlignmentCenter;
  976. lblAdvancePaymentAmount.text=@"0.00";
  977. lblAdvancePaymentAmount.textColor = [UIColor blackColor];
  978. lblAdvancePaymentAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  979. [advancePaymentView addSubview:lblAdvancePaymentAmount];
  980. UILabel *lblAdvancePaymentAmountTitle = [[UILabel alloc]init];
  981. lblAdvancePaymentAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(lblAdvancePaymentAmount.frame),advancePaymentView.frame.size.width, 25);
  982. lblAdvancePaymentAmountTitle.text = @"预付款金额";
  983. lblAdvancePaymentAmountTitle.textAlignment=NSTextAlignmentCenter;
  984. lblAdvancePaymentAmountTitle.textColor = [UIColor blackColor];
  985. lblAdvancePaymentAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  986. [advancePaymentView addSubview:lblAdvancePaymentAmountTitle];
  987. [payableContent addSubview:advancePaymentView];
  988. payableBorderV=[CustomBorderView new];
  989. payableBorderV.frame=CGRectMake(5, CGRectGetMaxY(accountsPayableView.frame)+topMargin,Screen_Width-30, 350);
  990. [payableBorderV setBackgroundColor:[UIColor whiteColor]];
  991. [payableBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  992. [payableContent addSubview:payableBorderV];
  993. _payableChartView=[[BarChartView alloc]init];
  994. _payableChartView.frame=CGRectMake(0,0,payableBorderV.frame.size.width, 350);
  995. [payableBorderV addSubview:_payableChartView];
  996. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+10);
  997. height=CGRectGetMaxY(payableContent.frame);
  998. payableContent.layer.cornerRadius=CornerRadius;
  999. }
  1000. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  1001. //库存状况
  1002. inventoryStatusContent=[UIView new];
  1003. inventoryStatusContent.frame=CGRectMake(10,CGRectGetMaxY(payableContent.frame)+10,Screen_Width,0);
  1004. inventoryStatusContent.backgroundColor=[UIColor whiteColor];
  1005. [content addSubview:inventoryStatusContent];
  1006. UIView *inventoryStatusTitleView = [[UIView alloc]init];
  1007. inventoryStatusTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45);
  1008. UIView * inventoryStatusView=[UIImageView new];
  1009. inventoryStatusView.frame=CGRectMake(10, 10,10 , 25);
  1010. [inventoryStatusView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  1011. UIView *separator5=[UIView new];
  1012. separator5.frame=CGRectMake(0,inventoryStatusTitleView.frame.size.height-1, inventoryStatusTitleView.frame.size.width-20, 0.5);
  1013. [separator5 setBackgroundColor:[UIColor lightGrayColor]];
  1014. [inventoryStatusTitleView addSubview:separator5];
  1015. [inventoryStatusTitleView addSubview:inventoryStatusView];
  1016. UILabel *titleInventoryStatus = [[UILabel alloc]init];
  1017. titleInventoryStatus.frame = CGRectMake(CGRectGetMaxX(inventoryStatusView.frame)+10, 10, 90, 25);
  1018. titleInventoryStatus.text = @"库存情况";
  1019. titleInventoryStatus.textColor = [UIColor blackColor];
  1020. titleInventoryStatus.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  1021. [inventoryStatusTitleView addSubview:titleInventoryStatus];
  1022. [inventoryStatusContent addSubview:inventoryStatusTitleView];
  1023. UIView *inventoryAmountView = [[UIView alloc]init];
  1024. inventoryAmountView.frame = CGRectMake(0,CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin, Screen_Width/2, rowHeight);
  1025. lblInventoryAmount = [[UILabel alloc]init];
  1026. lblInventoryAmount.frame = CGRectMake(0, 0, inventoryAmountView.frame.size.width, 25);
  1027. lblInventoryAmount.textColor = [UIColor redColor];
  1028. lblInventoryAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1029. lblInventoryAmount.textAlignment=NSTextAlignmentCenter;
  1030. lblInventoryAmount.text=@"0.00";
  1031. [inventoryAmountView addSubview:lblInventoryAmount];
  1032. lblTitleInventoryAmount = [[UILabel alloc]init];
  1033. lblTitleInventoryAmount.frame = CGRectMake(0,CGRectGetMaxY(lblInventoryAmount.frame),inventoryAmountView.frame.size.width, 25);
  1034. lblTitleInventoryAmount.text = @"库存金额";
  1035. lblTitleInventoryAmount.textColor = [UIColor redColor];
  1036. lblTitleInventoryAmount.textAlignment=NSTextAlignmentCenter;
  1037. lblTitleInventoryAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1038. [inventoryAmountView addSubview:lblTitleInventoryAmount];
  1039. UITapGestureRecognizer *inventoryAmountTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchInventoryAmount:)];
  1040. inventoryAmountView.userInteractionEnabled = YES;
  1041. [inventoryAmountView addGestureRecognizer:inventoryAmountTap];
  1042. [inventoryStatusContent addSubview:inventoryAmountView];
  1043. UIView *middleSeparator6=[UIView new];
  1044. middleSeparator6.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin,0.5, 45);
  1045. middleSeparator6.backgroundColor=[UIColor lightGrayColor];
  1046. [inventoryStatusContent addSubview:middleSeparator6];
  1047. UIView *inventoryQuantityView = [[UIView alloc]init];
  1048. inventoryQuantityView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(inventoryStatusTitleView.frame)+topMargin,Screen_Width/2,rowHeight);
  1049. lblInventoryQuantity = [[UILabel alloc]init];
  1050. lblInventoryQuantity.frame = CGRectMake(0, 0,inventoryQuantityView.frame.size.width, 25);
  1051. lblInventoryQuantity.text=@"0.00";
  1052. lblInventoryQuantity.textColor = [UIColor blackColor];
  1053. lblInventoryQuantity.textAlignment=NSTextAlignmentCenter;
  1054. lblInventoryQuantity.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1055. [inventoryQuantityView addSubview:lblInventoryQuantity];
  1056. lblInventoryQuantityTitle= [[UILabel alloc]init];
  1057. lblInventoryQuantityTitle.frame = CGRectMake(0,CGRectGetMaxY(lblInventoryQuantity.frame), inventoryQuantityView.frame.size.width, 25);
  1058. lblInventoryQuantityTitle.text = @"库存量";
  1059. lblInventoryQuantityTitle.textAlignment=NSTextAlignmentCenter;
  1060. lblInventoryQuantityTitle.textColor = [UIColor blackColor];
  1061. lblInventoryQuantityTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1062. [inventoryQuantityView addSubview:lblInventoryQuantityTitle];
  1063. [inventoryStatusContent addSubview:inventoryQuantityView];
  1064. // UITapGestureRecognizer *inventoryQuantityTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchInventoryQuantity:)];
  1065. //
  1066. // inventoryQuantityView.userInteractionEnabled = YES;
  1067. //
  1068. // [inventoryQuantityView addGestureRecognizer:inventoryQuantityTap];
  1069. [inventoryStatusContent addSubview:inventoryAmountView];
  1070. inventoryStatusBorderV=[CustomBorderView new];
  1071. inventoryStatusBorderV.frame=CGRectMake(5, CGRectGetMaxY(inventoryAmountView.frame)+topMargin,Screen_Width-30, 300);
  1072. [inventoryStatusBorderV setBackgroundColor:[UIColor whiteColor]];
  1073. [inventoryStatusBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  1074. [inventoryStatusContent addSubview:inventoryStatusBorderV];
  1075. _pieView=[[PieChartView alloc]init];
  1076. _pieView.frame=CGRectMake(0,0, inventoryStatusBorderV.frame.size.width, 300);
  1077. [inventoryStatusBorderV addSubview:_pieView];
  1078. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  1079. inventoryStatusContent.layer.cornerRadius=CornerRadius;
  1080. height=CGRectGetMaxY(inventoryStatusContent.frame);
  1081. }
  1082. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  1083. //采购状况
  1084. procurementSituationContent=[UIView new];
  1085. procurementSituationContent.frame=CGRectMake(10,height+10,Screen_Width,0);
  1086. procurementSituationContent.backgroundColor=[UIColor whiteColor];
  1087. [content addSubview:procurementSituationContent];
  1088. UIView *procurementSituationTitleView = [[UIView alloc]init];
  1089. procurementSituationTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45);
  1090. UIView * procurementSituationImgView=[UIImageView new];
  1091. procurementSituationImgView.frame=CGRectMake(10, 10,10 , 25);
  1092. [procurementSituationImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  1093. UIView *separator6=[UIView new];
  1094. separator6.frame=CGRectMake(0,procurementSituationTitleView.frame.size.height-1, procurementSituationTitleView.frame.size.width-20, 0.5);
  1095. [separator6 setBackgroundColor:[UIColor lightGrayColor]];
  1096. [procurementSituationTitleView addSubview:separator6];
  1097. [procurementSituationTitleView addSubview:procurementSituationImgView];
  1098. UILabel *titleProcurementSituation = [[UILabel alloc]init];
  1099. titleProcurementSituation.frame = CGRectMake(CGRectGetMaxX(procurementSituationImgView.frame)+10, 10, 90, 25);
  1100. titleProcurementSituation.text = @"采购情况";
  1101. titleProcurementSituation.textColor = [UIColor blackColor];
  1102. titleProcurementSituation.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  1103. [procurementSituationTitleView addSubview:titleProcurementSituation];
  1104. [procurementSituationContent addSubview:procurementSituationTitleView];
  1105. _btnProcurementCustomMonth = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(procurementSituationTitleView.frame)+topMargin, 70, 35)];
  1106. [_btnProcurementCustomMonth setTitle:@"自定义" forState:UIControlStateNormal];
  1107. [_btnProcurementCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  1108. _btnProcurementCustomMonth.tag=1004;
  1109. _btnProcurementCustomMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  1110. [_btnProcurementCustomMonth addTarget:self action:@selector(goProcurementCustomMonth:) forControlEvents:UIControlEventTouchUpInside];
  1111. UIBezierPath *maskPath21= [UIBezierPath bezierPathWithRoundedRect:_btnProcurementCustomMonth.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  1112. CAShapeLayer *maskLayer22 = [CAShapeLayer layer];
  1113. maskLayer22.frame = _btnProcurementCustomMonth.bounds;
  1114. maskLayer22.path = maskPath21.CGPath;
  1115. _btnProcurementCustomMonth.layer.mask = maskLayer22;
  1116. [procurementSituationContent addSubview:_btnProcurementCustomMonth];
  1117. procurementCustomMonthMaskLayer = [CAShapeLayer layer];
  1118. procurementCustomMonthMaskLayer.frame = _btnProcurementCustomMonth.bounds;
  1119. procurementCustomMonthMaskLayer.path = maskPath21.CGPath;
  1120. procurementCustomMonthMaskLayer.fillColor=[UIColor clearColor].CGColor;
  1121. procurementCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  1122. procurementCustomMonthMaskLayer.lineWidth=1;
  1123. [_btnProcurementCustomMonth.layer addSublayer:procurementCustomMonthMaskLayer];
  1124. _btnProcurementCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnProcurementCustomMonth.frame),CGRectGetMaxY(procurementSituationTitleView.frame)+topMargin, 70, 35)];
  1125. [_btnProcurementCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal];
  1126. _btnProcurementCurrentMonth.tag=1005;
  1127. [_btnProcurementCurrentMonth addTarget:self action:@selector(goProcurementCurrentMonth:) forControlEvents:UIControlEventTouchUpInside];
  1128. [_btnProcurementCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  1129. _btnProcurementCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  1130. UIBezierPath *maskPath22 = [UIBezierPath bezierPathWithRoundedRect:_btnProcurementCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  1131. CAShapeLayer *maskLayer23 = [CAShapeLayer layer];
  1132. maskLayer23.frame = _btnProcurementCurrentMonth.bounds;
  1133. maskLayer23.path = maskPath22.CGPath;
  1134. _btnProcurementCurrentMonth.layer.mask = maskLayer23;
  1135. [procurementSituationContent addSubview:_btnProcurementCurrentMonth];
  1136. procurementCurrentMonthMaskLayer = [CAShapeLayer layer];
  1137. procurementCurrentMonthMaskLayer.frame = _btnProcurementCurrentMonth.bounds;
  1138. procurementCurrentMonthMaskLayer.path = maskPath22.CGPath;
  1139. procurementCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor;
  1140. procurementCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  1141. procurementCurrentMonthMaskLayer.lineWidth=1;
  1142. [_btnProcurementCurrentMonth.layer addSublayer:procurementCurrentMonthMaskLayer];
  1143. procurementStatusPieBorderV=[CustomBorderView new];
  1144. procurementStatusPieBorderV.frame=CGRectMake(5, CGRectGetMaxY(_btnProcurementCurrentMonth.frame)+topMargin,Screen_Width-30, 200);
  1145. [procurementStatusPieBorderV setBackgroundColor:[UIColor whiteColor]];
  1146. [procurementStatusPieBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  1147. [procurementSituationContent addSubview:procurementStatusPieBorderV];
  1148. procurementStatusV = [[MyView alloc]initWithFrame:CGRectMake(5,5, procurementStatusPieBorderV.frame.size.width-10,190)];
  1149. [procurementStatusPieBorderV addSubview:procurementStatusV];
  1150. UIView *percentView = [[UIView alloc]init];
  1151. percentView.frame = CGRectMake(5,CGRectGetMaxY(procurementStatusPieBorderV.frame)-30, Screen_Width-30, 25);
  1152. lblProcuremmentPercent= [[UILabel alloc]init];
  1153. lblProcuremmentPercent.frame = CGRectMake(0, 0, percentView.frame.size.width, 25);
  1154. lblProcuremmentPercent.textColor = [UIColor blackColor];
  1155. lblProcuremmentPercent.font = [UIFont systemFontOfSize:22];
  1156. lblProcuremmentPercent.text=@"完成率0.00%";
  1157. lblProcuremmentPercent.textAlignment=NSTextAlignmentCenter;
  1158. [percentView addSubview:lblProcuremmentPercent];
  1159. [procurementSituationContent addSubview:percentView];
  1160. UIView *planAmountView = [[UIView alloc]init];
  1161. planAmountView.frame = CGRectMake(0,CGRectGetMaxY(percentView.frame)+topMargin, Screen_Width/2, rowHeight);
  1162. lblPlanAmount = [[UILabel alloc]init];
  1163. lblPlanAmount.frame = CGRectMake(0, 0, planAmountView.frame.size.width, 25);
  1164. lblPlanAmount.textColor = [UIColor blackColor];
  1165. lblPlanAmount.text=@"0.00";
  1166. lblPlanAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1167. lblPlanAmount.textAlignment=NSTextAlignmentCenter;
  1168. [planAmountView addSubview:lblPlanAmount];
  1169. UILabel *lblTitlePlanAmount = [[UILabel alloc]init];
  1170. lblTitlePlanAmount.frame = CGRectMake(0,CGRectGetMaxY(lblPlanAmount.frame),planAmountView.frame.size.width, 25);
  1171. lblTitlePlanAmount.text = @"任务额";
  1172. lblTitlePlanAmount.textColor = [UIColor blackColor];
  1173. lblTitlePlanAmount.textAlignment=NSTextAlignmentCenter;
  1174. lblTitlePlanAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1175. [planAmountView addSubview:lblTitlePlanAmount];
  1176. [procurementSituationContent addSubview:planAmountView];
  1177. UIView *middleSeparator7=[UIView new];
  1178. middleSeparator7.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(percentView.frame)+topMargin,0.5, 45);
  1179. middleSeparator7.backgroundColor=[UIColor lightGrayColor];
  1180. [procurementSituationContent addSubview:middleSeparator7];
  1181. UIView *procurementAmountView = [[UIView alloc]init];
  1182. procurementAmountView.frame = CGRectMake(Screen_Width/2,CGRectGetMaxY(percentView.frame)+topMargin,Screen_Width/2,rowHeight);
  1183. lblProcurementAmount = [[UILabel alloc]init];
  1184. lblProcurementAmount.frame = CGRectMake(0, 0,procurementAmountView.frame.size.width, 25);
  1185. lblProcurementAmount.text=@"0.00";
  1186. lblProcurementAmount.textColor = [UIColor blackColor];
  1187. lblProcurementAmount.textAlignment=NSTextAlignmentCenter;
  1188. lblProcurementAmount.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1189. [procurementAmountView addSubview:lblProcurementAmount];
  1190. UILabel *lblProcurementAmountTitle= [[UILabel alloc]init];
  1191. lblProcurementAmountTitle.frame = CGRectMake(0,CGRectGetMaxY(lblProcurementAmount.frame), procurementAmountView.frame.size.width, 25);
  1192. lblProcurementAmountTitle.text = @"实际采购额";
  1193. lblProcurementAmountTitle.textAlignment=NSTextAlignmentCenter;
  1194. lblProcurementAmountTitle.textColor = [UIColor blackColor];
  1195. lblProcurementAmountTitle.font = [UIFont systemFontOfSize:BoldSystemFontOfSize18];
  1196. [procurementAmountView addSubview:lblProcurementAmountTitle];
  1197. [procurementSituationContent addSubview:procurementAmountView];
  1198. procurementStatusChartBorderV=[CustomBorderView new];
  1199. procurementStatusChartBorderV.frame=CGRectMake(5, CGRectGetMaxY(planAmountView.frame)+topMargin,Screen_Width-30, 350);
  1200. [procurementStatusChartBorderV setBackgroundColor:[UIColor whiteColor]];
  1201. [procurementStatusChartBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  1202. [procurementSituationContent addSubview:procurementStatusChartBorderV];
  1203. _procurementStatusChartView=[[BarChartView alloc]init];
  1204. _procurementStatusChartView.frame=CGRectMake(0, 0,procurementStatusChartBorderV.frame.size.width, 350);
  1205. [procurementStatusChartBorderV addSubview:_procurementStatusChartView];
  1206. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  1207. procurementSituationContent.layer.cornerRadius=CornerRadius;
  1208. height=CGRectGetMaxY(procurementSituationContent.frame);
  1209. }
  1210. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  1211. paymentFeesStatusContent=[UIView new];
  1212. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,0);
  1213. paymentFeesStatusContent.backgroundColor=[UIColor whiteColor];
  1214. [content addSubview:paymentFeesStatusContent];
  1215. UIView *paymentFeesTitleView = [[UIView alloc]init];
  1216. paymentFeesTitleView.frame = CGRectMake(0,10 ,Screen_Width, 45);
  1217. UIView *paymentFeesImgView=[UIImageView new];
  1218. paymentFeesImgView.frame=CGRectMake(10, 10,10 , 25);
  1219. [paymentFeesImgView setBackgroundColor:[UIColor hexColor:LIGHT_BROWN]];
  1220. UIView *separator7=[UIView new];
  1221. separator7.frame=CGRectMake(0,paymentFeesTitleView.frame.size.height-1, paymentFeesTitleView.frame.size.width-20, 0.5);
  1222. [separator7 setBackgroundColor:[UIColor lightGrayColor]];
  1223. [paymentFeesTitleView addSubview:separator7];
  1224. [paymentFeesTitleView addSubview:paymentFeesImgView];
  1225. UILabel *titlePaymentFees = [[UILabel alloc]init];
  1226. titlePaymentFees.frame = CGRectMake(CGRectGetMaxX(paymentFeesImgView.frame)+10, 10, 130, 25);
  1227. titlePaymentFees.text = @"支出费用情况";
  1228. titlePaymentFees.textColor = [UIColor blackColor];
  1229. titlePaymentFees.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  1230. [paymentFeesTitleView addSubview:titlePaymentFees];
  1231. [paymentFeesStatusContent addSubview:paymentFeesTitleView];
  1232. _btnPaymentFeesCustomMonth = [[UIButton alloc] initWithFrame:CGRectMake(Screen_Width/2-70,CGRectGetMaxY(paymentFeesTitleView.frame)+topMargin, 70, 35)];
  1233. [_btnPaymentFeesCustomMonth setTitle:@"自定义" forState:UIControlStateNormal];
  1234. [_btnPaymentFeesCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  1235. _btnPaymentFeesCustomMonth.tag=1005;
  1236. _btnPaymentFeesCustomMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  1237. [_btnPaymentFeesCustomMonth addTarget:self action:@selector(goPaymentFeesCustomMonth:) forControlEvents:UIControlEventTouchUpInside];
  1238. UIBezierPath *maskPath23= [UIBezierPath bezierPathWithRoundedRect:_btnPaymentFeesCustomMonth.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomLeft cornerRadii:CGSizeMake(25.0, 25.0)];
  1239. CAShapeLayer *maskLayer24= [CAShapeLayer layer];
  1240. maskLayer24.frame = _btnProcurementCustomMonth.bounds;
  1241. maskLayer24.path = maskPath23.CGPath;
  1242. _btnPaymentFeesCustomMonth.layer.mask = maskLayer24;
  1243. [paymentFeesStatusContent addSubview:_btnPaymentFeesCustomMonth];
  1244. paymentFeesCustomMonthMaskLayer = [CAShapeLayer layer];
  1245. paymentFeesCustomMonthMaskLayer.frame = _btnPaymentFeesCustomMonth.bounds;
  1246. paymentFeesCustomMonthMaskLayer.path = maskPath23.CGPath;
  1247. paymentFeesCustomMonthMaskLayer.fillColor=[UIColor clearColor].CGColor;
  1248. paymentFeesCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  1249. paymentFeesCustomMonthMaskLayer.lineWidth=1;
  1250. [_btnPaymentFeesCustomMonth.layer addSublayer:paymentFeesCustomMonthMaskLayer];
  1251. _btnPaymentFeesCurrentMonth = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_btnPaymentFeesCustomMonth.frame),CGRectGetMaxY(paymentFeesTitleView.frame)+topMargin, 70, 35)];
  1252. [_btnPaymentFeesCurrentMonth setTitle:[DateFormat getCurrentMonth] forState:UIControlStateNormal];
  1253. _btnPaymentFeesCurrentMonth.tag=1006;
  1254. [_btnPaymentFeesCurrentMonth addTarget:self action:@selector(goPaymentFeesCurrentMonth:) forControlEvents:UIControlEventTouchUpInside];
  1255. [_btnPaymentFeesCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  1256. _btnPaymentFeesCurrentMonth.titleLabel.font = [UIFont systemFontOfSize: 12.0];
  1257. UIBezierPath *maskPath27 = [UIBezierPath bezierPathWithRoundedRect:_btnPaymentFeesCurrentMonth.bounds byRoundingCorners:UIRectCornerTopRight|UIRectCornerBottomRight cornerRadii:CGSizeMake(25.0, 25.0)];
  1258. CAShapeLayer *maskLayer28 = [CAShapeLayer layer];
  1259. maskLayer28.frame = _btnPaymentFeesCurrentMonth.bounds;
  1260. maskLayer28.path = maskPath27.CGPath;
  1261. _btnPaymentFeesCurrentMonth.layer.mask = maskLayer28;
  1262. [paymentFeesStatusContent addSubview:_btnPaymentFeesCurrentMonth];
  1263. paymentFeesCurrentMonthMaskLayer = [CAShapeLayer layer];
  1264. paymentFeesCurrentMonthMaskLayer.frame = _btnPaymentFeesCurrentMonth.bounds;
  1265. paymentFeesCurrentMonthMaskLayer.path = maskPath27.CGPath;
  1266. paymentFeesCurrentMonthMaskLayer.fillColor=[UIColor clearColor].CGColor;
  1267. paymentFeesCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  1268. paymentFeesCurrentMonthMaskLayer.lineWidth=1;
  1269. [_btnPaymentFeesCurrentMonth.layer addSublayer:paymentFeesCurrentMonthMaskLayer];
  1270. UIView *feesAmountView= [[UIView alloc]init];
  1271. feesAmountView.frame = CGRectMake(0,CGRectGetMaxY(_btnPaymentFeesCustomMonth.frame)+topMargin, Screen_Width, 25);
  1272. UILabel *lblTitleFeesAmount= [[UILabel alloc]init];
  1273. lblTitleFeesAmount.frame = CGRectMake(Screen_Width/2-110, 0, 110, 25);
  1274. lblTitleFeesAmount.text = @"费用总额:";
  1275. lblTitleFeesAmount.textColor = [UIColor redColor];
  1276. lblTitleFeesAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  1277. [feesAmountView addSubview:lblTitleFeesAmount];
  1278. lblFeesTotalAmount = [[UILabel alloc]init];
  1279. lblFeesTotalAmount.frame = CGRectMake(CGRectGetMaxX(lblTitleFeesAmount.frame), 0, 150, 25);
  1280. lblFeesTotalAmount.textColor = [UIColor redColor];
  1281. lblFeesTotalAmount.text=@"0.00";
  1282. lblFeesTotalAmount.font = [UIFont systemFontOfSize:NoDataFontOfSize];
  1283. [feesAmountView addSubview:lblFeesTotalAmount];
  1284. [paymentFeesStatusContent addSubview:feesAmountView];
  1285. paymentBorderV=[CustomBorderView new];
  1286. paymentBorderV.frame=CGRectMake(5, CGRectGetMaxY(feesAmountView.frame)+topMargin,Screen_Width-30, 350);
  1287. [paymentBorderV setBackgroundColor:[UIColor whiteColor]];
  1288. [paymentBorderV drawBoardLine:borderLineWidth cornerRadius:2 color:[UIColor hexColor:@"D5CDCD"]];
  1289. [paymentFeesStatusContent addSubview:paymentBorderV];
  1290. _paymentFeesChartView=[[BarChartView alloc]init];
  1291. _paymentFeesChartView.frame=CGRectMake(0,0,paymentBorderV.frame.size.width, 350);
  1292. _paymentFeesChartView.tag=1001;
  1293. [paymentBorderV addSubview:_paymentFeesChartView];
  1294. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  1295. paymentFeesStatusContent.layer.cornerRadius=CornerRadius;
  1296. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  1297. }
  1298. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  1299. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  1300. }
  1301. -(void)touchInventoryAmount:(UITapGestureRecognizer *)gesture
  1302. {
  1303. [self changeInventoryStatusTextColor];
  1304. lblInventoryAmount.textColor = [UIColor redColor];
  1305. lblTitleInventoryAmount.textColor = [UIColor redColor];
  1306. [self drawPieView:inventoryAmountArray pieTitleArray:inventoryTitleArray pieView:_pieView];
  1307. }
  1308. -(void)touchInventoryQuantity:(UITapGestureRecognizer *)gesture
  1309. {
  1310. [self changeInventoryStatusTextColor];
  1311. lblInventoryQuantity.textColor = [UIColor redColor];
  1312. lblInventoryQuantityTitle.textColor = [UIColor redColor];
  1313. [self drawPieView:inventoryQuantityArray pieTitleArray:inventoryTitleArray pieView:_pieView];
  1314. }
  1315. -(void)changeInventoryStatusTextColor
  1316. {
  1317. lblInventoryAmount.textColor = [UIColor blackColor];
  1318. lblTitleInventoryAmount.textColor = [UIColor blackColor];;
  1319. lblInventoryQuantity.textColor = [UIColor blackColor];
  1320. lblInventoryQuantityTitle.textColor = [UIColor blackColor];
  1321. }
  1322. /**
  1323. 画饼图
  1324. */
  1325. -(void)drawPieView:(NSMutableArray*)pieArray pieTitleArray:(NSMutableArray*)pieTitleArry pieView:(PieChartView*)pieView
  1326. {
  1327. pieView.usePercentValuesEnabled = YES;
  1328. pieView.drawSlicesUnderHoleEnabled = NO;
  1329. pieView.dragDecelerationFrictionCoef = 0.5;
  1330. // chartView.holeRadiusPercent = 0.58;
  1331. pieView.transparentCircleRadiusPercent = 0;
  1332. pieView.drawEntryLabelsEnabled=NO;
  1333. // chartView.transparentCircleRadiusPercent = 0.61;
  1334. pieView.chartDescription.enabled = NO;
  1335. [pieView setExtraOffsetsWithLeft:5.f top:10.f right:5.f bottom:5.f];
  1336. NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
  1337. paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
  1338. paragraphStyle.alignment = NSTextAlignmentCenter;
  1339. pieView.drawHoleEnabled = NO;
  1340. pieView.rotationAngle = 0.0;
  1341. pieView.rotationEnabled = YES;
  1342. pieView.highlightPerTapEnabled = YES;
  1343. BalloonMarker *marker = [[BalloonMarker alloc]
  1344. initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0]
  1345. font: [UIFont systemFontOfSize:12.0]
  1346. textColor: UIColor.whiteColor
  1347. insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)];
  1348. marker.chartView = pieView;
  1349. marker.minimumSize = CGSizeMake(80.f, 40.f);
  1350. pieView.marker = marker;
  1351. ChartLegend *l = pieView.legend;
  1352. l.horizontalAlignment = ChartLegendHorizontalAlignmentCenter;
  1353. l.verticalAlignment = ChartLegendVerticalAlignmentBottom;
  1354. l.orientation = ChartLegendOrientationHorizontal;
  1355. l.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
  1356. l.drawInside = NO;
  1357. l.xEntrySpace =1;
  1358. l.yEntrySpace =3;
  1359. l.yOffset =5;
  1360. pieView.legend.enabled = YES;
  1361. pieView.delegate = self;
  1362. [pieView animateWithYAxisDuration:1.4 easingOption:ChartEasingOptionEaseOutBack];
  1363. NSMutableArray *entries = [[NSMutableArray alloc] init];
  1364. for (int i = 0; i < pieArray.count; i++)
  1365. {
  1366. [entries addObject:[[PieChartDataEntry alloc] initWithValue:[[pieArray objectAtIndex:i] doubleValue] label:[pieTitleArry objectAtIndex:i]]];
  1367. }
  1368. PieChartDataSet *dataSet = [[PieChartDataSet alloc] initWithEntries:entries label:@""];
  1369. dataSet.sliceSpace = 2.0;
  1370. // add a lot of colors
  1371. NSMutableArray *colors = [[NSMutableArray alloc] init];
  1372. [colors addObject:[UIColor colorWithRed:112/255.f green:168/255.f blue:76/255.f alpha:1.f]];
  1373. [colors addObject:[UIColor colorWithRed:40/255.f green:69/255.f blue:118/255.f alpha:1.f]];
  1374. [colors addObject:[UIColor colorWithRed:153/255.f green:70/255.f blue:24/255.f alpha:1.f]];
  1375. [colors addObject:[UIColor colorWithRed:70/255.f green:116/255.f blue:194/255.f alpha:1.f]];
  1376. [colors addObject:[UIColor colorWithRed:235/255.f green:125/255.f blue:60/255.f alpha:1.f]];
  1377. [colors addObject:[UIColor colorWithRed:163/255.f green:162/255.f blue:166/255.f alpha:1.f]];
  1378. [colors addObject:[UIColor colorWithRed:232/255.f green:175/255.f blue:41/255.f alpha:1.f]];
  1379. [colors addObject:[UIColor colorWithRed:88/255.f green:147/255.f blue:198/255.f alpha:1.f]];
  1380. dataSet.colors = colors;
  1381. dataSet.valueLinePart1OffsetPercentage = 0.8;
  1382. dataSet.valueLinePart1Length = 0.4;
  1383. dataSet.valueLinePart2Length = 0.4;
  1384. dataSet.yValuePosition = PieChartValuePositionOutsideSlice;
  1385. PieChartData *data = [[PieChartData alloc] initWithDataSet:dataSet];
  1386. NSNumberFormatter *pFormatter = [[NSNumberFormatter alloc] init];
  1387. pFormatter.numberStyle=NSNumberFormatterPercentStyle;
  1388. pFormatter.maximumFractionDigits = 2;
  1389. pFormatter.minimumFractionDigits=2;
  1390. pFormatter.multiplier = @1.0f;
  1391. pFormatter.percentSymbol = @"%";
  1392. [data setValueFormatter:[[ChartDefaultValueFormatter alloc] initWithFormatter:pFormatter]];
  1393. [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:11.f]];
  1394. [data setValueTextColor:UIColor.blackColor];
  1395. pieView.data = data;
  1396. [pieView highlightValues:nil];
  1397. }
  1398. /**
  1399. 画单个柱状图
  1400. */
  1401. -(void)drawSingleBarchart:(NSMutableArray*)barchartArray chartView:(BarChartView*)chart
  1402. axisValueFormatter:(id<ChartAxisValueFormatter>)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue minimumValue:(double)minimumValue paymentFeesIdArray:(NSArray*)feesArray
  1403. {
  1404. chart.chartDescription.enabled = NO;
  1405. chart.legend.enabled = NO;
  1406. chart.drawGridBackgroundEnabled = NO;
  1407. chart.dragEnabled = NO;
  1408. [chart setScaleEnabled:NO];
  1409. chart.pinchZoomEnabled = NO;
  1410. chart.extraBottomOffset=20;
  1411. chart.rightAxis.enabled = NO;
  1412. chart.delegate = self;
  1413. chart.drawBarShadowEnabled = NO;
  1414. chart.drawValueAboveBarEnabled = YES;
  1415. BalloonMarker *marker = [[BalloonMarker alloc]
  1416. initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0]
  1417. font: [UIFont systemFontOfSize:12.0]
  1418. textColor: UIColor.whiteColor
  1419. insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)];
  1420. marker.chartView = chart;
  1421. marker.minimumSize = CGSizeMake(80.f, 40.f);
  1422. chart.marker = marker;
  1423. chart.maxVisibleCount = 60;
  1424. ChartXAxis *xAxis = chart.xAxis;
  1425. xAxis.labelPosition = XAxisLabelPositionBottom;
  1426. xAxis.labelFont = [UIFont systemFontOfSize:10.f];
  1427. xAxis.drawGridLinesEnabled = NO;
  1428. xAxis.granularity = 1.0; // only intervals of 1 day
  1429. xAxis.labelCount = count;
  1430. xAxis.labelRotationAngle=20;
  1431. xAxis.valueFormatter = formatter;
  1432. ChartYAxis *leftAxis = chart.leftAxis;
  1433. leftAxis.labelFont = [UIFont systemFontOfSize:10.f];
  1434. leftAxis.axisMaximum=maximumValue+100;
  1435. leftAxis.labelPosition = YAxisLabelPositionOutsideChart;
  1436. leftAxis.spaceTop = 0.15;
  1437. if(minimumValue<0)
  1438. {
  1439. leftAxis.axisMinimum =minimumValue;
  1440. }
  1441. else{
  1442. leftAxis.axisMinimum = 0.0;
  1443. }
  1444. double start = 0;
  1445. NSMutableArray *yVals1 = [[NSMutableArray alloc] init];
  1446. NSMutableArray *colorArray = [[NSMutableArray alloc] init];
  1447. for (int i = start; i < barchartArray.count; i++)
  1448. {
  1449. BarChartDataEntry *dataEntry;
  1450. if(feesArray!=nil&&feesArray.count>0)
  1451. {
  1452. dataEntry= [[BarChartDataEntry alloc] initWithX:i y:[[barchartArray objectAtIndex:i]doubleValue] icon: [UIImage imageNamed:@"icon"] idValue:[[feesArray objectAtIndex:i]intValue]];
  1453. [yVals1 addObject:dataEntry];
  1454. }
  1455. else
  1456. {
  1457. dataEntry= [[BarChartDataEntry alloc] initWithX:i y:[[barchartArray objectAtIndex:i]doubleValue] icon: [UIImage imageNamed:@"icon"] ];
  1458. [yVals1 addObject:dataEntry];
  1459. }
  1460. }
  1461. BarChartDataSet *set1 = nil;
  1462. UIColor *blueColor= [UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1];
  1463. [colorArray addObject:blueColor];
  1464. if (chart.data.dataSetCount > 0)
  1465. {
  1466. set1 = (BarChartDataSet *)chart.data.dataSets[0];
  1467. [set1 replaceEntries: yVals1];
  1468. [chart.data notifyDataChanged];
  1469. [chart notifyDataSetChanged];
  1470. }
  1471. else
  1472. {
  1473. set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:@"资金"];
  1474. [set1 setColors:colorArray];
  1475. set1.drawIconsEnabled = NO;
  1476. [set1 setDrawValuesEnabled:NO];
  1477. NSMutableArray *dataSets = [[NSMutableArray alloc] init];
  1478. [dataSets addObject:set1];
  1479. BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];
  1480. [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.0f]];
  1481. data.barWidth = 0.5f;
  1482. chart.data = data;
  1483. }
  1484. }
  1485. /**
  1486. 画三个柱状图
  1487. */
  1488. -(void)drawMultipleBarchart:(NSArray*)barchartArray receivablesTitleArray:(NSMutableArray*)receivablesTitleArry barChartView:(BarChartView*) chartView
  1489. axisValueFormatter:(id<ChartAxisValueFormatter>)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue
  1490. minimumValue:(double)minimumValue
  1491. {
  1492. chartView.delegate = self;
  1493. chartView.chartDescription.enabled = NO;
  1494. chartView.extraBottomOffset=20;
  1495. chartView.dragEnabled = NO;
  1496. [chartView setScaleEnabled:NO];
  1497. chartView.pinchZoomEnabled = NO;
  1498. chartView.drawBarShadowEnabled = NO;
  1499. BalloonMarker *marker = [[BalloonMarker alloc]
  1500. initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0]
  1501. font: [UIFont systemFontOfSize:12.0]
  1502. textColor: UIColor.whiteColor
  1503. insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)];
  1504. marker.chartView = chartView;
  1505. marker.minimumSize = CGSizeMake(80.f, 40.f);
  1506. chartView.marker = marker;
  1507. chartView.drawGridBackgroundEnabled = NO;
  1508. ChartLegend *legend = chartView.legend;
  1509. legend.horizontalAlignment = ChartLegendHorizontalAlignmentCenter;
  1510. legend.verticalAlignment = ChartLegendVerticalAlignmentBottom;
  1511. legend.orientation = ChartLegendOrientationHorizontal;
  1512. legend.drawInside = NO;
  1513. legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.f];
  1514. legend.yOffset = 1;
  1515. legend.xOffset = 1;
  1516. legend.yEntrySpace =1;
  1517. ChartXAxis *xAxis = chartView.xAxis;
  1518. xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
  1519. xAxis.axisMinimum=0;
  1520. xAxis.labelRotationAngle=20;
  1521. xAxis.granularity = 1.0f;
  1522. xAxis.labelCount=count;
  1523. xAxis.drawGridLinesEnabled=NO;
  1524. xAxis.centerAxisLabelsEnabled = YES;
  1525. xAxis.labelPosition = XAxisLabelPositionBottom;
  1526. xAxis.valueFormatter =formatter ;
  1527. ChartYAxis *leftAxis = chartView.leftAxis;
  1528. leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
  1529. leftAxis.valueFormatter = [[YAxisValueFormatter alloc] init];
  1530. leftAxis.drawGridLinesEnabled = YES;
  1531. leftAxis.gridColor = [UIColor colorWithRed:200/255.0f green:200/255.0f blue:200/255.0f alpha:1];//网格线颜色
  1532. leftAxis.spaceTop = 0.35;
  1533. leftAxis.granularityEnabled=YES;
  1534. leftAxis.inverted=NO;
  1535. leftAxis.gridLineWidth =1;
  1536. if(minimumValue<0)
  1537. {
  1538. leftAxis.axisMinimum = minimumValue;
  1539. }
  1540. else
  1541. {
  1542. leftAxis.axisMinimum=0;
  1543. }
  1544. leftAxis.axisMaximum=maximumValue+100;
  1545. leftAxis.decimals=2;
  1546. // leftAxis.granularity=maximumValue/5;
  1547. chartView.rightAxis.enabled = NO;
  1548. float groupSpace = 0.1f;
  1549. float barSpace = 0.15f;
  1550. float barWidth = 0.15f;
  1551. NSMutableArray *yVals1 = [[NSMutableArray alloc] init];
  1552. NSMutableArray *yVals2 = [[NSMutableArray alloc] init];
  1553. NSMutableArray *yVals3 = [[NSMutableArray alloc] init];
  1554. int start =0;
  1555. long end = barchartArray.count;
  1556. for (int i = start; i < end; i++)
  1557. {
  1558. NSMutableDictionary *barchartDic=barchartArray[i];
  1559. double y1= [[barchartDic objectForKey:@"Amount"]doubleValue];
  1560. double y2=[[barchartDic objectForKey:@"CostAmount"]doubleValue];
  1561. double y3=[[barchartDic objectForKey:@"FeeAmount"]doubleValue];
  1562. [yVals1 addObject:[[BarChartDataEntry alloc]
  1563. initWithX:i
  1564. y:y1]];
  1565. [yVals2 addObject:[[BarChartDataEntry alloc]
  1566. initWithX:i
  1567. y:y2]];
  1568. [yVals3 addObject:[[BarChartDataEntry alloc]
  1569. initWithX:i
  1570. y:y3]];
  1571. }
  1572. BarChartDataSet *set1 = nil, *set2 = nil,*set3=nil;
  1573. if (chartView.data.dataSetCount > 0)
  1574. {
  1575. set1 = (BarChartDataSet *)chartView.data.dataSets[0];
  1576. set2 = (BarChartDataSet *)chartView.data.dataSets[1];
  1577. set3 = (BarChartDataSet *)chartView.data.dataSets[2];
  1578. [set1 replaceEntries:yVals1];
  1579. [set2 replaceEntries:yVals2];
  1580. [set3 replaceEntries:yVals3];
  1581. BarChartData *data = chartView.barData;
  1582. chartView.xAxis.axisMinimum = start;
  1583. chartView.xAxis.axisMaximum = [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end + start;
  1584. [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace];
  1585. [chartView.data notifyDataChanged];
  1586. [chartView notifyDataSetChanged];
  1587. }
  1588. else
  1589. {
  1590. set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:receivablesTitleArry[0]];
  1591. [set1 setColor:[UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1]];
  1592. set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:receivablesTitleArry[1]];
  1593. [set2 setColor:[UIColor colorWithRed:235/255.0f green:125/255.0f blue:60/255.0f alpha:1]];
  1594. set3 = [[BarChartDataSet alloc] initWithEntries:yVals3 label:receivablesTitleArry[2]];
  1595. [set3 setColor:[UIColor lightGrayColor]];
  1596. [set1 setDrawValuesEnabled:NO];
  1597. [set2 setDrawValuesEnabled:NO];
  1598. [set3 setDrawValuesEnabled:NO];
  1599. NSMutableArray *dataSets = [[NSMutableArray alloc] init];
  1600. [dataSets addObject:set1];
  1601. [dataSets addObject:set2];
  1602. [dataSets addObject:set3];
  1603. BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];
  1604. [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]];
  1605. data.barWidth = barWidth;
  1606. // restrict the x-axis range
  1607. chartView.xAxis.axisMinimum = start;
  1608. // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters
  1609. chartView.xAxis.axisMaximum = start+ [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end;
  1610. [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace];
  1611. chartView.data = data;
  1612. }
  1613. }
  1614. /**
  1615. 画两个柱状图
  1616. */
  1617. -(void)drawTwoBarchart:(NSMutableArray*)barchartArray receivablesTitleArray:(NSMutableArray*)receivablesTitleArry barChartView:(BarChartView*) chartView
  1618. axisValueFormatter:(id<ChartAxisValueFormatter>)formatter xAxisLabelCount:(NSInteger)count maximumValue:(double)maximumValue
  1619. minimumValue:(double)minimumValue
  1620. {
  1621. chartView.delegate = self;
  1622. chartView.extraBottomOffset=20;
  1623. chartView.chartDescription.enabled = NO;
  1624. chartView.dragEnabled = NO;
  1625. [chartView setScaleEnabled:NO];
  1626. chartView.pinchZoomEnabled = NO;
  1627. chartView.drawBarShadowEnabled = NO;
  1628. chartView.drawGridBackgroundEnabled = NO;
  1629. chartView.maxVisibleCount = 60;
  1630. BalloonMarker *marker = [[BalloonMarker alloc]
  1631. initWithColor: [UIColor colorWithWhite:210/255. alpha:1.0]
  1632. font: [UIFont systemFontOfSize:12.0]
  1633. textColor: UIColor.whiteColor
  1634. insets: UIEdgeInsetsMake(8.0, 8.0, 20.0, 8.0)];
  1635. marker.chartView = chartView;
  1636. marker.minimumSize = CGSizeMake(80.f, 40.f);
  1637. chartView.marker = marker;
  1638. ChartLegend *legend = chartView.legend;
  1639. legend.horizontalAlignment = ChartLegendHorizontalAlignmentCenter;
  1640. legend.verticalAlignment = ChartLegendVerticalAlignmentBottom;
  1641. legend.orientation = ChartLegendOrientationHorizontal ;
  1642. legend.drawInside = NO;
  1643. legend.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:12.0f];
  1644. legend.yOffset = 1.0;
  1645. legend.xOffset = 1.0;
  1646. legend.yEntrySpace =1;
  1647. ChartXAxis *xAxis = chartView.xAxis;
  1648. xAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
  1649. xAxis.axisMinimum = 0.0;
  1650. xAxis.granularity = 1.0f;
  1651. xAxis.labelCount=count;
  1652. xAxis.labelRotationAngle=20;
  1653. xAxis.drawGridLinesEnabled=NO;
  1654. xAxis.centerAxisLabelsEnabled = YES;
  1655. xAxis.labelPosition = XAxisLabelPositionBottom;
  1656. xAxis.valueFormatter =formatter ;
  1657. ChartYAxis *leftAxis = chartView.leftAxis;
  1658. leftAxis.labelFont = [UIFont fontWithName:@"HelveticaNeue-Light" size:10.f];
  1659. leftAxis.valueFormatter = [[YAxisValueFormatter alloc] init];
  1660. leftAxis.drawGridLinesEnabled = YES;
  1661. leftAxis.gridColor = [UIColor colorWithRed:200/255.0f green:200/255.0f blue:200/255.0f alpha:1];//网格线颜色
  1662. leftAxis.spaceTop = 0.35;
  1663. leftAxis.granularityEnabled=YES;
  1664. leftAxis.gridLineWidth =1;
  1665. if(minimumValue<0)
  1666. {
  1667. leftAxis.axisMinimum = minimumValue;
  1668. }
  1669. else
  1670. {
  1671. leftAxis.axisMinimum=0;
  1672. }
  1673. leftAxis.axisMaximum=maximumValue+100;
  1674. leftAxis.decimals=2;
  1675. // leftAxis.granularity=maximumValue/5;
  1676. chartView.rightAxis.enabled = NO;
  1677. float groupSpace = 0.1f;
  1678. float barSpace = 0.15f;
  1679. float barWidth = 0.3f;
  1680. NSMutableArray *yVals1 = [[NSMutableArray alloc] init];
  1681. NSMutableArray *yVals2 = [[NSMutableArray alloc] init];
  1682. int start =0;
  1683. long end = barchartArray.count;
  1684. for (int i = start; i < end; i++)
  1685. {
  1686. NSMutableDictionary *barchartDic=barchartArray[i];
  1687. double y1=0;
  1688. double y2=0;
  1689. if([[barchartDic allKeys] containsObject:@"AccountReceivable"])
  1690. {
  1691. y1= [[barchartDic objectForKey:@"AccountReceivable"]doubleValue];
  1692. }
  1693. if([[barchartDic allKeys] containsObject:@"DepositReceived"])
  1694. {
  1695. y2=[[barchartDic objectForKey:@"DepositReceived"]doubleValue];
  1696. }
  1697. if([[barchartDic allKeys] containsObject:@"AccountPayable"])
  1698. {
  1699. y1= [[barchartDic objectForKey:@"AccountPayable"]doubleValue];
  1700. }
  1701. if([[barchartDic allKeys] containsObject:@"AdvanceMoney"])
  1702. {
  1703. y2=[[barchartDic objectForKey:@"AdvanceMoney"]doubleValue];
  1704. }
  1705. if([[barchartDic allKeys] containsObject:@"PlanAmount"])
  1706. {
  1707. y1= [[barchartDic objectForKey:@"PlanAmount"]doubleValue];
  1708. }
  1709. if([[barchartDic allKeys] containsObject:@"OrderAmount"])
  1710. {
  1711. y2=[[barchartDic objectForKey:@"OrderAmount"]doubleValue];
  1712. }
  1713. [yVals1 addObject:[[BarChartDataEntry alloc]
  1714. initWithX:i
  1715. y:y1]];
  1716. [yVals2 addObject:[[BarChartDataEntry alloc]
  1717. initWithX:i
  1718. y:y2]];
  1719. }
  1720. BarChartDataSet *set1 = nil, *set2 = nil;
  1721. if (chartView.data.dataSetCount > 0)
  1722. {
  1723. set1 = (BarChartDataSet *)chartView.data.dataSets[0];
  1724. set2 = (BarChartDataSet *)chartView.data.dataSets[1];
  1725. [set1 replaceEntries:yVals1];
  1726. [set2 replaceEntries:yVals2];
  1727. BarChartData *data = chartView.barData;
  1728. chartView.xAxis.axisMinimum = start;
  1729. chartView.xAxis.axisMaximum = [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end + start;
  1730. [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace];
  1731. [chartView.data notifyDataChanged];
  1732. [chartView notifyDataSetChanged];
  1733. }
  1734. else
  1735. {
  1736. set1 = [[BarChartDataSet alloc] initWithEntries:yVals1 label:receivablesTitleArry[0]];
  1737. [set1 setColor:[UIColor colorWithRed:70/255.0f green:116/255.0f blue:193/255.0f alpha:1]];
  1738. set2 = [[BarChartDataSet alloc] initWithEntries:yVals2 label:receivablesTitleArry[1]];
  1739. [set2 setColor:[UIColor colorWithRed:235/255.0f green:125/255.0f blue:60/255.0f alpha:1]];
  1740. [set1 setDrawValuesEnabled:NO];
  1741. [set2 setDrawValuesEnabled:NO];
  1742. NSMutableArray *dataSets = [[NSMutableArray alloc] init];
  1743. [dataSets addObject:set1];
  1744. [dataSets addObject:set2];
  1745. BarChartData *data = [[BarChartData alloc] initWithDataSets:dataSets];
  1746. [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:10.f]];
  1747. data.barWidth = barWidth;
  1748. // restrict the x-axis range
  1749. chartView.xAxis.axisMinimum = start;
  1750. // groupWidthWithGroupSpace(...) is a helper that calculates the width each group needs based on the provided parameters
  1751. chartView.xAxis.axisMaximum = start+ [data groupWidthWithGroupSpace:groupSpace barSpace: barSpace] * end;
  1752. [data groupBarsFromX: start groupSpace: groupSpace barSpace: barSpace];
  1753. chartView.data = data;
  1754. }
  1755. }
  1756. -(void)clearSalesProfitData
  1757. {
  1758. lblNetProfitRate.text=@"0.00%";
  1759. lblSalesIncome.text=@"0.00";
  1760. lblSalesCost.text=@"0.00";
  1761. lblFeeAmount.text=@"0.00";
  1762. lblNetProfit.text=@"0.00";
  1763. lblSalesMargin.text=@"0.00";
  1764. lblGrossProfitMargin.text=@"0.00%";
  1765. }
  1766. -(void)clearProcuremmentData
  1767. {
  1768. lblProcuremmentPercent.text=@"完成率0.00%";
  1769. lblPlanAmount.text=@"0.00";
  1770. lblProcurementAmount.text=@"0.00";
  1771. }
  1772. -(void)clearPaymentFeesData
  1773. {
  1774. lblFeesTotalAmount.text=@"0.00";
  1775. }
  1776. -(void)clearMoneytoryAssetsData
  1777. {
  1778. lblMonetoryCapitalAmount.text=@"0.00";
  1779. lblCashInHand.text=@"0.00";
  1780. lblBankDeposit.text=@"0.00";
  1781. lblOtherMonetoryCaiptal.text=@"0.00";
  1782. lblNetMoneyInflow.text=@"0.00";
  1783. }
  1784. -(void)clearCurrentSituation
  1785. {
  1786. lblReceivablesAmount.text=@"0.00";
  1787. lblDepositAmount.text=@"0.00";
  1788. lblAdvancePayment.text = @"0.00";
  1789. lblReceivablesAdvanceDeposit.text=@"0.00";
  1790. }
  1791. -(void)clearPayableSituation
  1792. {
  1793. lblAccountsPayable.text=@"0.00";
  1794. lblAdvancePaymentAmount.text=@"0.00";
  1795. }
  1796. -(void)clearInventorySituation
  1797. {
  1798. lblInventoryAmount.text=@"0.00";
  1799. lblInventoryQuantity.text=@"0";
  1800. }
  1801. /**
  1802. * 异步执行 + 并发队列
  1803. * 特点:可以开启多个线程,任务交替(同时)执行。
  1804. */
  1805. - (void)asyncConcurrent {
  1806. dispatch_queue_t queue = dispatch_queue_create("com.test.queue", DISPATCH_QUEUE_CONCURRENT);
  1807. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_SALES_PROFIT_IPHONE].location!=NSNotFound){
  1808. dispatch_async(queue, ^{
  1809. // 追加任务 1
  1810. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1811. [self loadSalesProfitData];
  1812. });
  1813. }
  1814. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  1815. dispatch_async(queue, ^{
  1816. // 追加任务 2
  1817. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1818. [self loadtAccountCashsData];
  1819. });
  1820. }
  1821. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  1822. dispatch_async(queue, ^{
  1823. // 追加任务 3
  1824. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1825. [self loadCurrentSituationData];
  1826. });
  1827. }
  1828. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  1829. dispatch_async(queue, ^{
  1830. // 追加任务 4
  1831. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1832. [self loadPayableData];
  1833. });
  1834. }
  1835. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  1836. dispatch_async(queue, ^{
  1837. // 追加任务 5
  1838. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1839. [self loadInvnetoryStatusData];
  1840. });
  1841. }
  1842. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  1843. dispatch_async(queue, ^{
  1844. // 追加任务 5
  1845. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1846. [self loadProcurementStatusData];
  1847. });
  1848. }
  1849. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  1850. dispatch_async(queue, ^{
  1851. // 追加任务 5
  1852. [NSThread sleepForTimeInterval:1]; // 模拟耗时操作
  1853. [self loadPaymentFeesData];
  1854. });
  1855. }
  1856. }
  1857. /**
  1858. 导航按钮样式
  1859. */
  1860. -(void)loadNavStyle
  1861. {
  1862. self.navigationItem.title=@"统计数据分析";
  1863. //返回
  1864. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  1865. [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
  1866. forState:UIControlStateNormal];
  1867. [button addTarget:self action:@selector(goBack)
  1868. forControlEvents:UIControlEventTouchUpInside];
  1869. button.frame = CGRectMake(0, 0, 15, 18);
  1870. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  1871. self.navigationItem.leftBarButtonItem = menuButton;
  1872. }
  1873. /**
  1874. 选择销售利润开始日期
  1875. */
  1876. - (void)btnSelectStartDate
  1877. {
  1878. __weak typeof(self) weakself=self;
  1879. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  1880. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  1881. _tempSalesProfitStartDate=date;
  1882. } andCompletionBlock:^(void){
  1883. _salesProfitStartDate = _tempSalesProfitStartDate;
  1884. [weakself.btnSalesProfitStartDate setTitle:weakself.salesProfitStartDate forState:UIControlStateNormal];
  1885. [self startLoading];
  1886. [self clearSalesProfitData];
  1887. [self loadSalesProfitData];
  1888. } andCancelBlock:^(void){
  1889. }];
  1890. [_dealDatePicker show];
  1891. }
  1892. /**
  1893. 选择销售利润结束日期
  1894. */
  1895. - (void)btnSelectEndDate
  1896. {
  1897. __weak typeof(self) weakself=self;
  1898. _dealDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
  1899. [_dealDatePicker configureSelectionBlock:^(NSString *date){
  1900. _tempSalesProfitEndDate=date;
  1901. } andCompletionBlock:^(void){
  1902. weakself.salesProfitEndDate = _tempSalesProfitEndDate;
  1903. [weakself.btnSalesProfitEndDate setTitle:weakself.salesProfitEndDate forState:UIControlStateNormal];
  1904. [self clearSalesProfitData];
  1905. [self startLoading];
  1906. [self loadSalesProfitData];
  1907. } andCancelBlock:^(void){
  1908. }];
  1909. [_dealDatePicker show];
  1910. }
  1911. /**
  1912. 选择销售利润今天日期
  1913. */
  1914. -(void)selectTodayDateData
  1915. {
  1916. vDate.hidden=YES;
  1917. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  1918. salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350);
  1919. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  1920. height=CGRectGetMaxY(salesProfitContent.frame);
  1921. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  1922. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  1923. height=CGRectGetMaxY(currencyCapitalContent.frame);
  1924. }
  1925. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  1926. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  1927. height=CGRectGetMaxY(currentSituationContent.frame);
  1928. }
  1929. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  1930. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+30);
  1931. height=CGRectGetMaxY(payableContent.frame);
  1932. }
  1933. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  1934. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  1935. height=CGRectGetMaxY(inventoryStatusContent.frame);
  1936. }
  1937. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  1938. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  1939. height=CGRectGetMaxY(procurementSituationContent.frame);
  1940. }
  1941. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  1942. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  1943. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  1944. }
  1945. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  1946. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  1947. [salesIncomeYValues removeAllObjects];
  1948. [salesProfitTitleArray removeAllObjects];
  1949. [self changeButtonColor];
  1950. [self clearSalesProfitData];
  1951. _btnToday.layer.borderColor=[UIColor redColor].CGColor;
  1952. [_btnToday setTitleColor:[UIColor redColor]forState:UIControlStateNormal];
  1953. _salesProfitStartDate=[DateFormat getCurrentDate];
  1954. _salesProfitEndDate=[DateFormat getCurrentDate];
  1955. [self startLoading];
  1956. [self loadSalesProfitData];
  1957. }
  1958. /**
  1959. 获取y轴最大值
  1960. */
  1961. -(double)getYAxisMaximumValue:(NSMutableArray*) yValueArray
  1962. {
  1963. double maximumValue=[[yValueArray objectAtIndex:0]doubleValue];
  1964. for(int i=1;i<yValueArray.count;i++)
  1965. {
  1966. double yValue=[[yValueArray objectAtIndex:i]doubleValue];
  1967. if(yValue>maximumValue)
  1968. {
  1969. maximumValue=yValue;
  1970. }
  1971. }
  1972. return maximumValue;
  1973. }
  1974. /**
  1975. 获取y轴最小值
  1976. */
  1977. -(double)getYAxisMinimumValue:(NSMutableArray*) yValueArray
  1978. {
  1979. double minimumValue=[[yValueArray objectAtIndex:0]doubleValue];
  1980. for(int i=1;i<yValueArray.count;i++)
  1981. {
  1982. double yValue=[[yValueArray objectAtIndex:i]doubleValue];
  1983. if(yValue<minimumValue)
  1984. {
  1985. minimumValue=yValue;
  1986. }
  1987. }
  1988. return minimumValue;
  1989. }
  1990. /**
  1991. 获取销售利润昨天日期
  1992. */
  1993. -(void)selectYesterdayDateData
  1994. {
  1995. vDate.hidden=YES;
  1996. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  1997. salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350);
  1998. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  1999. height=CGRectGetMaxY(salesProfitContent.frame);
  2000. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  2001. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  2002. height=CGRectGetMaxY(currencyCapitalContent.frame);
  2003. }
  2004. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  2005. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  2006. height=CGRectGetMaxY(currentSituationContent.frame);
  2007. }
  2008. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  2009. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+30);
  2010. height=CGRectGetMaxY(payableContent.frame);
  2011. }
  2012. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  2013. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  2014. height=CGRectGetMaxY(inventoryStatusContent.frame);
  2015. }
  2016. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  2017. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  2018. height=CGRectGetMaxY(procurementSituationContent.frame);
  2019. }
  2020. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  2021. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  2022. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  2023. }
  2024. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  2025. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  2026. [salesIncomeYValues removeAllObjects];
  2027. [salesProfitTitleArray removeAllObjects];
  2028. [self clearSalesProfitData];
  2029. [self changeButtonColor];
  2030. _btnYesterday.layer.borderColor=[UIColor redColor].CGColor;
  2031. [_btnYesterday setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2032. _salesProfitStartDate=[DateFormat getDateBefore:1];
  2033. _salesProfitEndDate=[DateFormat getDateBefore:1];
  2034. [self startLoading];
  2035. [self loadSalesProfitData];
  2036. }
  2037. /**
  2038. 获取销售利润定制日期
  2039. */
  2040. -(void)selectCustomDateData
  2041. {
  2042. vDate.hidden=NO;
  2043. vDate.frame= vDate.frame=CGRectMake(0, CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, 25);
  2044. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(vDate.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  2045. salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350);
  2046. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  2047. height=CGRectGetMaxY(salesProfitContent.frame);
  2048. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  2049. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  2050. height=CGRectGetMaxY(currencyCapitalContent.frame);
  2051. }
  2052. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  2053. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  2054. height=CGRectGetMaxY(currentSituationContent.frame);
  2055. }
  2056. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  2057. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+10);
  2058. height=CGRectGetMaxY(payableContent.frame);
  2059. }
  2060. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  2061. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  2062. height=CGRectGetMaxY(inventoryStatusContent.frame);
  2063. }
  2064. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  2065. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  2066. height=CGRectGetMaxY(procurementSituationContent.frame);
  2067. }
  2068. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  2069. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  2070. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  2071. }
  2072. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  2073. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  2074. [salesIncomeYValues removeAllObjects];
  2075. [salesProfitTitleArray removeAllObjects];
  2076. NSArray *dateInitArray=[DateFormat getMonthFirstLastDay];
  2077. _salesProfitStartDate=[dateInitArray objectAtIndex:0];
  2078. _salesProfitEndDate=[DateFormat getCurrentDate];
  2079. [_btnSalesProfitStartDate setTitle:_salesProfitStartDate forState:UIControlStateNormal];
  2080. [_btnSalesProfitEndDate setTitle:_salesProfitEndDate forState:UIControlStateNormal];
  2081. [self changeButtonColor];
  2082. btnCustomMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2083. [_btnCustom setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2084. [self startLoading];
  2085. [self loadSalesProfitData];
  2086. }
  2087. /**
  2088. 获取销售利润前7天日期
  2089. */
  2090. -(void)selectSevenDaysData
  2091. {
  2092. vDate.hidden=YES;
  2093. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  2094. salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350);
  2095. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  2096. height=CGRectGetMaxY(salesProfitContent.frame);
  2097. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  2098. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  2099. height=CGRectGetMaxY(currencyCapitalContent.frame);
  2100. }
  2101. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  2102. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  2103. height=CGRectGetMaxY(currentSituationContent.frame);
  2104. }
  2105. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  2106. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+30);
  2107. height=CGRectGetMaxY(payableContent.frame);
  2108. }
  2109. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  2110. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  2111. height=CGRectGetMaxY(inventoryStatusContent.frame);
  2112. }
  2113. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  2114. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  2115. height=CGRectGetMaxY(procurementSituationContent.frame);
  2116. }
  2117. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  2118. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  2119. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  2120. }
  2121. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  2122. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  2123. [salesIncomeYValues removeAllObjects];
  2124. [salesProfitTitleArray removeAllObjects];
  2125. [self clearSalesProfitData];
  2126. [self changeButtonColor];
  2127. _btnRecentlySevenDays.layer.borderColor=[UIColor redColor].CGColor;
  2128. [_btnRecentlySevenDays setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2129. _salesProfitStartDate=[DateFormat getDateBefore:7];
  2130. _salesProfitEndDate=[DateFormat getCurrentDate];
  2131. [self startLoading];
  2132. [self loadSalesProfitData];
  2133. }
  2134. /**
  2135. 获取销售利润前30天日期
  2136. */
  2137. -(void)selectThirtyDaysData
  2138. {
  2139. vDate.hidden=YES;
  2140. netProfitContent.frame = CGRectMake(0,CGRectGetMaxY(_btnCustom.frame)+topMargin, Screen_Width, CGRectGetMaxY(_btnDepartment.frame));
  2141. salesProfitBorderV.frame=CGRectMake(0, CGRectGetMaxY(netProfitContent.frame)+topMargin,Screen_Width-20, 350);
  2142. salesProfitContent.frame=CGRectMake(10, 10,Screen_Width-20,CGRectGetMaxY(salesProfitBorderV.frame)+10);
  2143. height=CGRectGetMaxY(salesProfitContent.frame);
  2144. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_MONETORY_CAPITAL_IPHONE].location!=NSNotFound){
  2145. currencyCapitalContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currencyCapitalBorderV.frame));
  2146. height=CGRectGetMaxY(currencyCapitalContent.frame);
  2147. }
  2148. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_CURRENT_IPHONE].location!=NSNotFound){
  2149. currentSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(currentSituationBorderV.frame)+10);
  2150. height=CGRectGetMaxY(currentSituationContent.frame);
  2151. }
  2152. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PAYABLE_IPHONE].location!=NSNotFound){
  2153. payableContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(payableBorderV.frame)+30);
  2154. height=CGRectGetMaxY(payableContent.frame);
  2155. }
  2156. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_INVENTORY_IPHONE].location!=NSNotFound){
  2157. inventoryStatusContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(inventoryStatusBorderV.frame)+10);
  2158. height=CGRectGetMaxY(inventoryStatusContent.frame);
  2159. }
  2160. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_PROCUREMENT_IPHONE].location!=NSNotFound){
  2161. procurementSituationContent.frame=CGRectMake(10, height+10,Screen_Width-20,CGRectGetMaxY(procurementStatusChartBorderV.frame)+10);
  2162. height=CGRectGetMaxY(procurementSituationContent.frame);
  2163. }
  2164. if([kkRights rangeOfString: FUNCTION_STATISTICS_DATA_FEES_IPHONE].location!=NSNotFound){
  2165. paymentFeesStatusContent.frame=CGRectMake(10,height+10,Screen_Width,CGRectGetMaxY(paymentBorderV.frame)+10);
  2166. height=CGRectGetMaxY(paymentFeesStatusContent.frame);
  2167. }
  2168. content.frame=CGRectMake(0, 0,Screen_Width,height-CGRectGetMaxY(titleView.frame));
  2169. scroll.contentSize = CGSizeMake(self.view.frame.size.width, height-CGRectGetMaxY(titleView.frame)+rectStatusHeight+rectNavHeight+100);
  2170. [salesIncomeYValues removeAllObjects];
  2171. [salesProfitTitleArray removeAllObjects];
  2172. [self clearSalesProfitData];
  2173. [self changeButtonColor];
  2174. btnRecentlyThirtyDaysMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2175. [_btnRecentlyThirtyDays setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2176. _salesProfitStartDate=[DateFormat getDateBefore:30];
  2177. _salesProfitEndDate=[DateFormat getCurrentDate];
  2178. [self startLoading];
  2179. [self loadSalesProfitData];
  2180. }
  2181. /**
  2182. 切换销售利润按钮颜色
  2183. */
  2184. -(void)changeButtonColor
  2185. {
  2186. btnCustomMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2187. _btnToday.layer.borderColor=[UIColor lightGrayColor].CGColor;
  2188. _btnYesterday.layer.borderColor=[UIColor lightGrayColor].CGColor;
  2189. _btnRecentlySevenDays.layer.borderColor=[UIColor lightGrayColor].CGColor;
  2190. btnRecentlyThirtyDaysMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2191. [_btnCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2192. [_btnToday setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2193. [_btnYesterday setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2194. [_btnRecentlySevenDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2195. [_btnRecentlyThirtyDays setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2196. }
  2197. -(void)goProcurementCurrentMonth:(UIButton *)sender
  2198. {
  2199. procurementStatusDate=[DateFormat getCurrentNoSeparateMonth];
  2200. [self changeProcurementStatusColor];
  2201. procurementCustomMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2202. [_btnProcurementCustomMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2203. [procurementStatusYArray removeAllObjects];
  2204. [procurementStatusXTitleArray removeAllObjects];
  2205. [self clearProcuremmentData];
  2206. [self startLoading];
  2207. [self loadProcurementStatusData];
  2208. }
  2209. -(void)goPaymentFeesCustomMonth:(UIButton *)sender
  2210. {
  2211. [self changePaymentFeesColor];
  2212. paymentFeesCustomMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2213. [_btnPaymentFeesCustomMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2214. ITDatePickerController *datePickerController = [[ITDatePickerController alloc] init];
  2215. datePickerController.tag = 102;
  2216. datePickerController.delegate = self;
  2217. datePickerController.showToday = NO;
  2218. datePickerController.defaultDate = nil;
  2219. [self presentViewController:datePickerController animated:YES completion:nil];
  2220. }
  2221. /**
  2222. 切换渠道部门按钮颜色
  2223. */
  2224. -(void)changeChannelDepartmentColor
  2225. {
  2226. btnChannelMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2227. [_btnChannel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2228. btnDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2229. [_btnDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2230. }
  2231. /**
  2232. 切换往来情况渠道部门按钮颜色
  2233. */
  2234. -(void)changeCurrentSituationColor
  2235. {
  2236. currentSituationDepartmentMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2237. currentSituationChannelMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2238. [_btnCurrentChannel setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2239. [_btnCurrentDepartment setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2240. }
  2241. /**
  2242. 切换货币资金按钮颜色
  2243. */
  2244. -(void)changeMoneytoryCapitalColor
  2245. {
  2246. moneytoryCapitalCurrentMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2247. [_btnMonetoryCaitalCustom setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2248. [_btnMonetoryCaitalCurrentMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2249. moneytoryCapitalMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2250. }
  2251. -(void)changeProcurementStatusColor
  2252. {
  2253. procurementCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2254. [_btnProcurementCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2255. [_btnProcurementCurrentMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2256. procurementCurrentMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2257. }
  2258. -(void)changePaymentFeesColor
  2259. {
  2260. paymentFeesCustomMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2261. [_btnPaymentFeesCustomMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2262. [_btnPaymentFeesCurrentMonth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  2263. paymentFeesCurrentMonthMaskLayer.strokeColor=[UIColor lightGrayColor].CGColor;
  2264. }
  2265. /**
  2266. 加载库存状态数据源
  2267. */
  2268. -(void)loadInvnetoryStatusData
  2269. {
  2270. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2271. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2272. [dict setObject:@"GetAccountInventoryReportDataIphone" forKey:@"Action"];
  2273. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2274. [dict setObject:kkUserCode forKey:@"UserCode"];
  2275. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2276. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2277. _inventoryStatusDownManager = [[ASIDownManager alloc] init];
  2278. _inventoryStatusDownManager.delegate = self;
  2279. _inventoryStatusDownManager.onRequestSuccess = @selector(onInventoryStatusLoadFinish:);
  2280. _inventoryStatusDownManager.onRequestFail = @selector(onInventoryStatusLoadFail:);
  2281. [_inventoryStatusDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2282. }
  2283. -(void)loadPaymentFeesData
  2284. {
  2285. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2286. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2287. [dict setObject:@"GetAccountFeeReportDataIphone" forKey:@"Action"];
  2288. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2289. [dict setObject:kkUserCode forKey:@"UserCode"];
  2290. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2291. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2292. [dict setObject:paymentFeesDate forKey:@"AccountMonth"];
  2293. _paymentFeesDownManager = [[ASIDownManager alloc] init];
  2294. _paymentFeesDownManager.delegate = self;
  2295. _paymentFeesDownManager.onRequestSuccess = @selector(onPaymentFeesLoadFinish:);
  2296. _paymentFeesDownManager.onRequestFail = @selector(onPaymentFeesLoadFail:);
  2297. [_paymentFeesDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2298. }
  2299. -(void)loadProcurementStatusData
  2300. {
  2301. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2302. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2303. [dict setObject:@"GetAccountProcurementTaskReportDataIphone" forKey:@"Action"];
  2304. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2305. [dict setObject:kkUserCode forKey:@"UserCode"];
  2306. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2307. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2308. [dict setObject:procurementStatusDate forKeyedSubscript:@"AccountMonth"];
  2309. _procurementStatusDownManager = [[ASIDownManager alloc] init];
  2310. _procurementStatusDownManager.delegate = self;
  2311. _procurementStatusDownManager.onRequestSuccess = @selector(onProcurementStatusLoadFinish:);
  2312. _procurementStatusDownManager.onRequestFail = @selector(onProcurementStatusLoadFail:);
  2313. [_procurementStatusDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2314. }
  2315. //-(void)loadFNCAccount
  2316. //{
  2317. // NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2318. // NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2319. // [dict setObject:@"GetFNCAccount" forKey:@"Action"];
  2320. // [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2321. // [dict setObject:kkUserCode forKey:@"UserCode"];
  2322. // [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2323. // [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2324. // _downManager = [[ASIDownManager alloc] init];
  2325. // _downManager.delegate = self;
  2326. // _downManager.onRequestSuccess = @selector(onFNCAccountLoadFinish:);
  2327. // _downManager.onRequestFail = @selector(onFNCAccountLoadFail:);
  2328. // [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2329. //}
  2330. /**
  2331. 加载销售利润数据源
  2332. */
  2333. -(void)loadSalesProfitData
  2334. {
  2335. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2336. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2337. [dict setObject:@"GetAccountStatisticalAnalysisDataIphone" forKey:@"Action"];
  2338. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2339. [dict setObject:kkUserCode forKey:@"UserCode"];
  2340. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2341. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2342. [dict setObject:typeId forKeyedSubscript:@"TypeID"];
  2343. [dict setObject:_salesProfitStartDate forKeyedSubscript:@"AccountDateFrom"];
  2344. [dict setObject:_salesProfitEndDate forKeyedSubscript:@"AccountDateTo"];
  2345. _downManager = [[ASIDownManager alloc] init];
  2346. _downManager.delegate = self;
  2347. _downManager.onRequestSuccess = @selector(onSalesProfitLoadFinish:);
  2348. _downManager.onRequestFail = @selector(onSalesProfitLoadFail:);
  2349. [_downManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2350. }
  2351. /**
  2352. 销售利润渠道业务部门按钮点击事件
  2353. */
  2354. -(void)goSalesProfit:(UIButton *)sender
  2355. {
  2356. [salesIncomeYValues removeAllObjects];
  2357. [salesProfitTitleArray removeAllObjects];
  2358. [self changeChannelDepartmentColor];
  2359. if(sender.tag==1000)
  2360. {
  2361. typeId=@"0";
  2362. btnChannelMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2363. [_btnChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2364. }
  2365. if(sender.tag==1001)
  2366. {
  2367. typeId=@"1";
  2368. btnDepartmentMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2369. [_btnDepartment setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2370. }
  2371. [self clearSalesProfitData];
  2372. [self startLoading];
  2373. [self loadSalesProfitData];
  2374. }
  2375. -(void)goProcurementCustomMonth:(UIButton *)sender
  2376. {
  2377. [self changeProcurementStatusColor];
  2378. procurementCustomMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2379. [_btnProcurementCustomMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2380. ITDatePickerController *datePickerController = [[ITDatePickerController alloc] init];
  2381. datePickerController.tag = 101;
  2382. datePickerController.delegate = self;
  2383. datePickerController.showToday = NO;
  2384. datePickerController.defaultDate = nil;
  2385. [self presentViewController:datePickerController animated:YES completion:nil];
  2386. }
  2387. /**
  2388. 往来情况渠道业务部门按钮点击事件
  2389. */
  2390. -(void)goCurrentSituation:(UIButton *)sender
  2391. {
  2392. [self changeCurrentSituationColor];
  2393. [receivablesValuesArray removeAllObjects];
  2394. [receivableXTitleArray removeAllObjects];
  2395. if(sender.tag==1002)
  2396. {
  2397. typeId=@"0";
  2398. currentSituationChannelMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2399. [_btnCurrentChannel setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2400. }
  2401. if(sender.tag==1003)
  2402. {
  2403. typeId=@"1";
  2404. currentSituationDepartmentMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2405. [_btnCurrentDepartment setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2406. }
  2407. [self clearCurrentSituation];
  2408. [self startLoading];
  2409. [self loadCurrentSituationData];
  2410. }
  2411. /**
  2412. 加载货币资金当前月
  2413. */
  2414. -(void)getMoneytoryAssetsCurrentMonth
  2415. {
  2416. [self changeMoneytoryCapitalColor];
  2417. [_btnMonetoryCaitalCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2418. [netMoneyValues removeAllObjects];
  2419. moneytoryAssetsDate=[DateFormat getCurrentNoSeparateMonth];
  2420. [self clearMoneytoryAssetsData];
  2421. [self startLoading];
  2422. [self loadtAccountCashsData];
  2423. }
  2424. -(void)goPaymentFeesCurrentMonth:(UIButton*)sender
  2425. {
  2426. [self changePaymentFeesColor];
  2427. [_btnPaymentFeesCurrentMonth setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2428. paymentFeesCurrentMonthMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2429. paymentFeesDate=[DateFormat getCurrentNoSeparateMonth];
  2430. [paymentFeesYArray removeAllObjects];
  2431. [paymentFeesYIdArray removeAllObjects];
  2432. [paymentFeesXArray removeAllObjects];
  2433. [self clearPaymentFeesData];
  2434. [self startLoading];
  2435. [self loadPaymentFeesData];
  2436. }
  2437. /**
  2438. 货币资金定制日期点击事件
  2439. */
  2440. -(void)selectCustomDate
  2441. {
  2442. [netMoneyValues removeAllObjects];
  2443. [self changeMoneytoryCapitalColor];
  2444. [_btnMonetoryCaitalCustom setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
  2445. moneytoryCapitalMaskLayer.strokeColor=[UIColor redColor].CGColor;
  2446. ITDatePickerController *datePickerController = [[ITDatePickerController alloc] init];
  2447. datePickerController.tag = 100;
  2448. datePickerController.delegate = self;
  2449. datePickerController.showToday = NO;
  2450. datePickerController.defaultDate = nil;
  2451. [self presentViewController:datePickerController animated:YES completion:nil];
  2452. }
  2453. /**
  2454. 加载应付情况数据源
  2455. */
  2456. -(void)loadPayableData
  2457. {
  2458. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2459. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2460. [dict setObject:@"GetAccountSupplierDataIphone" forKey:@"Action"];
  2461. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2462. [dict setObject:kkUserCode forKey:@"UserCode"];
  2463. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2464. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2465. _payableDownManager = [[ASIDownManager alloc] init];
  2466. _payableDownManager.delegate = self;
  2467. _payableDownManager.onRequestSuccess = @selector(onPayableLoadFinish:);
  2468. _payableDownManager.onRequestFail = @selector(onPayableLoadFail:);
  2469. [_payableDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2470. }
  2471. /**
  2472. 加载往来情况数据源
  2473. */
  2474. -(void)loadCurrentSituationData
  2475. {
  2476. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2477. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2478. [dict setObject:@"GetAccountCustomersDataIphone" forKey:@"Action"];
  2479. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2480. [dict setObject:kkUserCode forKey:@"UserCode"];
  2481. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2482. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2483. [dict setObject:typeId forKeyedSubscript:@"TypeID"];
  2484. _currentSituationDownManager = [[ASIDownManager alloc] init];
  2485. _currentSituationDownManager.delegate = self;
  2486. _currentSituationDownManager.onRequestSuccess = @selector(onCurrentSituationLoadFinish:);
  2487. _currentSituationDownManager.onRequestFail = @selector(onCurrentSituationLoadFail:);
  2488. [_currentSituationDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2489. }
  2490. /**
  2491. 加载货币资金数据源
  2492. */
  2493. -(void)loadtAccountCashsData
  2494. {
  2495. NSString *urlStr = [NSString stringWithFormat:@"%@", ServerURL];
  2496. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  2497. [dict setObject:@"GetAccountCashsDataIphone" forKey:@"Action"];
  2498. [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
  2499. [dict setObject:kkUserCode forKey:@"UserCode"];
  2500. [dict setObject:kkUserPwd forKey:@"UserPassword"];
  2501. [dict setObject:kkSessionKey forKey:@"SessionKey"];
  2502. [dict setObject:moneytoryAssetsDate forKeyedSubscript:@"AccountMonth"];
  2503. _accountCashDownManager = [[ASIDownManager alloc] init];
  2504. _accountCashDownManager.delegate = self;
  2505. _accountCashDownManager.onRequestSuccess = @selector(onAccountCashsDataLoadFinish:);
  2506. _accountCashDownManager.onRequestFail = @selector(onAccountCashsDataLoadFail:);
  2507. [_accountCashDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
  2508. }
  2509. #pragma mark - 委托函数
  2510. -(void)onPaymentFeesLoadFinish:(ASIDownManager *)sender {
  2511. count++;
  2512. if(count>=3)
  2513. {
  2514. [self stopLoading];
  2515. }
  2516. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2517. int status= resultModel.status;
  2518. if(status==0)
  2519. {
  2520. NSDictionary *resultDic=(NSDictionary*)resultModel.result;
  2521. NSArray *resultArray=[resultDic objectForKey:@"Table"];
  2522. if(resultArray!=nil&&resultArray.count>0)
  2523. {
  2524. double totalFeesAmount=0;
  2525. for(int i=0;i<resultArray.count;i++)
  2526. {
  2527. NSDictionary *dic=[resultArray objectAtIndex:i];
  2528. double confirmFeeSumValue= [[dic objectForKey:@"ConfirmFeeSum"]doubleValue];
  2529. NSString *confirmFeeSumStr=[NSString stringWithFormat:@"%.2f",confirmFeeSumValue];
  2530. NSString *organizationName=[dic objectForKey:@"OrganizationName"];
  2531. NSInteger organizationId=[[dic objectForKey:@"OrganizationID"]integerValue];
  2532. [paymentFeesYArray addObject:confirmFeeSumStr];
  2533. [paymentFeesXArray addObject:organizationName];
  2534. [paymentFeesYIdArray addObject:[NSString stringWithFormat:@"%ld",organizationId]];
  2535. totalFeesAmount+=confirmFeeSumValue;
  2536. }
  2537. double maximumValue= [self getYAxisMaximumValue:paymentFeesYArray];
  2538. double minimumValue=[self getYAxisMinimumValue:paymentFeesYArray];
  2539. NSString *totalFeesAmountStr=[NSString stringWithFormat:@"%.2f",totalFeesAmount];
  2540. lblFeesTotalAmount.text=[Util thousandSeparatorFormat:totalFeesAmountStr];
  2541. IntAxisValueFormatter *formatter=[[IntAxisValueFormatter alloc]init];
  2542. [formatter setTitle:paymentFeesXArray];
  2543. [self drawSingleBarchart:paymentFeesYArray chartView:_paymentFeesChartView axisValueFormatter:formatter xAxisLabelCount:paymentFeesXArray.count maximumValue:maximumValue minimumValue:minimumValue paymentFeesIdArray:paymentFeesYIdArray];
  2544. }
  2545. else
  2546. {
  2547. [_paymentFeesChartView clear];
  2548. [_paymentFeesChartView notifyDataSetChanged];
  2549. }
  2550. }
  2551. }
  2552. -(void)onPaymentFeesLoadFail:(ASIDownManager *)sender {
  2553. [self stopLoading];
  2554. [self showAlertViewText:@"网络异常"];
  2555. }
  2556. -(void)onProcurementStatusLoadFinish:(ASIDownManager *)sender {
  2557. count++;
  2558. if(count>=3)
  2559. {
  2560. [self stopLoading];
  2561. }
  2562. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2563. int status= resultModel.status;
  2564. if(status==0)
  2565. {
  2566. NSDictionary *resultDic=(NSDictionary*)resultModel.result;
  2567. NSArray *resultArray=[resultDic objectForKey:@"Table"];
  2568. NSArray *resultArray1=[resultDic objectForKey:@"Table1"];
  2569. double totalPlanAmount=0;
  2570. NSString *totalPlanAmountStr;
  2571. if(resultArray1!=nil&&resultArray1.count>0)
  2572. {
  2573. NSDictionary *resultDic1=[resultArray1 objectAtIndex:0];
  2574. totalPlanAmount= [[resultDic1 objectForKey:@"PlanAmount"]doubleValue];
  2575. totalPlanAmountStr =[NSString stringWithFormat:@"%.2f",totalPlanAmount];
  2576. }
  2577. if(resultArray!=nil&&resultArray.count>0)
  2578. {
  2579. double totalOrderAmount=0;
  2580. NSMutableArray *orderAmountArray=[[NSMutableArray alloc]init];
  2581. for(int i=0;i<resultArray.count;i++)
  2582. {
  2583. NSDictionary *dic=[resultArray objectAtIndex:i];
  2584. double planAmount=[[dic objectForKey:@"PlanAmount"]doubleValue];
  2585. double orderAmount=[[dic objectForKey:@"OrderAmount"]doubleValue];
  2586. totalOrderAmount+=orderAmount;
  2587. NSString *procurementCategoryName=[dic objectForKey:@"BrandName"];
  2588. NSMutableDictionary *orderDic=[[NSMutableDictionary alloc]init];
  2589. NSString *planAmountStr=[NSString stringWithFormat:@"%.2f",planAmount];
  2590. [orderAmountArray addObject:planAmountStr];
  2591. NSString *orderAmountStr=[NSString stringWithFormat:@"%.2f",orderAmount];
  2592. [orderAmountArray addObject:orderAmountStr];
  2593. [orderDic setObject:orderAmountStr forKey:@"OrderAmount"];
  2594. [orderDic setObject:planAmountStr forKey:@"PlanAmount"];
  2595. [procurementStatusYArray addObject:orderDic];
  2596. [procurementStatusXTitleArray addObject:procurementCategoryName];
  2597. }
  2598. NSString *totalOrderAmountStr=[NSString stringWithFormat:@"%.2f",totalOrderAmount];
  2599. lblPlanAmount.text=[Util thousandSeparatorFormat:totalPlanAmountStr];
  2600. lblProcurementAmount.text=[Util thousandSeparatorFormat:totalOrderAmountStr];
  2601. double percent=(totalOrderAmount/totalPlanAmount)*100;
  2602. NSString *percentStr=[NSString stringWithFormat:@"%.2f",percent];
  2603. lblProcuremmentPercent.text=[NSString stringWithFormat:@"%@%@%@",@"完成率",percentStr,@"%"];
  2604. percent=[percentStr doubleValue];
  2605. [procurementStatusV progress:percent];
  2606. double maximumValue=[self getYAxisMaximumValue:orderAmountArray];
  2607. double minimumValue=[self getYAxisMinimumValue:orderAmountArray];
  2608. IntAxisValueFormatter *formatter= [[IntAxisValueFormatter alloc] init];
  2609. [formatter setTitle:procurementStatusXTitleArray];
  2610. [self drawTwoBarchart:procurementStatusYArray receivablesTitleArray:procurementStatusTitleArray barChartView:_procurementStatusChartView axisValueFormatter:formatter xAxisLabelCount:procurementStatusXTitleArray.count maximumValue:maximumValue minimumValue:minimumValue];
  2611. }
  2612. else{
  2613. [_procurementStatusChartView clear];
  2614. [_procurementStatusChartView notifyDataSetChanged];
  2615. }
  2616. }
  2617. }
  2618. -(void)onProcurementStatusLoadFail{
  2619. [self stopLoading];
  2620. [self showAlertViewText:@"网络连接异常"];
  2621. }
  2622. /**
  2623. 库存状态加载完成
  2624. */
  2625. -(void)onInventoryStatusLoadFinish:(ASIDownManager *)sender {
  2626. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2627. int iStatus = resultModel.status;
  2628. count++;
  2629. if(count>=3)
  2630. {
  2631. [self stopLoading];
  2632. }
  2633. if(iStatus==0)
  2634. {
  2635. NSDictionary *resultDic= (NSDictionary*)resultModel.result;
  2636. NSArray *resultArray= [resultDic objectForKey:@"Table"];
  2637. if(resultArray!=nil&&resultArray.count>0)
  2638. {
  2639. double totalInventoryQuantity=0;
  2640. double totalInventoryAmount=0;
  2641. for(int i=0;i<resultArray.count;i++)
  2642. {
  2643. NSDictionary *dic=[resultArray objectAtIndex:i];
  2644. double inventoryAmountValue=[[dic objectForKey:@"InventoryAmount"]doubleValue];double inventoryQuantityValue=[[dic objectForKey:@"InventoryQuantity"]doubleValue];
  2645. totalInventoryQuantity+=inventoryQuantityValue;
  2646. totalInventoryAmount+=inventoryAmountValue;
  2647. NSString *kindName=[dic objectForKey:@"KindName"];
  2648. [inventoryTitleArray addObject:kindName];
  2649. NSString *inventoryAmountStr=[NSString stringWithFormat:@"%.2f",inventoryAmountValue];
  2650. NSString *inventoryQuantityStr=[NSString stringWithFormat:@"%.2f",inventoryQuantityValue];
  2651. [inventoryAmountArray addObject:inventoryAmountStr];
  2652. [inventoryQuantityArray addObject:inventoryQuantityStr];
  2653. }
  2654. NSString *totalInventoryQuantityStr= [NSString stringWithFormat:@"%.2f",totalInventoryQuantity];
  2655. totalInventoryQuantityStr= [Util thousandSeparatorFormat:totalInventoryQuantityStr];
  2656. lblInventoryQuantity.text=totalInventoryQuantityStr;
  2657. NSString *totalInventoryAmountStr=[NSString stringWithFormat:@"%.2f",totalInventoryAmount];
  2658. totalInventoryAmountStr= [Util thousandSeparatorFormat:totalInventoryAmountStr];
  2659. lblInventoryAmount.text=totalInventoryAmountStr;
  2660. [self drawPieView:inventoryAmountArray pieTitleArray:inventoryTitleArray pieView:_pieView];
  2661. }
  2662. else{
  2663. [_pieView clear];
  2664. [_pieView notifyDataSetChanged];
  2665. }
  2666. }
  2667. }
  2668. /**
  2669. 库存状态加载失败
  2670. */
  2671. -(void)onInventoryStatusLoadFail:(ASIDownManager *)sender {
  2672. [self stopLoading];
  2673. [self showAlertViewText:@"网络异常"];
  2674. }
  2675. /**
  2676. 应付情况加载完成
  2677. */
  2678. -(void)onPayableLoadFinish:(ASIDownManager *)sender {
  2679. count++;
  2680. if(count>=3)
  2681. {
  2682. [self stopLoading];
  2683. }
  2684. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2685. int iStatus = resultModel.status;
  2686. if(iStatus==0)
  2687. {
  2688. NSDictionary *resultDic= (NSDictionary*)resultModel.result;
  2689. NSMutableArray *yAxisArray=[[NSMutableArray alloc]init];
  2690. if(resultDic!=nil)
  2691. {
  2692. NSArray *resultArray= [resultDic objectForKey:@"Table"];
  2693. NSMutableArray *yAxisArray=[[NSMutableArray alloc]init];
  2694. if(resultArray!=nil&&resultArray.count>0)
  2695. {
  2696. double totalAccountPayable=0;
  2697. double totalAdvanceMoney=0;
  2698. for(int i=0;i<resultArray.count;i++)
  2699. {
  2700. NSDictionary *dic=[resultArray objectAtIndex:i];
  2701. double accountPayableValue=[[dic objectForKey:@"AccountPayable"]doubleValue];
  2702. NSString * accountPayable=[NSString stringWithFormat:@"%.2f",accountPayableValue];
  2703. [yAxisArray addObject:accountPayable];
  2704. totalAccountPayable+=accountPayableValue;
  2705. double advanceMoneyValue=[[dic objectForKey:@"AdvanceMoney"]doubleValue];
  2706. NSString *advanceMoney=[NSString stringWithFormat:@"%.2f",advanceMoneyValue];
  2707. [yAxisArray addObject:accountPayable];
  2708. totalAdvanceMoney+=advanceMoneyValue;
  2709. NSString *name=[dic objectForKey:@"Name"];
  2710. [payableXTitleArray addObject:name];
  2711. NSMutableDictionary *payableDic=[[NSMutableDictionary alloc]init];
  2712. [payableDic setObject:accountPayable forKeyedSubscript:@"AccountReceivable"];
  2713. [yAxisArray addObject:accountPayable];
  2714. [payableDic setObject:advanceMoney forKeyedSubscript:@"AdvanceMoney"];
  2715. [advancePaymentValuesArray addObject:payableDic];
  2716. }
  2717. NSString *totalAccountPayableStr= [NSString stringWithFormat:@"%.2f",totalAccountPayable];
  2718. totalAccountPayableStr= [Util thousandSeparatorFormat:totalAccountPayableStr];
  2719. lblAccountsPayable.text=totalAccountPayableStr;
  2720. NSString *totalAdvanceMoneyStr= [NSString stringWithFormat:@"%.2f",totalAdvanceMoney];
  2721. totalAdvanceMoneyStr= [Util thousandSeparatorFormat:totalAdvanceMoneyStr];
  2722. lblAdvancePaymentAmount.text=totalAdvanceMoneyStr;
  2723. double maximumValue=[self getYAxisMaximumValue:yAxisArray];
  2724. double minimumValue=[self getYAxisMinimumValue:yAxisArray];
  2725. IntAxisValueFormatter *formatter= [[IntAxisValueFormatter alloc] init];
  2726. [formatter setTitle:payableXTitleArray];
  2727. [self drawTwoBarchart:advancePaymentValuesArray receivablesTitleArray:advancePaymentTitleArray barChartView:_payableChartView axisValueFormatter:formatter xAxisLabelCount:payableXTitleArray.count maximumValue:maximumValue minimumValue:minimumValue];
  2728. }
  2729. else{
  2730. [ _payableChartView clear];
  2731. [_payableChartView notifyDataSetChanged];
  2732. }
  2733. }
  2734. }
  2735. }
  2736. /**
  2737. 应付情况加载失败
  2738. */
  2739. -(void)onPayableLoadFail:(ASIDownManager *)sender {
  2740. [self stopLoading];
  2741. [self showAlertViewText:@"网络异常"];
  2742. }
  2743. /**
  2744. 往来情况加载完成
  2745. */
  2746. -(void)onCurrentSituationLoadFinish:(ASIDownManager *)sender {
  2747. count++;
  2748. if(count>=3)
  2749. {
  2750. [self stopLoading];
  2751. }
  2752. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2753. int iStatus = resultModel.status;
  2754. if(iStatus==0)
  2755. {
  2756. NSDictionary *resultDic= (NSDictionary*)resultModel.result;
  2757. if(resultDic!=nil)
  2758. {
  2759. NSArray *resultArray= [resultDic objectForKey:@"Table"];
  2760. NSMutableArray *yAxisArray=[[NSMutableArray alloc]init];
  2761. if(resultArray!=nil&&resultArray.count>0)
  2762. {
  2763. double totalAccountReceivable=0;
  2764. double totalBalanceAmount=0;
  2765. double totalDepositReceived=0;
  2766. double totalEarnest=0;
  2767. for(int i=0;i<resultArray.count;i++)
  2768. {
  2769. NSDictionary *dic=[resultArray objectAtIndex:i];
  2770. double accountReceivableValue=[[dic objectForKey:@"AccountReceivable"]doubleValue];
  2771. NSString *accountReceivable=[NSString stringWithFormat:@"%.2f",accountReceivableValue];
  2772. [yAxisArray addObject:accountReceivable];
  2773. double balanceAmountValue=[[dic objectForKey:@"BalanceAmount"]doubleValue];
  2774. double depositReceivedValue=[[dic objectForKey:@"DepositReceived"]doubleValue];
  2775. NSString *depositReceived=[NSString stringWithFormat:@"%.2f",depositReceivedValue];
  2776. [yAxisArray addObject:depositReceived];
  2777. NSMutableDictionary *accountReceivableDic=[[NSMutableDictionary alloc]init];
  2778. [accountReceivableDic setObject:accountReceivable forKeyedSubscript:@"AccountReceivable"];
  2779. [accountReceivableDic setObject:depositReceived forKeyedSubscript:@"DepositReceived"];
  2780. [receivablesValuesArray addObject:accountReceivableDic];
  2781. double earnestValue=[[dic objectForKey:@"Earnest"]doubleValue];
  2782. NSString *name=[dic objectForKey:@"Name"];
  2783. [receivableXTitleArray addObject:name];
  2784. totalAccountReceivable+=accountReceivableValue;
  2785. totalBalanceAmount+=balanceAmountValue;
  2786. totalDepositReceived+=depositReceivedValue;
  2787. totalEarnest+=earnestValue;
  2788. }
  2789. NSString *totalAccountReceivableStr= [NSString stringWithFormat:@"%.2f",totalAccountReceivable];
  2790. totalAccountReceivableStr= [Util thousandSeparatorFormat:totalAccountReceivableStr];
  2791. lblReceivablesAmount.text=totalAccountReceivableStr;
  2792. NSString *totalEarnestStr=[NSString stringWithFormat:@"%.2f",totalEarnest];
  2793. totalEarnestStr= [Util thousandSeparatorFormat:totalEarnestStr];
  2794. lblDepositAmount.text=totalEarnestStr;
  2795. NSString *totalDepositReceivedStr= [NSString stringWithFormat:@"%.2f",totalDepositReceived];
  2796. totalDepositReceivedStr= [Util thousandSeparatorFormat:totalDepositReceivedStr];
  2797. lblAdvancePayment.text=totalDepositReceivedStr;
  2798. NSString *totalBalanceAmountStr= [NSString stringWithFormat:@"%.2f",totalBalanceAmount];
  2799. totalBalanceAmountStr= [Util thousandSeparatorFormat:totalBalanceAmountStr];
  2800. lblReceivablesAdvanceDeposit.text=totalBalanceAmountStr;
  2801. double maximumValue=[self getYAxisMaximumValue:yAxisArray];
  2802. double minimumValue=[self getYAxisMinimumValue:yAxisArray];
  2803. IntAxisValueFormatter *formatter= [[IntAxisValueFormatter alloc] init];
  2804. [formatter setTitle:receivableXTitleArray];
  2805. [self drawTwoBarchart:receivablesValuesArray receivablesTitleArray:receivableTitleArray barChartView:_currentSituationChartView axisValueFormatter:formatter xAxisLabelCount:receivableXTitleArray.count maximumValue:maximumValue minimumValue:minimumValue];
  2806. }
  2807. else{
  2808. [_currentSituationChartView clear];
  2809. [_currentSituationChartView notifyDataSetChanged];
  2810. }
  2811. }
  2812. }
  2813. }
  2814. /**
  2815. 往来情况加载失败
  2816. */
  2817. -(void)onCurrentSituationLoadFail:(ASIDownManager *)sender {
  2818. [self stopLoading];
  2819. [self showAlertViewText:@"网络异常"];
  2820. }
  2821. /**
  2822. 货币资金加载完成
  2823. */
  2824. -(void)onAccountCashsDataLoadFinish:(ASIDownManager *)sender {
  2825. ++count;
  2826. if(count>=3)
  2827. {
  2828. [self stopLoading];
  2829. }
  2830. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2831. int iStatus = resultModel.status;
  2832. if(iStatus==0)
  2833. {
  2834. NSDictionary *resultDic= (NSDictionary*)resultModel.result;
  2835. NSArray *resultArray=[resultDic objectForKey:@"Table"];
  2836. double totalInComeAmount=0;
  2837. double totalPayAmount=0;
  2838. double totalMoneytoryAssets=0;
  2839. double totalNetIncome=0;
  2840. double inventoryCash=0;
  2841. double bankDeposit=0;
  2842. double otherMoneytoryAssets=0;
  2843. if(resultArray!=nil&&resultArray.count>0)
  2844. {
  2845. NSMutableArray *yAxisArray=[[NSMutableArray alloc]init];
  2846. for(int i=0;i<resultArray.count;i++)
  2847. {
  2848. NSDictionary *dic=[resultArray objectAtIndex:i];
  2849. //借
  2850. double incomeAmount=[[dic objectForKey:@"DebitAmount"]doubleValue];
  2851. totalInComeAmount+=incomeAmount;
  2852. //贷
  2853. double payAmount=[[dic objectForKey:@"CreditAmount"]doubleValue];
  2854. totalPayAmount+=payAmount;
  2855. NSString *subjectCode=[dic objectForKey:@"CapitalAccountTypeName"];
  2856. double amount=[[dic objectForKey:@"Amount"]doubleValue];
  2857. if([subjectCode containsString:@"现金"])
  2858. {
  2859. inventoryCash=amount;
  2860. }
  2861. if([subjectCode containsString:@"银行"])
  2862. {
  2863. bankDeposit=amount;
  2864. }
  2865. if([subjectCode containsString:@"其他"])
  2866. {
  2867. otherMoneytoryAssets=amount;
  2868. }
  2869. totalMoneytoryAssets+=amount;
  2870. }
  2871. totalNetIncome=totalInComeAmount-totalPayAmount;
  2872. NSString * totalNetIncomeStr=[NSString stringWithFormat:@"%.2f",totalNetIncome];
  2873. NSString * totalMoneytoryAssetsStr=[NSString stringWithFormat:@"%.2f",totalMoneytoryAssets];
  2874. NSString * totalInComeAmountStr=[NSString stringWithFormat:@"%.2f",totalInComeAmount];
  2875. NSString *totalPayAmountStr=[NSString stringWithFormat:@"%.2f",totalPayAmount];
  2876. [yAxisArray addObject:totalInComeAmountStr];
  2877. [yAxisArray addObject:totalPayAmountStr];
  2878. double maximumValue= [self getYAxisMaximumValue:yAxisArray];
  2879. double minimumValue=[self getYAxisMinimumValue:yAxisArray];
  2880. [netMoneyValues addObject:totalInComeAmountStr];
  2881. [netMoneyValues addObject:totalPayAmountStr];
  2882. NetMoneyInflowAxisValueFormatter *netMoneyFormatter=[[NetMoneyInflowAxisValueFormatter alloc]init];
  2883. totalMoneytoryAssetsStr= [Util thousandSeparatorFormat:totalMoneytoryAssetsStr];
  2884. lblMonetoryCapitalAmount.text=totalMoneytoryAssetsStr;
  2885. NSString *inventoryCashStr= [NSString stringWithFormat:@"%.2f",inventoryCash];
  2886. inventoryCashStr= [Util thousandSeparatorFormat:inventoryCashStr];
  2887. lblCashInHand.text=inventoryCashStr;
  2888. NSString *bankDepositStr= [NSString stringWithFormat:@"%.2f",bankDeposit];
  2889. bankDepositStr= [Util thousandSeparatorFormat:bankDepositStr];
  2890. lblBankDeposit.text=bankDepositStr;
  2891. NSString *otherMoneytoryAssetsStr= [NSString stringWithFormat:@"%.2f",otherMoneytoryAssets];
  2892. otherMoneytoryAssetsStr= [Util thousandSeparatorFormat:otherMoneytoryAssetsStr];
  2893. lblOtherMonetoryCaiptal.text=otherMoneytoryAssetsStr;
  2894. totalNetIncomeStr= [Util thousandSeparatorFormat:totalNetIncomeStr];
  2895. lblNetMoneyInflow.text=totalNetIncomeStr;
  2896. [self drawSingleBarchart:netMoneyValues chartView:_singleChartView axisValueFormatter:netMoneyFormatter xAxisLabelCount:netMoneyValues.count maximumValue:maximumValue minimumValue:minimumValue paymentFeesIdArray:nil];
  2897. }
  2898. else{
  2899. [_singleChartView clear];
  2900. [_singleChartView notifyDataSetChanged];
  2901. }
  2902. }
  2903. }
  2904. /**
  2905. 货币资金日期回调
  2906. @param datePickerController <#datePickerController description#>
  2907. @param date <#date description#>
  2908. @param dateString <#dateString description#>
  2909. */
  2910. - (void)datePickerController:(ITDatePickerController *)datePickerController didSelectedDate:(NSDate *)date dateString:(NSString *)dateString {
  2911. NSInteger tag = datePickerController.tag;
  2912. if (datePickerController.tag == 100) {
  2913. NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  2914. [dateFormatter setDateFormat:@"yyyy-MM"] ;
  2915. NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
  2916. [dateFormatter1 setDateFormat:@"yyyyMM"];
  2917. //NSDate转NSString
  2918. moneytoryAssetsDate = [dateFormatter1 stringFromDate:date];
  2919. [_btnMonetoryCaitalCustom setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal];
  2920. [self clearMoneytoryAssetsData];
  2921. [self startLoading];
  2922. [self loadtAccountCashsData];
  2923. }
  2924. if(datePickerController.tag == 101)
  2925. {
  2926. NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  2927. [dateFormatter setDateFormat:@"yyyy-MM"] ;
  2928. NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
  2929. [dateFormatter1 setDateFormat:@"yyyyMM"];
  2930. //NSDate转NSString
  2931. procurementStatusDate = [dateFormatter1 stringFromDate:date];
  2932. [_btnProcurementCustomMonth setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal];
  2933. [procurementStatusYArray removeAllObjects];
  2934. [procurementStatusXTitleArray removeAllObjects];
  2935. [self clearProcuremmentData];
  2936. [self startLoading];
  2937. [self loadProcurementStatusData];
  2938. }
  2939. if(datePickerController.tag == 102)
  2940. {
  2941. NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  2942. [dateFormatter setDateFormat:@"yyyy-MM"] ;
  2943. NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init];
  2944. [dateFormatter1 setDateFormat:@"yyyyMM"];
  2945. //NSDate转NSString
  2946. paymentFeesDate = [dateFormatter1 stringFromDate:date];
  2947. [_btnPaymentFeesCustomMonth setTitle: [dateFormatter stringFromDate:date] forState:UIControlStateNormal];
  2948. [paymentFeesYArray removeAllObjects];
  2949. [paymentFeesYIdArray removeAllObjects];
  2950. [paymentFeesXArray removeAllObjects];
  2951. [self clearPaymentFeesData];
  2952. [self startLoading];
  2953. [self loadPaymentFeesData];
  2954. }
  2955. }
  2956. /**
  2957. 货币资金数据加载失败
  2958. */
  2959. -(void)onAccountCashsDataLoadFail:(ASIDownManager *)sender {
  2960. [self stopLoading];
  2961. [self showAlertViewText:@"网络异常"];
  2962. }
  2963. //-(void)onFNCAccountLoadFinish:(ASIDownManager *)sender {
  2964. // // [self stopLoading];
  2965. // RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  2966. // int iStatus = resultModel.status;
  2967. // if(iStatus==0)
  2968. // {
  2969. // fncArray=(NSArray*)resultModel.result;
  2970. // if(fncArray!=nil&&fncArray.count>0)
  2971. // {
  2972. // NSDictionary *resultDic=[fncArray objectAtIndex:0];
  2973. // int accountIdValue=[[resultDic objectForKey:@"AccountID"]intValue];
  2974. // accountCode=[resultDic objectForKey:@"AccountCode"];
  2975. // accountId =[NSString stringWithFormat:@"%d",accountIdValue];
  2976. // [btnFncAccount setTitle:accountCode forState:UIControlStateNormal];
  2977. //
  2978. // }
  2979. // }
  2980. //
  2981. //}
  2982. //-(void)goFncAccount
  2983. //{
  2984. // CustomerReportTextVC *tc = [[CustomerReportTextVC alloc] init];
  2985. // tc.delegate=self;
  2986. // tc.jsonArr=fncArray;
  2987. // tc.showDialogViewTag=ReportFncAccount;
  2988. // [self.navigationController pushViewController:tc animated:YES];
  2989. //}
  2990. //-(void)onFNCAccountLoadFail:(ASIDownManager *)sender {
  2991. // // [self stopLoading];
  2992. //}
  2993. //- (void)customerReportTextDoneDatas:(CustomerReportTextInfoModel *)model CustomerReport:(CustomerReport)cr{
  2994. // if (model == nil) {
  2995. // return;
  2996. // }
  2997. //
  2998. // //渠道返回值
  2999. // if(cr == ReportFncAccount){
  3000. // accountId=model.idCode;
  3001. // accountCode=model.name;
  3002. // [btnFncAccount setTitle:model.name forState:UIControlStateNormal];
  3003. //
  3004. // }
  3005. //
  3006. //}
  3007. /**
  3008. 销售利润加载完成
  3009. */
  3010. - (void)onSalesProfitLoadFinish:(ASIDownManager *)sender {
  3011. // 取消进度条
  3012. count++;
  3013. if(count>=3)
  3014. {
  3015. [self stopLoading];
  3016. }
  3017. // 服务器返回数据
  3018. RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
  3019. // 服务器返回数据状态值
  3020. int iStatus = resultModel.status;
  3021. // 服务器返回数据消息
  3022. NSString *message = resultModel.message;
  3023. // ++count;
  3024. [self stopLoading];
  3025. // 服务器返回数据状态值正确
  3026. if (iStatus == 0)
  3027. {
  3028. NSDictionary *result=(NSDictionary*)resultModel.result;
  3029. if(result!=nil)
  3030. {
  3031. NSArray *resultArray=[result objectForKey:@"Table"];
  3032. if(resultArray!=nil&&resultArray.count>0)
  3033. {
  3034. double totalNetProfitRate=0;
  3035. double totalSalesIncome=0;
  3036. double totalSalesCost=0;
  3037. double totalFeeAmount=0;
  3038. double totalNetProfit=0;
  3039. double totalMariProfit=0;
  3040. double totalMariProfitRate=0;
  3041. NSMutableArray *yAxisArray=[[NSMutableArray alloc]init];
  3042. for(int i=0;i<resultArray.count;i++)
  3043. {
  3044. NSDictionary *resultDic=[resultArray objectAtIndex:i];
  3045. double amountValue=[[resultDic objectForKey:@"Amount"]doubleValue];
  3046. totalSalesIncome+=amountValue;
  3047. NSString *amount=[NSString stringWithFormat:@"%.2f",amountValue];
  3048. double costAmountValue=[[resultDic objectForKey:@"CostAmount"]doubleValue];
  3049. totalSalesCost+=costAmountValue;
  3050. NSString *costAmount=[NSString stringWithFormat:@"%.2f",costAmountValue];
  3051. double feeAmountValue=[[resultDic objectForKey:@"FeeAmount"]doubleValue];
  3052. totalFeeAmount+=feeAmountValue;
  3053. NSString *feeAmount=[NSString stringWithFormat:@"%.2f",feeAmountValue];
  3054. double mariProfitValue=[[resultDic objectForKey:@"MariProfit"]doubleValue];
  3055. totalMariProfit+=mariProfitValue;
  3056. NSString *mariProfit=[NSString stringWithFormat:@"%.2f",mariProfitValue];
  3057. NSString *name=[resultDic objectForKey:@"Name"];
  3058. [salesProfitTitleArray addObject:name];
  3059. double profitValue=[[resultDic objectForKey:@"Profit"]doubleValue];
  3060. totalNetProfit+=profitValue;
  3061. NSString *profit=[NSString stringWithFormat:@"%.2f",profitValue];
  3062. NSMutableDictionary *salesIncomeDic=[[NSMutableDictionary alloc]init];
  3063. [salesIncomeDic setObject:amount forKeyedSubscript:@"Amount"];
  3064. [salesIncomeDic setObject:costAmount forKeyedSubscript:@"CostAmount"];
  3065. [salesIncomeDic setObject:feeAmount forKeyedSubscript:@"FeeAmount"];
  3066. [salesIncomeYValues addObject:salesIncomeDic];
  3067. [yAxisArray addObject:amount];
  3068. [yAxisArray addObject:costAmount];
  3069. [yAxisArray addObject:feeAmount];
  3070. }
  3071. double maximumValue= [self getYAxisMaximumValue:yAxisArray];
  3072. double minimumValue=[self getYAxisMinimumValue:yAxisArray];
  3073. if(totalSalesIncome==0)
  3074. {
  3075. totalMariProfitRate=0;
  3076. }
  3077. else{
  3078. totalMariProfitRate=(totalMariProfit/totalSalesIncome)*100;
  3079. }
  3080. NSString * totalMariProfitRateStr=[NSString stringWithFormat:@"%.2f",totalMariProfitRate];
  3081. lblGrossProfitMargin.text=[NSString stringWithFormat:@"%@%@",totalMariProfitRateStr,@"%"];
  3082. if(totalSalesIncome==0)
  3083. {
  3084. totalNetProfitRate=0;
  3085. }
  3086. else{
  3087. totalNetProfitRate =( totalNetProfit/totalSalesIncome)*100;
  3088. }
  3089. NSString * totalNetProfitRateStr=[NSString stringWithFormat:@"%.2f",totalNetProfitRate];
  3090. lblNetProfitRate.text=[NSString stringWithFormat:@"%@%@",totalNetProfitRateStr,@"%"];
  3091. NSString *totalSalesIncomeStr= [NSString stringWithFormat:@"%.2f",totalSalesIncome];
  3092. totalSalesIncomeStr= [Util thousandSeparatorFormat:totalSalesIncomeStr];
  3093. lblSalesIncome.text=totalSalesIncomeStr;
  3094. NSString *totalSalesCostStr=[NSString stringWithFormat:@"%.2f",totalSalesCost];
  3095. totalSalesCostStr= [Util thousandSeparatorFormat:totalSalesCostStr];
  3096. lblSalesCost.text=totalSalesCostStr;
  3097. NSString *totalFeeAmountStr= [NSString stringWithFormat:@"%.2f",totalFeeAmount];
  3098. lblFeeAmount.text=[Util thousandSeparatorFormat:totalFeeAmountStr];
  3099. NSString *totalNetProfitStr= [NSString stringWithFormat:@"%.2f",totalNetProfit];
  3100. totalNetProfitStr=[Util thousandSeparatorFormat:totalNetProfitStr];
  3101. lblNetProfit.text=totalNetProfitStr;
  3102. NSString *totalMariProfitStr= [NSString stringWithFormat:@"%.2f",totalMariProfit];
  3103. totalMariProfitStr=[Util thousandSeparatorFormat:totalMariProfitStr];
  3104. lblSalesMargin.text=totalMariProfitStr;
  3105. IntAxisValueFormatter *formatter= [[IntAxisValueFormatter alloc] init];
  3106. [formatter setTitle:salesProfitTitleArray];
  3107. [self drawMultipleBarchart:salesIncomeYValues receivablesTitleArray:salesIncomeTitleArray barChartView:_chartView axisValueFormatter:formatter xAxisLabelCount:salesProfitTitleArray.count maximumValue:maximumValue+100 minimumValue:minimumValue];
  3108. }
  3109. else
  3110. {
  3111. [_chartView clear];
  3112. [_chartView notifyDataSetChanged];
  3113. }
  3114. }
  3115. }
  3116. }
  3117. /**
  3118. 销售利润加载失败
  3119. * @param sender <#sender description#>
  3120. */
  3121. - (void)onSalesProfitLoadFail:(ASIDownManager *)sender {
  3122. [self stopLoading];
  3123. [self showAlertViewText:@"网络异常"];
  3124. }
  3125. /**
  3126. 柱状图选中事件
  3127. */
  3128. - (void)chartValueSelected:(ChartViewBase * __nonnull)chartView entry:(ChartDataEntry * __nonnull)entry highlight:(ChartHighlight * __nonnull)highlight
  3129. {
  3130. if(chartView.tag==1001)
  3131. {
  3132. NSInteger organizationId=entry.id;
  3133. if(organizationId>0)
  3134. {
  3135. self.hidesBottomBarWhenPushed=YES;
  3136. StatisticsDataAnalysisDetailVC *detailVc = [[StatisticsDataAnalysisDetailVC alloc] init];
  3137. detailVc.organizationId=[NSString stringWithFormat:@"%ld",organizationId];
  3138. detailVc.accountMonth=paymentFeesDate;
  3139. detailVc.typeId=@"0";
  3140. [self.navigationController pushViewController:detailVc animated:YES];
  3141. }
  3142. else
  3143. {
  3144. NSMutableArray *otherArray=[[NSMutableArray alloc]init];
  3145. for(int i=0;i<paymentFeesYIdArray.count;i++)
  3146. {
  3147. NSString *departmentId=[paymentFeesYIdArray objectAtIndex:i];
  3148. if([departmentId intValue]>0)
  3149. {
  3150. [otherArray addObject:departmentId];
  3151. NSString *departmentIds= [otherArray componentsJoinedByString:@","];
  3152. self.hidesBottomBarWhenPushed=YES;
  3153. StatisticsDataAnalysisDetailVC *detailVc = [[StatisticsDataAnalysisDetailVC alloc] init];
  3154. detailVc.organizationId=departmentIds;
  3155. detailVc.accountMonth=paymentFeesDate;
  3156. detailVc.typeId=@"1";
  3157. [self.navigationController pushViewController:detailVc animated:YES];
  3158. }
  3159. }
  3160. }
  3161. }
  3162. }
  3163. /**
  3164. 柱状图反选事件
  3165. */
  3166. - (void)chartValueNothingSelected:(ChartViewBase * __nonnull)chartView
  3167. {
  3168. }
  3169. @end